diff options
| author | 2016-07-02 20:13:13 +1000 | |
|---|---|---|
| committer | 2016-07-02 20:13:13 +1000 | |
| commit | 74edc74c2c7b3236f00bf92499bb884837673b7d (patch) | |
| tree | 155556b4d6e390574f16082583f2853e35e3c716 /src/main/java/cuchaz/enigma/mapping/FieldMapping.java | |
| parent | Renamed Fields (diff) | |
| download | enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.gz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.xz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.zip | |
Reformatting code
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/FieldMapping.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/FieldMapping.java | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/FieldMapping.java b/src/main/java/cuchaz/enigma/mapping/FieldMapping.java index 3f5a382..19d68a9 100644 --- a/src/main/java/cuchaz/enigma/mapping/FieldMapping.java +++ b/src/main/java/cuchaz/enigma/mapping/FieldMapping.java | |||
| @@ -16,67 +16,64 @@ public class FieldMapping implements Serializable, Comparable<FieldMapping>, Mem | |||
| 16 | 16 | ||
| 17 | private static final long serialVersionUID = 8610742471440861315L; | 17 | private static final long serialVersionUID = 8610742471440861315L; |
| 18 | 18 | ||
| 19 | private String m_obfName; | 19 | private String obfName; |
| 20 | private String m_deobfName; | 20 | private String deobfName; |
| 21 | private Type m_obfType; | 21 | private Type obfType; |
| 22 | 22 | ||
| 23 | public FieldMapping(String obfName, Type obfType, String deobfName) { | 23 | public FieldMapping(String obfName, Type obfType, String deobfName) { |
| 24 | m_obfName = obfName; | 24 | this.obfName = obfName; |
| 25 | m_deobfName = NameValidator.validateFieldName(deobfName); | 25 | this.deobfName = NameValidator.validateFieldName(deobfName); |
| 26 | m_obfType = obfType; | 26 | this.obfType = obfType; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | public FieldMapping(FieldMapping other, ClassNameReplacer obfClassNameReplacer) { | 29 | public FieldMapping(FieldMapping other, ClassNameReplacer obfClassNameReplacer) { |
| 30 | m_obfName = other.m_obfName; | 30 | this.obfName = other.obfName; |
| 31 | m_deobfName = other.m_deobfName; | 31 | this.deobfName = other.deobfName; |
| 32 | m_obfType = new Type(other.m_obfType, obfClassNameReplacer); | 32 | this.obfType = new Type(other.obfType, obfClassNameReplacer); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | @Override | 35 | @Override |
| 36 | public String getObfName() { | 36 | public String getObfName() { |
| 37 | return m_obfName; | 37 | return this.obfName; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | public void setObfName(String val) { | 40 | public void setObfName(String val) { |
| 41 | m_obfName = NameValidator.validateFieldName(val); | 41 | this.obfName = NameValidator.validateFieldName(val); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public String getDeobfName() { | 44 | public String getDeobfName() { |
| 45 | return m_deobfName; | 45 | return this.deobfName; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | public void setDeobfName(String val) { | 48 | public void setDeobfName(String val) { |
| 49 | m_deobfName = NameValidator.validateFieldName(val); | 49 | this.deobfName = NameValidator.validateFieldName(val); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | public Type getObfType() { | 52 | public Type getObfType() { |
| 53 | return m_obfType; | 53 | return this.obfType; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | public void setObfType(Type val) { | 56 | public void setObfType(Type val) { |
| 57 | m_obfType = val; | 57 | this.obfType = val; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | @Override | 60 | @Override |
| 61 | public int compareTo(FieldMapping other) { | 61 | public int compareTo(FieldMapping other) { |
| 62 | return (m_obfName + m_obfType).compareTo(other.m_obfName + other.m_obfType); | 62 | return (this.obfName + this.obfType).compareTo(other.obfName + other.obfType); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | public boolean renameObfClass(final String oldObfClassName, final String newObfClassName) { | 65 | public boolean renameObfClass(final String oldObfClassName, final String newObfClassName) { |
| 66 | 66 | ||
| 67 | // rename obf classes in the type | 67 | // rename obf classes in the type |
| 68 | Type newType = new Type(m_obfType, new ClassNameReplacer() { | 68 | Type newType = new Type(this.obfType, className -> { |
| 69 | @Override | 69 | if (className.equals(oldObfClassName)) { |
| 70 | public String replace(String className) { | 70 | return newObfClassName; |
| 71 | if (className.equals(oldObfClassName)) { | ||
| 72 | return newObfClassName; | ||
| 73 | } | ||
| 74 | return null; | ||
| 75 | } | 71 | } |
| 72 | return null; | ||
| 76 | }); | 73 | }); |
| 77 | 74 | ||
| 78 | if (!newType.equals(m_obfType)) { | 75 | if (!newType.equals(this.obfType)) { |
| 79 | m_obfType = newType; | 76 | this.obfType = newType; |
| 80 | return true; | 77 | return true; |
| 81 | } | 78 | } |
| 82 | return false; | 79 | return false; |
| @@ -84,6 +81,6 @@ public class FieldMapping implements Serializable, Comparable<FieldMapping>, Mem | |||
| 84 | 81 | ||
| 85 | @Override | 82 | @Override |
| 86 | public FieldEntry getObfEntry(ClassEntry classEntry) { | 83 | public FieldEntry getObfEntry(ClassEntry classEntry) { |
| 87 | return new FieldEntry(classEntry, m_obfName, new Type(m_obfType)); | 84 | return new FieldEntry(classEntry, this.obfName, new Type(this.obfType)); |
| 88 | } | 85 | } |
| 89 | } | 86 | } |