diff options
| author | 2018-07-18 13:46:00 +0100 | |
|---|---|---|
| committer | 2018-07-18 13:46:00 +0100 | |
| commit | 1ebe691c12f68beea378b133ddc4bcbde7f3f795 (patch) | |
| tree | fb051d9fde5644bd144a7e9d7bcecc70a256359c /src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java | |
| parent | Recursively rebuild method names (diff) | |
| parent | Update version number (diff) | |
| download | enigma-fork-1ebe691c12f68beea378b133ddc4bcbde7f3f795.tar.gz enigma-fork-1ebe691c12f68beea378b133ddc4bcbde7f3f795.tar.xz enigma-fork-1ebe691c12f68beea378b133ddc4bcbde7f3f795.zip | |
Merge pull request #62 from OpenModLoader/asm
ASM based class translator
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java b/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java deleted file mode 100644 index 2bb5e3f..0000000 --- a/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java +++ /dev/null | |||
| @@ -1,102 +0,0 @@ | |||
| 1 | package cuchaz.enigma.mapping; | ||
| 2 | |||
| 3 | import cuchaz.enigma.utils.Utils; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * Desc... | ||
| 7 | * Created by Thog | ||
| 8 | * 19/10/2016 | ||
| 9 | */ | ||
| 10 | public class LocalVariableEntry implements Entry { | ||
| 11 | |||
| 12 | protected final BehaviorEntry behaviorEntry; | ||
| 13 | protected final String name; | ||
| 14 | protected final Type type; | ||
| 15 | protected final int index; | ||
| 16 | |||
| 17 | public LocalVariableEntry(BehaviorEntry behaviorEntry, int index, String name, Type type) { | ||
| 18 | if (behaviorEntry == null) { | ||
| 19 | throw new IllegalArgumentException("Behavior cannot be null!"); | ||
| 20 | } | ||
| 21 | if (index < 0) { | ||
| 22 | throw new IllegalArgumentException("Index must be non-negative!"); | ||
| 23 | } | ||
| 24 | if (name == null) { | ||
| 25 | throw new IllegalArgumentException("Variable name cannot be null!"); | ||
| 26 | } | ||
| 27 | if (type == null) { | ||
| 28 | throw new IllegalArgumentException("Variable type cannot be null!"); | ||
| 29 | } | ||
| 30 | |||
| 31 | this.behaviorEntry = behaviorEntry; | ||
| 32 | this.name = name; | ||
| 33 | this.type = type; | ||
| 34 | this.index = index; | ||
| 35 | } | ||
| 36 | |||
| 37 | public LocalVariableEntry(LocalVariableEntry other, ClassEntry newClassEntry) { | ||
| 38 | this.behaviorEntry = (BehaviorEntry) other.behaviorEntry.cloneToNewClass(newClassEntry); | ||
| 39 | this.name = other.name; | ||
| 40 | this.type = other.type; | ||
| 41 | this.index = other.index; | ||
| 42 | } | ||
| 43 | |||
| 44 | public BehaviorEntry getBehaviorEntry() { | ||
| 45 | return this.behaviorEntry; | ||
| 46 | } | ||
| 47 | |||
| 48 | public Type getType() { | ||
| 49 | return type; | ||
| 50 | } | ||
| 51 | |||
| 52 | public int getIndex() { | ||
| 53 | return index; | ||
| 54 | } | ||
| 55 | |||
| 56 | @Override | ||
| 57 | public String getName() { | ||
| 58 | return this.name; | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public ClassEntry getClassEntry() { | ||
| 63 | return this.behaviorEntry.getClassEntry(); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Override | ||
| 67 | public String getClassName() { | ||
| 68 | return this.behaviorEntry.getClassName(); | ||
| 69 | } | ||
| 70 | |||
| 71 | @Override | ||
| 72 | public LocalVariableEntry cloneToNewClass(ClassEntry classEntry) { | ||
| 73 | return new LocalVariableEntry(this, classEntry); | ||
| 74 | } | ||
| 75 | |||
| 76 | public String getMethodName() { | ||
| 77 | return this.behaviorEntry.getName(); | ||
| 78 | } | ||
| 79 | |||
| 80 | public Signature getMethodSignature() { | ||
| 81 | return this.behaviorEntry.getSignature(); | ||
| 82 | } | ||
| 83 | |||
| 84 | @Override | ||
| 85 | public int hashCode() { | ||
| 86 | return Utils.combineHashesOrdered(this.behaviorEntry, this.type.hashCode(), this.name.hashCode(), Integer.hashCode(this.index)); | ||
| 87 | } | ||
| 88 | |||
| 89 | @Override | ||
| 90 | public boolean equals(Object other) { | ||
| 91 | return other instanceof LocalVariableEntry && equals((LocalVariableEntry) other); | ||
| 92 | } | ||
| 93 | |||
| 94 | public boolean equals(LocalVariableEntry other) { | ||
| 95 | return this.behaviorEntry.equals(other.behaviorEntry) && this.type.equals(other.type) && this.name.equals(other.name) && this.index == other.index; | ||
| 96 | } | ||
| 97 | |||
| 98 | @Override | ||
| 99 | public String toString() { | ||
| 100 | return this.behaviorEntry + "(" + this.index + ":" + this.name + ":" + this.type + ")"; | ||
| 101 | } | ||
| 102 | } | ||