diff options
Diffstat (limited to 'src/cuchaz/enigma/convert/ClassIdentity.java')
| -rw-r--r-- | src/cuchaz/enigma/convert/ClassIdentity.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cuchaz/enigma/convert/ClassIdentity.java b/src/cuchaz/enigma/convert/ClassIdentity.java index 3736a53..d07e0a4 100644 --- a/src/cuchaz/enigma/convert/ClassIdentity.java +++ b/src/cuchaz/enigma/convert/ClassIdentity.java | |||
| @@ -69,6 +69,7 @@ public class ClassIdentity { | |||
| 69 | private Multiset<String> m_implements; | 69 | private Multiset<String> m_implements; |
| 70 | private Multiset<String> m_implementations; | 70 | private Multiset<String> m_implementations; |
| 71 | private Multiset<String> m_references; | 71 | private Multiset<String> m_references; |
| 72 | private String m_outer; | ||
| 72 | 73 | ||
| 73 | private final ClassNameReplacer m_classNameReplacer = new ClassNameReplacer() { | 74 | private final ClassNameReplacer m_classNameReplacer = new ClassNameReplacer() { |
| 74 | 75 | ||
| @@ -167,6 +168,8 @@ public class ClassIdentity { | |||
| 167 | } | 168 | } |
| 168 | } | 169 | } |
| 169 | } | 170 | } |
| 171 | |||
| 172 | m_outer = EntryFactory.getClassEntry(c).getOuterClassName(); | ||
| 170 | } | 173 | } |
| 171 | 174 | ||
| 172 | private void addReference(EntryReference<? extends Entry,BehaviorEntry> reference) { | 175 | private void addReference(EntryReference<? extends Entry,BehaviorEntry> reference) { |
| @@ -234,6 +237,9 @@ public class ClassIdentity { | |||
| 234 | buf.append(reference); | 237 | buf.append(reference); |
| 235 | buf.append("\n"); | 238 | buf.append("\n"); |
| 236 | } | 239 | } |
| 240 | buf.append("\touter "); | ||
| 241 | buf.append(m_outer); | ||
| 242 | buf.append("\n"); | ||
| 237 | return buf.toString(); | 243 | return buf.toString(); |
| 238 | } | 244 | } |
| 239 | 245 | ||
| @@ -402,13 +408,15 @@ public class ClassIdentity { | |||
| 402 | } | 408 | } |
| 403 | 409 | ||
| 404 | public int getMatchScore(ClassIdentity other) { | 410 | public int getMatchScore(ClassIdentity other) { |
| 405 | return getNumMatches(m_fields, other.m_fields) | 411 | return 2*getNumMatches(m_extends, other.m_extends) |
| 412 | + 2*getNumMatches(m_outer, other.m_outer) | ||
| 413 | + getNumMatches(m_fields, other.m_fields) | ||
| 406 | + getNumMatches(m_methods, other.m_methods) | 414 | + getNumMatches(m_methods, other.m_methods) |
| 407 | + getNumMatches(m_constructors, other.m_constructors); | 415 | + getNumMatches(m_constructors, other.m_constructors); |
| 408 | } | 416 | } |
| 409 | 417 | ||
| 410 | public int getMaxMatchScore() { | 418 | public int getMaxMatchScore() { |
| 411 | return m_fields.size() + m_methods.size() + m_constructors.size(); | 419 | return 2 + 2 + m_fields.size() + m_methods.size() + m_constructors.size(); |
| 412 | } | 420 | } |
| 413 | 421 | ||
| 414 | public boolean matches(CtClass c) { | 422 | public boolean matches(CtClass c) { |
| @@ -427,4 +435,11 @@ public class ClassIdentity { | |||
| 427 | } | 435 | } |
| 428 | return numMatches; | 436 | return numMatches; |
| 429 | } | 437 | } |
| 438 | |||
| 439 | private int getNumMatches(String a, String b) { | ||
| 440 | if (a.equals(b)) { | ||
| 441 | return 1; | ||
| 442 | } | ||
| 443 | return 0; | ||
| 444 | } | ||
| 430 | } | 445 | } |