summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/convert/Matches.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuchaz/enigma/convert/Matches.java')
-rw-r--r--src/cuchaz/enigma/convert/Matches.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/convert/Matches.java b/src/cuchaz/enigma/convert/Matches.java
index 5faa923..0b00b29 100644
--- a/src/cuchaz/enigma/convert/Matches.java
+++ b/src/cuchaz/enigma/convert/Matches.java
@@ -48,6 +48,22 @@ public class Matches implements Iterable<ClassMatch> {
48 m_matches.add(match); 48 m_matches.add(match);
49 indexMatch(match); 49 indexMatch(match);
50 } 50 }
51
52 public void remove(ClassMatch match) {
53 for (ClassEntry sourceClass : match.sourceClasses) {
54 m_matchesBySource.remove(sourceClass);
55 m_uniqueMatches.remove(sourceClass);
56 m_ambiguousMatchesBySource.remove(sourceClass);
57 m_unmatchedSourceClasses.remove(sourceClass);
58 }
59 for (ClassEntry destClass : match.sourceClasses) {
60 m_matchesByDest.remove(destClass);
61 m_uniqueMatches.inverse().remove(destClass);
62 m_ambiguousMatchesByDest.remove(destClass);
63 m_unmatchedDestClasses.remove(destClass);
64 }
65 m_matches.remove(match);
66 }
51 67
52 public int size() { 68 public int size() {
53 return m_matches.size(); 69 return m_matches.size();
@@ -112,4 +128,26 @@ public class Matches implements Iterable<ClassMatch> {
112 public ClassMatch getMatchByDest(ClassEntry destClass) { 128 public ClassMatch getMatchByDest(ClassEntry destClass) {
113 return m_matchesByDest.get(destClass); 129 return m_matchesByDest.get(destClass);
114 } 130 }
131
132 public void removeSource(ClassEntry sourceClass) {
133 ClassMatch match = m_matchesBySource.get(sourceClass);
134 if (match != null) {
135 remove(match);
136 match.sourceClasses.remove(sourceClass);
137 if (!match.sourceClasses.isEmpty() || !match.destClasses.isEmpty()) {
138 add(match);
139 }
140 }
141 }
142
143 public void removeDest(ClassEntry destClass) {
144 ClassMatch match = m_matchesByDest.get(destClass);
145 if (match != null) {
146 remove(match);
147 match.destClasses.remove(destClass);
148 if (!match.sourceClasses.isEmpty() || !match.destClasses.isEmpty()) {
149 add(match);
150 }
151 }
152 }
115} 153}