diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/ArgumentMapping.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/ArgumentMapping.java | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/ArgumentMapping.java b/src/main/java/cuchaz/enigma/mapping/ArgumentMapping.java index e3f8927..91ecd10 100644 --- a/src/main/java/cuchaz/enigma/mapping/ArgumentMapping.java +++ b/src/main/java/cuchaz/enigma/mapping/ArgumentMapping.java | |||
| @@ -8,42 +8,43 @@ | |||
| 8 | * Contributors: | 8 | * Contributors: |
| 9 | * Jeff Martin - initial API and implementation | 9 | * Jeff Martin - initial API and implementation |
| 10 | ******************************************************************************/ | 10 | ******************************************************************************/ |
| 11 | |||
| 11 | package cuchaz.enigma.mapping; | 12 | package cuchaz.enigma.mapping; |
| 12 | 13 | ||
| 13 | public class ArgumentMapping implements Comparable<ArgumentMapping> { | 14 | public class ArgumentMapping implements Comparable<ArgumentMapping> { |
| 14 | 15 | ||
| 15 | private int index; | 16 | private int index; |
| 16 | private String name; | 17 | private String name; |
| 17 | 18 | ||
| 18 | // NOTE: this argument order is important for the MethodReader/MethodWriter | 19 | // NOTE: this argument order is important for the MethodReader/MethodWriter |
| 19 | public ArgumentMapping(int index, String name) { | 20 | public ArgumentMapping(int index, String name) { |
| 20 | this.index = index; | 21 | this.index = index; |
| 21 | this.name = NameValidator.validateArgumentName(name); | 22 | this.name = NameValidator.validateArgumentName(name); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | public ArgumentMapping(ArgumentMapping other) { | 25 | public ArgumentMapping(ArgumentMapping other) { |
| 25 | this.index = other.index; | 26 | this.index = other.index; |
| 26 | this.name = other.name; | 27 | this.name = other.name; |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | public int getIndex() { | 30 | public int getIndex() { |
| 30 | return this.index; | 31 | return this.index; |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | public String getName() { | 34 | public String getName() { |
| 34 | return this.name; | 35 | return this.name; |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | public void setName(String val) { | 38 | public void setName(String val) { |
| 38 | this.name = NameValidator.validateArgumentName(val); | 39 | this.name = NameValidator.validateArgumentName(val); |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | public ArgumentEntry getObfEntry(BehaviorEntry behaviorEntry) { | 42 | public ArgumentEntry getObfEntry(BehaviorEntry behaviorEntry) { |
| 42 | return new ArgumentEntry(behaviorEntry, index, name); | 43 | return new ArgumentEntry(behaviorEntry, index, name); |
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | @Override | 46 | @Override |
| 46 | public int compareTo(ArgumentMapping other) { | 47 | public int compareTo(ArgumentMapping other) { |
| 47 | return Integer.compare(this.index, other.index); | 48 | return Integer.compare(this.index, other.index); |
| 48 | } | 49 | } |
| 49 | } | 50 | } |