From 237b2ed2a6b6f537cdbdf9fc9c6d0c7743f34375 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 21 Aug 2014 01:10:37 -0400 Subject: fixed call graph searching added system to navigate multiple tokens for the same entry in a behavior --- src/cuchaz/enigma/mapping/ConstructorEntry.java | 54 ++++++++++++++++++++----- 1 file changed, 45 insertions(+), 9 deletions(-) (limited to 'src/cuchaz/enigma/mapping/ConstructorEntry.java') 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 private ClassEntry m_classEntry; private String m_signature; + public ConstructorEntry( ClassEntry classEntry ) + { + this( classEntry, null ); + } + public ConstructorEntry( ClassEntry classEntry, String signature ) { if( classEntry == null ) { throw new IllegalArgumentException( "Class cannot be null!" ); } - if( signature == null ) - { - throw new IllegalArgumentException( "Method signature cannot be null!" ); - } m_classEntry = classEntry; m_signature = signature; @@ -47,11 +48,20 @@ public class ConstructorEntry implements BehaviorEntry, Serializable { return m_classEntry; } - + @Override public String getName( ) { - return m_classEntry.getName(); + if( isStatic() ) + { + return ""; + } + return ""; + } + + public boolean isStatic( ) + { + return m_signature == null; } @Override @@ -69,7 +79,14 @@ public class ConstructorEntry implements BehaviorEntry, Serializable @Override public int hashCode( ) { - return Util.combineHashesOrdered( m_classEntry, m_signature ); + if( isStatic() ) + { + return Util.combineHashesOrdered( m_classEntry ); + } + else + { + return Util.combineHashesOrdered( m_classEntry, m_signature ); + } } @Override @@ -84,12 +101,31 @@ public class ConstructorEntry implements BehaviorEntry, Serializable public boolean equals( ConstructorEntry other ) { - return m_classEntry.equals( other.m_classEntry ) && m_signature.equals( other.m_signature ); + if( isStatic() != other.isStatic() ) + { + return false; + } + + if( isStatic() ) + { + return m_classEntry.equals( other.m_classEntry ); + } + else + { + return m_classEntry.equals( other.m_classEntry ) && m_signature.equals( other.m_signature ); + } } @Override public String toString( ) { - return m_classEntry.getName() + m_signature; + if( isStatic() ) + { + return m_classEntry.getName() + "." + getName(); + } + else + { + return m_classEntry.getName() + "." + getName() + m_signature; + } } } -- cgit v1.2.3