diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/MethodEntry.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/MethodEntry.java | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/MethodEntry.java b/src/main/java/cuchaz/enigma/mapping/MethodEntry.java deleted file mode 100644 index 9c3058c..0000000 --- a/src/main/java/cuchaz/enigma/mapping/MethodEntry.java +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.mapping; | ||
| 13 | |||
| 14 | import cuchaz.enigma.utils.Utils; | ||
| 15 | |||
| 16 | public class MethodEntry implements BehaviorEntry { | ||
| 17 | |||
| 18 | private ClassEntry classEntry; | ||
| 19 | private String name; | ||
| 20 | private Signature signature; | ||
| 21 | |||
| 22 | public MethodEntry(ClassEntry classEntry, String name, Signature signature) { | ||
| 23 | if (classEntry == null) { | ||
| 24 | throw new IllegalArgumentException("Class cannot be null!"); | ||
| 25 | } | ||
| 26 | if (name == null) { | ||
| 27 | throw new IllegalArgumentException("Method name cannot be null!"); | ||
| 28 | } | ||
| 29 | if (signature == null) { | ||
| 30 | throw new IllegalArgumentException("Method signature cannot be null!"); | ||
| 31 | } | ||
| 32 | if (name.startsWith("<")) { | ||
| 33 | throw new IllegalArgumentException("Don't use MethodEntry for a constructor!"); | ||
| 34 | } | ||
| 35 | |||
| 36 | this.classEntry = classEntry; | ||
| 37 | this.name = name; | ||
| 38 | this.signature = signature; | ||
| 39 | } | ||
| 40 | |||
| 41 | public MethodEntry(MethodEntry other, String newClassName) { | ||
| 42 | this.classEntry = new ClassEntry(newClassName); | ||
| 43 | this.name = other.name; | ||
| 44 | this.signature = other.signature; | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | public ClassEntry getClassEntry() { | ||
| 49 | return this.classEntry; | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | public String getName() { | ||
| 54 | return this.name; | ||
| 55 | } | ||
| 56 | |||
| 57 | @Override | ||
| 58 | public Signature getSignature() { | ||
| 59 | return this.signature; | ||
| 60 | } | ||
| 61 | |||
| 62 | @Override | ||
| 63 | public String getClassName() { | ||
| 64 | return this.classEntry.getName(); | ||
| 65 | } | ||
| 66 | |||
| 67 | @Override | ||
| 68 | public MethodEntry cloneToNewClass(ClassEntry classEntry) { | ||
| 69 | return new MethodEntry(this, classEntry.getName()); | ||
| 70 | } | ||
| 71 | |||
| 72 | @Override | ||
| 73 | public int hashCode() { | ||
| 74 | return Utils.combineHashesOrdered(this.classEntry, this.name, this.signature); | ||
| 75 | } | ||
| 76 | |||
| 77 | @Override | ||
| 78 | public boolean equals(Object other) { | ||
| 79 | return other instanceof MethodEntry && equals((MethodEntry) other); | ||
| 80 | } | ||
| 81 | |||
| 82 | public boolean equals(MethodEntry other) { | ||
| 83 | return this.classEntry.equals(other.classEntry) && this.name.equals(other.name) && this.signature.equals(other.signature); | ||
| 84 | } | ||
| 85 | |||
| 86 | @Override | ||
| 87 | public String toString() { | ||
| 88 | return this.classEntry.getName() + "." + this.name + this.signature; | ||
| 89 | } | ||
| 90 | } | ||