diff options
| author | 2016-07-02 21:57:31 +1000 | |
|---|---|---|
| committer | 2016-07-02 21:57:31 +1000 | |
| commit | 1742190f784d0d62e7cc869eebafdfe1927e448f (patch) | |
| tree | e5855ecfc0e3129ef34f6f5ee56a937c35700ef9 /src/main/java/cuchaz/enigma/convert/MappingsConverter.java | |
| parent | Reformatting code (diff) | |
| download | enigma-fork-1742190f784d0d62e7cc869eebafdfe1927e448f.tar.gz enigma-fork-1742190f784d0d62e7cc869eebafdfe1927e448f.tar.xz enigma-fork-1742190f784d0d62e7cc869eebafdfe1927e448f.zip | |
Removed unused methods
Diffstat (limited to 'src/main/java/cuchaz/enigma/convert/MappingsConverter.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/convert/MappingsConverter.java | 35 |
1 files changed, 0 insertions, 35 deletions
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 | ||