summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/mapping/MethodEntry.java
diff options
context:
space:
mode:
authorGravatar jeff2015-01-13 23:25:04 -0500
committerGravatar jeff2015-01-13 23:25:04 -0500
commit959cb5fd4f9586ec3bd265b452fe25fe1db82e3f (patch)
treebdd8a2c52c2fe053ba3460614bde8542e5378dbe /src/cuchaz/enigma/mapping/MethodEntry.java
parentgot rid of gradle in favor of ivy+ssjb (diff)
downloadenigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.gz
enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.xz
enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.zip
source format change
don't hate me too much if you were planning a big merge. =P
Diffstat (limited to 'src/cuchaz/enigma/mapping/MethodEntry.java')
-rw-r--r--src/cuchaz/enigma/mapping/MethodEntry.java79
1 files changed, 31 insertions, 48 deletions
diff --git a/src/cuchaz/enigma/mapping/MethodEntry.java b/src/cuchaz/enigma/mapping/MethodEntry.java
index dbc1885..beb490d 100644
--- a/src/cuchaz/enigma/mapping/MethodEntry.java
+++ b/src/cuchaz/enigma/mapping/MethodEntry.java
@@ -14,31 +14,26 @@ import java.io.Serializable;
14 14
15import cuchaz.enigma.Util; 15import cuchaz.enigma.Util;
16 16
17public class MethodEntry implements BehaviorEntry, Serializable 17public class MethodEntry implements BehaviorEntry, Serializable {
18{ 18
19 private static final long serialVersionUID = 4770915224467247458L; 19 private static final long serialVersionUID = 4770915224467247458L;
20 20
21 private ClassEntry m_classEntry; 21 private ClassEntry m_classEntry;
22 private String m_name; 22 private String m_name;
23 private String m_signature; 23 private String m_signature;
24 24
25 public MethodEntry( ClassEntry classEntry, String name, String signature ) 25 public MethodEntry(ClassEntry classEntry, String name, String signature) {
26 { 26 if (classEntry == null) {
27 if( classEntry == null ) 27 throw new IllegalArgumentException("Class cannot be null!");
28 {
29 throw new IllegalArgumentException( "Class cannot be null!" );
30 } 28 }
31 if( name == null ) 29 if (name == null) {
32 { 30 throw new IllegalArgumentException("Method name cannot be null!");
33 throw new IllegalArgumentException( "Method name cannot be null!" );
34 } 31 }
35 if( signature == null ) 32 if (signature == null) {
36 { 33 throw new IllegalArgumentException("Method signature cannot be null!");
37 throw new IllegalArgumentException( "Method signature cannot be null!" );
38 } 34 }
39 if( name.startsWith( "<" ) ) 35 if (name.startsWith("<")) {
40 { 36 throw new IllegalArgumentException("Don't use MethodEntry for a constructor!");
41 throw new IllegalArgumentException( "Don't use MethodEntry for a constructor!" );
42 } 37 }
43 38
44 m_classEntry = classEntry; 39 m_classEntry = classEntry;
@@ -46,76 +41,64 @@ public class MethodEntry implements BehaviorEntry, Serializable
46 m_signature = signature; 41 m_signature = signature;
47 } 42 }
48 43
49 public MethodEntry( MethodEntry other ) 44 public MethodEntry(MethodEntry other) {
50 { 45 m_classEntry = new ClassEntry(other.m_classEntry);
51 m_classEntry = new ClassEntry( other.m_classEntry );
52 m_name = other.m_name; 46 m_name = other.m_name;
53 m_signature = other.m_signature; 47 m_signature = other.m_signature;
54 } 48 }
55 49
56 public MethodEntry( MethodEntry other, String newClassName ) 50 public MethodEntry(MethodEntry other, String newClassName) {
57 { 51 m_classEntry = new ClassEntry(newClassName);
58 m_classEntry = new ClassEntry( newClassName );
59 m_name = other.m_name; 52 m_name = other.m_name;
60 m_signature = other.m_signature; 53 m_signature = other.m_signature;
61 } 54 }
62 55
63 @Override 56 @Override
64 public ClassEntry getClassEntry( ) 57 public ClassEntry getClassEntry() {
65 {
66 return m_classEntry; 58 return m_classEntry;
67 } 59 }
68 60
69 @Override 61 @Override
70 public String getName( ) 62 public String getName() {
71 {
72 return m_name; 63 return m_name;
73 } 64 }
74 65
75 @Override 66 @Override
76 public String getSignature( ) 67 public String getSignature() {
77 {
78 return m_signature; 68 return m_signature;
79 } 69 }
80 70
81 @Override 71 @Override
82 public String getClassName( ) 72 public String getClassName() {
83 {
84 return m_classEntry.getName(); 73 return m_classEntry.getName();
85 } 74 }
86 75
87 @Override 76 @Override
88 public MethodEntry cloneToNewClass( ClassEntry classEntry ) 77 public MethodEntry cloneToNewClass(ClassEntry classEntry) {
89 { 78 return new MethodEntry(this, classEntry.getName());
90 return new MethodEntry( this, classEntry.getName() );
91 } 79 }
92 80
93 @Override 81 @Override
94 public int hashCode( ) 82 public int hashCode() {
95 { 83 return Util.combineHashesOrdered(m_classEntry, m_name, m_signature);
96 return Util.combineHashesOrdered( m_classEntry, m_name, m_signature );
97 } 84 }
98 85
99 @Override 86 @Override
100 public boolean equals( Object other ) 87 public boolean equals(Object other) {
101 { 88 if (other instanceof MethodEntry) {
102 if( other instanceof MethodEntry ) 89 return equals((MethodEntry)other);
103 {
104 return equals( (MethodEntry)other );
105 } 90 }
106 return false; 91 return false;
107 } 92 }
108 93
109 public boolean equals( MethodEntry other ) 94 public boolean equals(MethodEntry other) {
110 { 95 return m_classEntry.equals(other.m_classEntry)
111 return m_classEntry.equals( other.m_classEntry ) 96 && m_name.equals(other.m_name)
112 && m_name.equals( other.m_name ) 97 && m_signature.equals(other.m_signature);
113 && m_signature.equals( other.m_signature );
114 } 98 }
115 99
116 @Override 100 @Override
117 public String toString( ) 101 public String toString() {
118 {
119 return m_classEntry.getName() + "." + m_name + m_signature; 102 return m_classEntry.getName() + "." + m_name + m_signature;
120 } 103 }
121} 104}