diff options
| author | 2017-03-07 21:24:39 +0100 | |
|---|---|---|
| committer | 2017-03-07 21:30:02 +0100 | |
| commit | b4aaff683d78ab92b83f3a7257c33b8e27d1affa (patch) | |
| tree | f23c9bb0927d83cc7302881266b7df8fd37959c7 /src/main/java/cuchaz/enigma/convert/ClassMatching.java | |
| parent | Avoid crash of the matcher when the obf name is invalid (set a deob it using ... (diff) | |
| download | enigma-fork-b4aaff683d78ab92b83f3a7257c33b8e27d1affa.tar.gz enigma-fork-b4aaff683d78ab92b83f3a7257c33b8e27d1affa.tar.xz enigma-fork-b4aaff683d78ab92b83f3a7257c33b8e27d1affa.zip | |
Drop unix case style and implement hashCode when equals is overrided
Also update Guava to version 21
Diffstat (limited to 'src/main/java/cuchaz/enigma/convert/ClassMatching.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/convert/ClassMatching.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/cuchaz/enigma/convert/ClassMatching.java b/src/main/java/cuchaz/enigma/convert/ClassMatching.java index af9ae01..b05df87 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassMatching.java +++ b/src/main/java/cuchaz/enigma/convert/ClassMatching.java | |||
| @@ -25,52 +25,52 @@ import cuchaz.enigma.mapping.ClassEntry; | |||
| 25 | 25 | ||
| 26 | public class ClassMatching { | 26 | public class ClassMatching { |
| 27 | 27 | ||
| 28 | private ClassForest m_sourceClasses; | 28 | private ClassForest sourceClasses; |
| 29 | private ClassForest m_destClasses; | 29 | private ClassForest destClasses; |
| 30 | private BiMap<ClassEntry, ClassEntry> m_knownMatches; | 30 | private BiMap<ClassEntry, ClassEntry> knownMatches; |
| 31 | 31 | ||
| 32 | public ClassMatching(ClassIdentifier sourceIdentifier, ClassIdentifier destIdentifier) { | 32 | public ClassMatching(ClassIdentifier sourceIdentifier, ClassIdentifier destIdentifier) { |
| 33 | m_sourceClasses = new ClassForest(sourceIdentifier); | 33 | sourceClasses = new ClassForest(sourceIdentifier); |
| 34 | m_destClasses = new ClassForest(destIdentifier); | 34 | destClasses = new ClassForest(destIdentifier); |
| 35 | m_knownMatches = HashBiMap.create(); | 35 | knownMatches = HashBiMap.create(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | public void addKnownMatches(BiMap<ClassEntry, ClassEntry> knownMatches) { | 38 | public void addKnownMatches(BiMap<ClassEntry, ClassEntry> knownMatches) { |
| 39 | m_knownMatches.putAll(knownMatches); | 39 | this.knownMatches.putAll(knownMatches); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | public void match(Iterable<ClassEntry> sourceClasses, Iterable<ClassEntry> destClasses) { | 42 | public void match(Iterable<ClassEntry> sourceClasses, Iterable<ClassEntry> destClasses) { |
| 43 | for (ClassEntry sourceClass : sourceClasses) { | 43 | for (ClassEntry sourceClass : sourceClasses) { |
| 44 | if (!m_knownMatches.containsKey(sourceClass)) { | 44 | if (!knownMatches.containsKey(sourceClass)) { |
| 45 | m_sourceClasses.add(sourceClass); | 45 | this.sourceClasses.add(sourceClass); |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | for (ClassEntry destClass : destClasses) { | 48 | for (ClassEntry destClass : destClasses) { |
| 49 | if (!m_knownMatches.containsValue(destClass)) { | 49 | if (!knownMatches.containsValue(destClass)) { |
| 50 | m_destClasses.add(destClass); | 50 | this.destClasses.add(destClass); |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | public Collection<ClassMatch> matches() { | 55 | public Collection<ClassMatch> matches() { |
| 56 | List<ClassMatch> matches = Lists.newArrayList(); | 56 | List<ClassMatch> matches = Lists.newArrayList(); |
| 57 | for (Entry<ClassEntry, ClassEntry> entry : m_knownMatches.entrySet()) { | 57 | for (Entry<ClassEntry, ClassEntry> entry : knownMatches.entrySet()) { |
| 58 | matches.add(new ClassMatch( | 58 | matches.add(new ClassMatch( |
| 59 | entry.getKey(), | 59 | entry.getKey(), |
| 60 | entry.getValue() | 60 | entry.getValue() |
| 61 | )); | 61 | )); |
| 62 | } | 62 | } |
| 63 | for (ClassIdentity identity : m_sourceClasses.identities()) { | 63 | for (ClassIdentity identity : sourceClasses.identities()) { |
| 64 | matches.add(new ClassMatch( | 64 | matches.add(new ClassMatch( |
| 65 | m_sourceClasses.getClasses(identity), | 65 | sourceClasses.getClasses(identity), |
| 66 | m_destClasses.getClasses(identity) | 66 | destClasses.getClasses(identity) |
| 67 | )); | 67 | )); |
| 68 | } | 68 | } |
| 69 | for (ClassIdentity identity : m_destClasses.identities()) { | 69 | for (ClassIdentity identity : destClasses.identities()) { |
| 70 | if (!m_sourceClasses.containsIdentity(identity)) { | 70 | if (!sourceClasses.containsIdentity(identity)) { |
| 71 | matches.add(new ClassMatch( | 71 | matches.add(new ClassMatch( |
| 72 | new ArrayList<>(), | 72 | new ArrayList<>(), |
| 73 | m_destClasses.getClasses(identity) | 73 | destClasses.getClasses(identity) |
| 74 | )); | 74 | )); |
| 75 | } | 75 | } |
| 76 | } | 76 | } |