From b4aaff683d78ab92b83f3a7257c33b8e27d1affa Mon Sep 17 00:00:00 2001 From: Thog Date: Tue, 7 Mar 2017 21:24:39 +0100 Subject: Drop unix case style and implement hashCode when equals is overrided Also update Guava to version 21 --- .../java/cuchaz/enigma/convert/FieldMatches.java | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'src/main/java/cuchaz/enigma/convert/FieldMatches.java') diff --git a/src/main/java/cuchaz/enigma/convert/FieldMatches.java b/src/main/java/cuchaz/enigma/convert/FieldMatches.java index 0899cd2..236cd4d 100644 --- a/src/main/java/cuchaz/enigma/convert/FieldMatches.java +++ b/src/main/java/cuchaz/enigma/convert/FieldMatches.java @@ -21,29 +21,29 @@ import cuchaz.enigma.mapping.FieldEntry; public class FieldMatches { - private BiMap m_matches; - private Multimap m_matchedSourceFields; - private Multimap m_unmatchedSourceFields; - private Multimap m_unmatchedDestFields; - private Multimap m_unmatchableSourceFields; + private BiMap matches; + private Multimap matchedSourceFields; + private Multimap unmatchedSourceFields; + private Multimap unmatchedDestFields; + private Multimap unmatchableSourceFields; public FieldMatches() { - m_matches = HashBiMap.create(); - m_matchedSourceFields = HashMultimap.create(); - m_unmatchedSourceFields = HashMultimap.create(); - m_unmatchedDestFields = HashMultimap.create(); - m_unmatchableSourceFields = HashMultimap.create(); + matches = HashBiMap.create(); + matchedSourceFields = HashMultimap.create(); + unmatchedSourceFields = HashMultimap.create(); + unmatchedDestFields = HashMultimap.create(); + unmatchableSourceFields = HashMultimap.create(); } public void addMatch(FieldEntry srcField, FieldEntry destField) { - boolean wasAdded = m_matches.put(srcField, destField) == null; + boolean wasAdded = matches.put(srcField, destField) == null; assert (wasAdded); - wasAdded = m_matchedSourceFields.put(srcField.getClassEntry(), srcField); + wasAdded = matchedSourceFields.put(srcField.getClassEntry(), srcField); assert (wasAdded); } public void addUnmatchedSourceField(FieldEntry fieldEntry) { - boolean wasAdded = m_unmatchedSourceFields.put(fieldEntry.getClassEntry(), fieldEntry); + boolean wasAdded = unmatchedSourceFields.put(fieldEntry.getClassEntry(), fieldEntry); assert (wasAdded); } @@ -54,7 +54,7 @@ public class FieldMatches { } public void addUnmatchedDestField(FieldEntry fieldEntry) { - boolean wasAdded = m_unmatchedDestFields.put(fieldEntry.getClassEntry(), fieldEntry); + boolean wasAdded = unmatchedDestFields.put(fieldEntry.getClassEntry(), fieldEntry); assert (wasAdded); } @@ -65,78 +65,78 @@ public class FieldMatches { } public void addUnmatchableSourceField(FieldEntry sourceField) { - boolean wasAdded = m_unmatchableSourceFields.put(sourceField.getClassEntry(), sourceField); + boolean wasAdded = unmatchableSourceFields.put(sourceField.getClassEntry(), sourceField); assert (wasAdded); } public Set getSourceClassesWithUnmatchedFields() { - return m_unmatchedSourceFields.keySet(); + return unmatchedSourceFields.keySet(); } public Collection getSourceClassesWithoutUnmatchedFields() { Set out = Sets.newHashSet(); - out.addAll(m_matchedSourceFields.keySet()); - out.removeAll(m_unmatchedSourceFields.keySet()); + out.addAll(matchedSourceFields.keySet()); + out.removeAll(unmatchedSourceFields.keySet()); return out; } public Collection getUnmatchedSourceFields() { - return m_unmatchedSourceFields.values(); + return unmatchedSourceFields.values(); } public Collection getUnmatchedSourceFields(ClassEntry sourceClass) { - return m_unmatchedSourceFields.get(sourceClass); + return unmatchedSourceFields.get(sourceClass); } public Collection getUnmatchedDestFields() { - return m_unmatchedDestFields.values(); + return unmatchedDestFields.values(); } public Collection getUnmatchedDestFields(ClassEntry destClass) { - return m_unmatchedDestFields.get(destClass); + return unmatchedDestFields.get(destClass); } public Collection getUnmatchableSourceFields() { - return m_unmatchableSourceFields.values(); + return unmatchableSourceFields.values(); } public boolean hasSource(FieldEntry fieldEntry) { - return m_matches.containsKey(fieldEntry) || m_unmatchedSourceFields.containsValue(fieldEntry); + return matches.containsKey(fieldEntry) || unmatchedSourceFields.containsValue(fieldEntry); } public boolean hasDest(FieldEntry fieldEntry) { - return m_matches.containsValue(fieldEntry) || m_unmatchedDestFields.containsValue(fieldEntry); + return matches.containsValue(fieldEntry) || unmatchedDestFields.containsValue(fieldEntry); } public BiMap matches() { - return m_matches; + return matches; } public boolean isMatchedSourceField(FieldEntry sourceField) { - return m_matches.containsKey(sourceField); + return matches.containsKey(sourceField); } public boolean isMatchedDestField(FieldEntry destField) { - return m_matches.containsValue(destField); + return matches.containsValue(destField); } public void makeMatch(FieldEntry sourceField, FieldEntry destField) { - boolean wasRemoved = m_unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); + boolean wasRemoved = unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); assert (wasRemoved); - wasRemoved = m_unmatchedDestFields.remove(destField.getClassEntry(), destField); + wasRemoved = unmatchedDestFields.remove(destField.getClassEntry(), destField); assert (wasRemoved); addMatch(sourceField, destField); } public boolean isMatched(FieldEntry sourceField, FieldEntry destField) { - FieldEntry match = m_matches.get(sourceField); + FieldEntry match = matches.get(sourceField); return match != null && match.equals(destField); } public void unmakeMatch(FieldEntry sourceField, FieldEntry destField) { - boolean wasRemoved = m_matches.remove(sourceField) != null; + boolean wasRemoved = matches.remove(sourceField) != null; assert (wasRemoved); - wasRemoved = m_matchedSourceFields.remove(sourceField.getClassEntry(), sourceField); + wasRemoved = matchedSourceFields.remove(sourceField.getClassEntry(), sourceField); assert (wasRemoved); addUnmatchedSourceField(sourceField); addUnmatchedDestField(destField); @@ -144,7 +144,7 @@ public class FieldMatches { public void makeSourceUnmatchable(FieldEntry sourceField) { assert (!isMatchedSourceField(sourceField)); - boolean wasRemoved = m_unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); + boolean wasRemoved = unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); assert (wasRemoved); addUnmatchableSourceField(sourceField); } -- cgit v1.2.3