From 6e464ea251cab63c776ece0b2a356f1498ffa294 Mon Sep 17 00:00:00 2001 From: Thog Date: Wed, 8 Mar 2017 08:17:04 +0100 Subject: Follow Fabric guidelines --- .../java/cuchaz/enigma/convert/ClassNamer.java | 71 +++++++++++----------- 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'src/main/java/cuchaz/enigma/convert/ClassNamer.java') diff --git a/src/main/java/cuchaz/enigma/convert/ClassNamer.java b/src/main/java/cuchaz/enigma/convert/ClassNamer.java index e471c7d..3969910 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassNamer.java +++ b/src/main/java/cuchaz/enigma/convert/ClassNamer.java @@ -8,49 +8,48 @@ * Contributors: * Jeff Martin - initial API and implementation ******************************************************************************/ + package cuchaz.enigma.convert; import com.google.common.collect.BiMap; import com.google.common.collect.Maps; +import cuchaz.enigma.mapping.ClassEntry; import java.util.Map; -import cuchaz.enigma.mapping.ClassEntry; - public class ClassNamer { - public interface SidedClassNamer { - String getName(String name); - } - - private Map sourceNames; - private Map destNames; - - public ClassNamer(BiMap mappings) { - // convert the identity mappings to name maps - this.sourceNames = Maps.newHashMap(); - this.destNames = Maps.newHashMap(); - int i = 0; - for (Map.Entry entry : mappings.entrySet()) { - String name = String.format("M%04d", i++); - this.sourceNames.put(entry.getKey().getName(), name); - this.destNames.put(entry.getValue().getName(), name); - } - } - - public String getSourceName(String name) { - return this.sourceNames.get(name); - } - - public String getDestName(String name) { - return this.destNames.get(name); - } - - public SidedClassNamer getSourceNamer() { - return this::getSourceName; - } - - public SidedClassNamer getDestNamer() { - return this::getDestName; - } + private Map sourceNames; + private Map destNames; + public ClassNamer(BiMap mappings) { + // convert the identity mappings to name maps + this.sourceNames = Maps.newHashMap(); + this.destNames = Maps.newHashMap(); + int i = 0; + for (Map.Entry entry : mappings.entrySet()) { + String name = String.format("M%04d", i++); + this.sourceNames.put(entry.getKey().getName(), name); + this.destNames.put(entry.getValue().getName(), name); + } + } + + public String getSourceName(String name) { + return this.sourceNames.get(name); + } + + public String getDestName(String name) { + return this.destNames.get(name); + } + + public SidedClassNamer getSourceNamer() { + return this::getSourceName; + } + + public SidedClassNamer getDestNamer() { + return this::getDestName; + } + + public interface SidedClassNamer { + String getName(String name); + } } -- cgit v1.2.3