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/ArgumentEntry.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/ArgumentEntry.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java b/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java deleted file mode 100644 index 9154cc2..0000000 --- a/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java +++ /dev/null | |||
| @@ -1,110 +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 ArgumentEntry implements Entry { | ||
| 17 | |||
| 18 | private BehaviorEntry behaviorEntry; | ||
| 19 | private int index; | ||
| 20 | private String name; | ||
| 21 | |||
| 22 | public ArgumentEntry(BehaviorEntry behaviorEntry, int index, String name) { | ||
| 23 | if (behaviorEntry == null) { | ||
| 24 | throw new IllegalArgumentException("Behavior cannot be null!"); | ||
| 25 | } | ||
| 26 | if (index < 0) { | ||
| 27 | throw new IllegalArgumentException("Index must be non-negative!"); | ||
| 28 | } | ||
| 29 | if (name == null) { | ||
| 30 | throw new IllegalArgumentException("Argument name cannot be null!"); | ||
| 31 | } | ||
| 32 | |||
| 33 | this.behaviorEntry = behaviorEntry; | ||
| 34 | this.index = index; | ||
| 35 | this.name = name; | ||
| 36 | } | ||
| 37 | |||
| 38 | public ArgumentEntry(ArgumentEntry other) { | ||
| 39 | this.behaviorEntry = other.getBehaviorEntry(); | ||
| 40 | this.index = other.index; | ||
| 41 | this.name = other.name; | ||
| 42 | } | ||
| 43 | |||
| 44 | public ArgumentEntry(ArgumentEntry other, String newClassName) { | ||
| 45 | this.behaviorEntry = (BehaviorEntry) other.behaviorEntry.cloneToNewClass(new ClassEntry(newClassName)); | ||
| 46 | this.index = other.index; | ||
| 47 | this.name = other.name; | ||
| 48 | } | ||
| 49 | |||
| 50 | public ArgumentEntry(ArgumentEntry other, BehaviorEntry entry) { | ||
| 51 | this.behaviorEntry = entry; | ||
| 52 | this.index = other.index; | ||
| 53 | this.name = other.name; | ||
| 54 | } | ||
| 55 | |||
| 56 | public BehaviorEntry getBehaviorEntry() { | ||
| 57 | return this.behaviorEntry; | ||
| 58 | } | ||
| 59 | |||
| 60 | public int getIndex() { | ||
| 61 | return this.index; | ||
| 62 | } | ||
| 63 | |||
| 64 | @Override | ||
| 65 | public String getName() { | ||
| 66 | return this.name; | ||
| 67 | } | ||
| 68 | |||
| 69 | @Override | ||
| 70 | public ClassEntry getClassEntry() { | ||
| 71 | return this.behaviorEntry.getClassEntry(); | ||
| 72 | } | ||
| 73 | |||
| 74 | @Override | ||
| 75 | public String getClassName() { | ||
| 76 | return this.behaviorEntry.getClassName(); | ||
| 77 | } | ||
| 78 | |||
| 79 | @Override | ||
| 80 | public ArgumentEntry cloneToNewClass(ClassEntry classEntry) { | ||
| 81 | return new ArgumentEntry(this, classEntry.getName()); | ||
| 82 | } | ||
| 83 | |||
| 84 | public String getMethodName() { | ||
| 85 | return this.behaviorEntry.getName(); | ||
| 86 | } | ||
| 87 | |||
| 88 | public Signature getMethodSignature() { | ||
| 89 | return this.behaviorEntry.getSignature(); | ||
| 90 | } | ||
| 91 | |||
| 92 | @Override | ||
| 93 | public int hashCode() { | ||
| 94 | return Utils.combineHashesOrdered(this.behaviorEntry, Integer.valueOf(this.index).hashCode(), this.name.hashCode()); | ||
| 95 | } | ||
| 96 | |||
| 97 | @Override | ||
| 98 | public boolean equals(Object other) { | ||
| 99 | return other instanceof ArgumentEntry && equals((ArgumentEntry) other); | ||
| 100 | } | ||
| 101 | |||
| 102 | public boolean equals(ArgumentEntry other) { | ||
| 103 | return this.behaviorEntry.equals(other.behaviorEntry) && this.index == other.index && this.name.equals(other.name); | ||
| 104 | } | ||
| 105 | |||
| 106 | @Override | ||
| 107 | public String toString() { | ||
| 108 | return this.behaviorEntry + "(" + this.index + ":" + this.name + ")"; | ||
| 109 | } | ||
| 110 | } | ||