diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/convert')
4 files changed, 0 insertions, 61 deletions
diff --git a/src/main/java/cuchaz/enigma/convert/ClassForest.java b/src/main/java/cuchaz/enigma/convert/ClassForest.java index b08d48f..c9b44b3 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassForest.java +++ b/src/main/java/cuchaz/enigma/convert/ClassForest.java | |||
| @@ -28,12 +28,6 @@ public class ClassForest { | |||
| 28 | this.forest = HashMultimap.create(); | 28 | this.forest = HashMultimap.create(); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | public void addAll(Iterable<ClassEntry> entries) { | ||
| 32 | for (ClassEntry entry : entries) { | ||
| 33 | add(entry); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | public void add(ClassEntry entry) { | 31 | public void add(ClassEntry entry) { |
| 38 | try { | 32 | try { |
| 39 | this.forest.put(this.identifier.identify(entry), entry); | 33 | this.forest.put(this.identifier.identify(entry), entry); |
diff --git a/src/main/java/cuchaz/enigma/convert/ClassMatches.java b/src/main/java/cuchaz/enigma/convert/ClassMatches.java index 0b7e803..851c082 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassMatches.java +++ b/src/main/java/cuchaz/enigma/convert/ClassMatches.java | |||
| @@ -121,18 +121,10 @@ public class ClassMatches implements Iterable<ClassMatch> { | |||
| 121 | return m_ambiguousMatchesBySource.keySet(); | 121 | return m_ambiguousMatchesBySource.keySet(); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | public ClassMatch getAmbiguousMatchBySource(ClassEntry sourceClass) { | ||
| 125 | return m_ambiguousMatchesBySource.get(sourceClass); | ||
| 126 | } | ||
| 127 | |||
| 128 | public ClassMatch getMatchBySource(ClassEntry sourceClass) { | 124 | public ClassMatch getMatchBySource(ClassEntry sourceClass) { |
| 129 | return m_matchesBySource.get(sourceClass); | 125 | return m_matchesBySource.get(sourceClass); |
| 130 | } | 126 | } |
| 131 | 127 | ||
| 132 | public ClassMatch getMatchByDest(ClassEntry destClass) { | ||
| 133 | return m_matchesByDest.get(destClass); | ||
| 134 | } | ||
| 135 | |||
| 136 | public void removeSource(ClassEntry sourceClass) { | 128 | public void removeSource(ClassEntry sourceClass) { |
| 137 | ClassMatch match = m_matchesBySource.get(sourceClass); | 129 | ClassMatch match = m_matchesBySource.get(sourceClass); |
| 138 | if (match != null) { | 130 | if (match != null) { |
diff --git a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java index d1daadb..7739adf 100644 --- a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java +++ b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java | |||
| @@ -236,41 +236,6 @@ public class MappingsConverter { | |||
| 236 | return classMatches.getUniqueMatches().containsKey(classEntry); | 236 | return classMatches.getUniqueMatches().containsKey(classEntry); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | public static void convertMappings(Mappings mappings, BiMap<ClassEntry, ClassEntry> changes) { | ||
| 240 | |||
| 241 | // sort the changes so classes are renamed in the correct order | ||
| 242 | // ie. if we have the mappings a->b, b->c, we have to apply b->c before a->b | ||
| 243 | LinkedHashMap<ClassEntry, ClassEntry> sortedChanges = Maps.newLinkedHashMap(); | ||
| 244 | int numChangesLeft = changes.size(); | ||
| 245 | while (!changes.isEmpty()) { | ||
| 246 | Iterator<Map.Entry<ClassEntry, ClassEntry>> iter = changes.entrySet().iterator(); | ||
| 247 | while (iter.hasNext()) { | ||
| 248 | Map.Entry<ClassEntry, ClassEntry> change = iter.next(); | ||
| 249 | if (changes.containsKey(change.getValue())) { | ||
| 250 | sortedChanges.put(change.getKey(), change.getValue()); | ||
| 251 | iter.remove(); | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | // did we remove any changes? | ||
| 256 | if (numChangesLeft - changes.size() > 0) { | ||
| 257 | // keep going | ||
| 258 | numChangesLeft = changes.size(); | ||
| 259 | } else { | ||
| 260 | // can't sort anymore. There must be a loop | ||
| 261 | break; | ||
| 262 | } | ||
| 263 | } | ||
| 264 | if (!changes.isEmpty()) { | ||
| 265 | throw new Error("Unable to sort class changes! There must be a cycle."); | ||
| 266 | } | ||
| 267 | |||
| 268 | // convert the mappings in the correct class order | ||
| 269 | for (Map.Entry<ClassEntry, ClassEntry> entry : sortedChanges.entrySet()) { | ||
| 270 | mappings.renameObfClass(entry.getKey().getName(), entry.getValue().getName()); | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | public interface Doer<T extends Entry> { | 239 | public interface Doer<T extends Entry> { |
| 275 | Collection<T> getDroppedEntries(MappingsChecker checker); | 240 | Collection<T> getDroppedEntries(MappingsChecker checker); |
| 276 | 241 | ||
diff --git a/src/main/java/cuchaz/enigma/convert/MemberMatches.java b/src/main/java/cuchaz/enigma/convert/MemberMatches.java index 32850cc..662c1db 100644 --- a/src/main/java/cuchaz/enigma/convert/MemberMatches.java +++ b/src/main/java/cuchaz/enigma/convert/MemberMatches.java | |||
| @@ -47,23 +47,11 @@ public class MemberMatches<T extends Entry> { | |||
| 47 | assert (wasAdded); | 47 | assert (wasAdded); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | public void addUnmatchedSourceEntries(Iterable<T> sourceEntries) { | ||
| 51 | for (T sourceEntry : sourceEntries) { | ||
| 52 | addUnmatchedSourceEntry(sourceEntry); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | public void addUnmatchedDestEntry(T destEntry) { | 50 | public void addUnmatchedDestEntry(T destEntry) { |
| 57 | boolean wasAdded = m_unmatchedDestEntries.put(destEntry.getClassEntry(), destEntry); | 51 | boolean wasAdded = m_unmatchedDestEntries.put(destEntry.getClassEntry(), destEntry); |
| 58 | assert (wasAdded); | 52 | assert (wasAdded); |
| 59 | } | 53 | } |
| 60 | 54 | ||
| 61 | public void addUnmatchedDestEntries(Iterable<T> destEntriesntries) { | ||
| 62 | for (T entry : destEntriesntries) { | ||
| 63 | addUnmatchedDestEntry(entry); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | public void addUnmatchableSourceEntry(T sourceEntry) { | 55 | public void addUnmatchableSourceEntry(T sourceEntry) { |
| 68 | boolean wasAdded = m_unmatchableSourceEntries.put(sourceEntry.getClassEntry(), sourceEntry); | 56 | boolean wasAdded = m_unmatchableSourceEntries.put(sourceEntry.getClassEntry(), sourceEntry); |
| 69 | assert (wasAdded); | 57 | assert (wasAdded); |