diff options
Diffstat (limited to 'src/cuchaz/enigma/convert/Matches.java')
| -rw-r--r-- | src/cuchaz/enigma/convert/Matches.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/convert/Matches.java b/src/cuchaz/enigma/convert/Matches.java index 75ecc2a..5faa923 100644 --- a/src/cuchaz/enigma/convert/Matches.java +++ b/src/cuchaz/enigma/convert/Matches.java | |||
| @@ -17,6 +17,8 @@ import cuchaz.enigma.mapping.ClassEntry; | |||
| 17 | public class Matches implements Iterable<ClassMatch> { | 17 | public class Matches implements Iterable<ClassMatch> { |
| 18 | 18 | ||
| 19 | Collection<ClassMatch> m_matches; | 19 | Collection<ClassMatch> m_matches; |
| 20 | Map<ClassEntry,ClassMatch> m_matchesBySource; | ||
| 21 | Map<ClassEntry,ClassMatch> m_matchesByDest; | ||
| 20 | BiMap<ClassEntry,ClassEntry> m_uniqueMatches; | 22 | BiMap<ClassEntry,ClassEntry> m_uniqueMatches; |
| 21 | Map<ClassEntry,ClassMatch> m_ambiguousMatchesBySource; | 23 | Map<ClassEntry,ClassMatch> m_ambiguousMatchesBySource; |
| 22 | Map<ClassEntry,ClassMatch> m_ambiguousMatchesByDest; | 24 | Map<ClassEntry,ClassMatch> m_ambiguousMatchesByDest; |
| @@ -29,6 +31,8 @@ public class Matches implements Iterable<ClassMatch> { | |||
| 29 | 31 | ||
| 30 | public Matches(Collection<ClassMatch> matches) { | 32 | public Matches(Collection<ClassMatch> matches) { |
| 31 | m_matches = matches; | 33 | m_matches = matches; |
| 34 | m_matchesBySource = Maps.newHashMap(); | ||
| 35 | m_matchesByDest = Maps.newHashMap(); | ||
| 32 | m_uniqueMatches = HashBiMap.create(); | 36 | m_uniqueMatches = HashBiMap.create(); |
| 33 | m_ambiguousMatchesBySource = Maps.newHashMap(); | 37 | m_ambiguousMatchesBySource = Maps.newHashMap(); |
| 34 | m_ambiguousMatchesByDest = Maps.newHashMap(); | 38 | m_ambiguousMatchesByDest = Maps.newHashMap(); |
| @@ -73,6 +77,12 @@ public class Matches implements Iterable<ClassMatch> { | |||
| 73 | m_uniqueMatches.put(match.getUniqueSource(), match.getUniqueDest()); | 77 | m_uniqueMatches.put(match.getUniqueSource(), match.getUniqueDest()); |
| 74 | } | 78 | } |
| 75 | } | 79 | } |
| 80 | for (ClassEntry entry : match.sourceClasses) { | ||
| 81 | m_matchesBySource.put(entry, match); | ||
| 82 | } | ||
| 83 | for (ClassEntry entry : match.destClasses) { | ||
| 84 | m_matchesByDest.put(entry, match); | ||
| 85 | } | ||
| 76 | } | 86 | } |
| 77 | 87 | ||
| 78 | public BiMap<ClassEntry,ClassEntry> getUniqueMatches() { | 88 | public BiMap<ClassEntry,ClassEntry> getUniqueMatches() { |
| @@ -86,4 +96,20 @@ public class Matches implements Iterable<ClassMatch> { | |||
| 86 | public Set<ClassEntry> getUnmatchedDestClasses() { | 96 | public Set<ClassEntry> getUnmatchedDestClasses() { |
| 87 | return m_unmatchedDestClasses; | 97 | return m_unmatchedDestClasses; |
| 88 | } | 98 | } |
| 99 | |||
| 100 | public Set<ClassEntry> getAmbiguouslyMatchedSourceClasses() { | ||
| 101 | return m_ambiguousMatchesBySource.keySet(); | ||
| 102 | } | ||
| 103 | |||
| 104 | public ClassMatch getAmbiguousMatchBySource(ClassEntry sourceClass) { | ||
| 105 | return m_ambiguousMatchesBySource.get(sourceClass); | ||
| 106 | } | ||
| 107 | |||
| 108 | public ClassMatch getMatchBySource(ClassEntry sourceClass) { | ||
| 109 | return m_matchesBySource.get(sourceClass); | ||
| 110 | } | ||
| 111 | |||
| 112 | public ClassMatch getMatchByDest(ClassEntry destClass) { | ||
| 113 | return m_matchesByDest.get(destClass); | ||
| 114 | } | ||
| 89 | } | 115 | } |