summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/convert/ClassIdentity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuchaz/enigma/convert/ClassIdentity.java')
-rw-r--r--src/cuchaz/enigma/convert/ClassIdentity.java23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/cuchaz/enigma/convert/ClassIdentity.java b/src/cuchaz/enigma/convert/ClassIdentity.java
index 8de7128..bd2824b 100644
--- a/src/cuchaz/enigma/convert/ClassIdentity.java
+++ b/src/cuchaz/enigma/convert/ClassIdentity.java
@@ -60,7 +60,6 @@ import cuchaz.enigma.mapping.SignatureUpdater.ClassNameUpdater;
60public class ClassIdentity 60public class ClassIdentity
61{ 61{
62 private ClassEntry m_classEntry; 62 private ClassEntry m_classEntry;
63 private String m_rawName;
64 private SidedClassNamer m_namer; 63 private SidedClassNamer m_namer;
65 private Multiset<String> m_fields; 64 private Multiset<String> m_fields;
66 private Multiset<String> m_methods; 65 private Multiset<String> m_methods;
@@ -71,18 +70,13 @@ public class ClassIdentity
71 private Multiset<String> m_implementations; 70 private Multiset<String> m_implementations;
72 private Multiset<String> m_references; 71 private Multiset<String> m_references;
73 72
74 public ClassIdentity( CtClass c, SidedClassNamer namer, JarIndex index, boolean useReferences, boolean useRawNames ) 73 public ClassIdentity( CtClass c, SidedClassNamer namer, JarIndex index, boolean useReferences )
75 { 74 {
76 m_namer = namer; 75 m_namer = namer;
77 76
78 // stuff from the bytecode 77 // stuff from the bytecode
79 78
80 m_classEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) ); 79 m_classEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) );
81 m_rawName = "";
82 if( useRawNames )
83 {
84 m_rawName = m_classEntry.getName();
85 }
86 m_fields = HashMultiset.create(); 80 m_fields = HashMultiset.create();
87 for( CtField field : c.getDeclaredFields() ) 81 for( CtField field : c.getDeclaredFields() )
88 { 82 {
@@ -186,12 +180,6 @@ public class ClassIdentity
186 buf.append( " " ); 180 buf.append( " " );
187 buf.append( hashCode() ); 181 buf.append( hashCode() );
188 buf.append( "\n" ); 182 buf.append( "\n" );
189 if( m_rawName.length() > 0 )
190 {
191 buf.append( "\traw name: " );
192 buf.append( m_rawName );
193 buf.append( "\n" );
194 }
195 for( String field : m_fields ) 183 for( String field : m_fields )
196 { 184 {
197 buf.append( "\tfield " ); 185 buf.append( "\tfield " );
@@ -439,8 +427,7 @@ public class ClassIdentity
439 427
440 public boolean equals( ClassIdentity other ) 428 public boolean equals( ClassIdentity other )
441 { 429 {
442 return m_rawName.equals( other.m_rawName ) 430 return m_fields.equals( other.m_fields )
443 && m_fields.equals( other.m_fields )
444 && m_methods.equals( other.m_methods ) 431 && m_methods.equals( other.m_methods )
445 && m_constructors.equals( other.m_constructors ) 432 && m_constructors.equals( other.m_constructors )
446 && m_staticInitializer.equals( other.m_staticInitializer ) 433 && m_staticInitializer.equals( other.m_staticInitializer )
@@ -454,7 +441,6 @@ public class ClassIdentity
454 public int hashCode( ) 441 public int hashCode( )
455 { 442 {
456 List<Object> objs = Lists.newArrayList(); 443 List<Object> objs = Lists.newArrayList();
457 objs.add( m_rawName );
458 objs.addAll( m_fields ); 444 objs.addAll( m_fields );
459 objs.addAll( m_methods ); 445 objs.addAll( m_methods );
460 objs.addAll( m_constructors ); 446 objs.addAll( m_constructors );
@@ -473,6 +459,11 @@ public class ClassIdentity
473 + getNumMatches( m_constructors, other.m_constructors ); 459 + getNumMatches( m_constructors, other.m_constructors );
474 } 460 }
475 461
462 public int getMaxMatchScore( )
463 {
464 return m_fields.size() + m_methods.size() + m_constructors.size();
465 }
466
476 public boolean matches( CtClass c ) 467 public boolean matches( CtClass c )
477 { 468 {
478 // just compare declaration counts 469 // just compare declaration counts