diff options
| author | 2014-08-21 01:10:37 -0400 | |
|---|---|---|
| committer | 2014-08-21 01:10:37 -0400 | |
| commit | 237b2ed2a6b6f537cdbdf9fc9c6d0c7743f34375 (patch) | |
| tree | ebad059c7fa0bc7723858cb25eed0bb6e95fe42a /src/cuchaz/enigma/mapping/ConstructorEntry.java | |
| parent | fixed recognition of inner class tokens (diff) | |
| download | enigma-fork-237b2ed2a6b6f537cdbdf9fc9c6d0c7743f34375.tar.gz enigma-fork-237b2ed2a6b6f537cdbdf9fc9c6d0c7743f34375.tar.xz enigma-fork-237b2ed2a6b6f537cdbdf9fc9c6d0c7743f34375.zip | |
fixed call graph searching
added system to navigate multiple tokens for the same entry in a behavior
Diffstat (limited to 'src/cuchaz/enigma/mapping/ConstructorEntry.java')
| -rw-r--r-- | src/cuchaz/enigma/mapping/ConstructorEntry.java | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/src/cuchaz/enigma/mapping/ConstructorEntry.java b/src/cuchaz/enigma/mapping/ConstructorEntry.java index 0f7dab6..ad029e1 100644 --- a/src/cuchaz/enigma/mapping/ConstructorEntry.java +++ b/src/cuchaz/enigma/mapping/ConstructorEntry.java | |||
| @@ -21,16 +21,17 @@ public class ConstructorEntry implements BehaviorEntry, Serializable | |||
| 21 | private ClassEntry m_classEntry; | 21 | private ClassEntry m_classEntry; |
| 22 | private String m_signature; | 22 | private String m_signature; |
| 23 | 23 | ||
| 24 | public ConstructorEntry( ClassEntry classEntry ) | ||
| 25 | { | ||
| 26 | this( classEntry, null ); | ||
| 27 | } | ||
| 28 | |||
| 24 | public ConstructorEntry( ClassEntry classEntry, String signature ) | 29 | public ConstructorEntry( ClassEntry classEntry, String signature ) |
| 25 | { | 30 | { |
| 26 | if( classEntry == null ) | 31 | if( classEntry == null ) |
| 27 | { | 32 | { |
| 28 | throw new IllegalArgumentException( "Class cannot be null!" ); | 33 | throw new IllegalArgumentException( "Class cannot be null!" ); |
| 29 | } | 34 | } |
| 30 | if( signature == null ) | ||
| 31 | { | ||
| 32 | throw new IllegalArgumentException( "Method signature cannot be null!" ); | ||
| 33 | } | ||
| 34 | 35 | ||
| 35 | m_classEntry = classEntry; | 36 | m_classEntry = classEntry; |
| 36 | m_signature = signature; | 37 | m_signature = signature; |
| @@ -47,11 +48,20 @@ public class ConstructorEntry implements BehaviorEntry, Serializable | |||
| 47 | { | 48 | { |
| 48 | return m_classEntry; | 49 | return m_classEntry; |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | @Override | 52 | @Override |
| 52 | public String getName( ) | 53 | public String getName( ) |
| 53 | { | 54 | { |
| 54 | return m_classEntry.getName(); | 55 | if( isStatic() ) |
| 56 | { | ||
| 57 | return "<clinit>"; | ||
| 58 | } | ||
| 59 | return "<init>"; | ||
| 60 | } | ||
| 61 | |||
| 62 | public boolean isStatic( ) | ||
| 63 | { | ||
| 64 | return m_signature == null; | ||
| 55 | } | 65 | } |
| 56 | 66 | ||
| 57 | @Override | 67 | @Override |
| @@ -69,7 +79,14 @@ public class ConstructorEntry implements BehaviorEntry, Serializable | |||
| 69 | @Override | 79 | @Override |
| 70 | public int hashCode( ) | 80 | public int hashCode( ) |
| 71 | { | 81 | { |
| 72 | return Util.combineHashesOrdered( m_classEntry, m_signature ); | 82 | if( isStatic() ) |
| 83 | { | ||
| 84 | return Util.combineHashesOrdered( m_classEntry ); | ||
| 85 | } | ||
| 86 | else | ||
| 87 | { | ||
| 88 | return Util.combineHashesOrdered( m_classEntry, m_signature ); | ||
| 89 | } | ||
| 73 | } | 90 | } |
| 74 | 91 | ||
| 75 | @Override | 92 | @Override |
| @@ -84,12 +101,31 @@ public class ConstructorEntry implements BehaviorEntry, Serializable | |||
| 84 | 101 | ||
| 85 | public boolean equals( ConstructorEntry other ) | 102 | public boolean equals( ConstructorEntry other ) |
| 86 | { | 103 | { |
| 87 | return m_classEntry.equals( other.m_classEntry ) && m_signature.equals( other.m_signature ); | 104 | if( isStatic() != other.isStatic() ) |
| 105 | { | ||
| 106 | return false; | ||
| 107 | } | ||
| 108 | |||
| 109 | if( isStatic() ) | ||
| 110 | { | ||
| 111 | return m_classEntry.equals( other.m_classEntry ); | ||
| 112 | } | ||
| 113 | else | ||
| 114 | { | ||
| 115 | return m_classEntry.equals( other.m_classEntry ) && m_signature.equals( other.m_signature ); | ||
| 116 | } | ||
| 88 | } | 117 | } |
| 89 | 118 | ||
| 90 | @Override | 119 | @Override |
| 91 | public String toString( ) | 120 | public String toString( ) |
| 92 | { | 121 | { |
| 93 | return m_classEntry.getName() + m_signature; | 122 | if( isStatic() ) |
| 123 | { | ||
| 124 | return m_classEntry.getName() + "." + getName(); | ||
| 125 | } | ||
| 126 | else | ||
| 127 | { | ||
| 128 | return m_classEntry.getName() + "." + getName() + m_signature; | ||
| 129 | } | ||
| 94 | } | 130 | } |
| 95 | } | 131 | } |