From 959cb5fd4f9586ec3bd265b452fe25fe1db82e3f Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 13 Jan 2015 23:25:04 -0500 Subject: source format change don't hate me too much if you were planning a big merge. =P --- src/cuchaz/enigma/analysis/EntryReference.java | 94 ++++++++++---------------- 1 file changed, 35 insertions(+), 59 deletions(-) (limited to 'src/cuchaz/enigma/analysis/EntryReference.java') diff --git a/src/cuchaz/enigma/analysis/EntryReference.java b/src/cuchaz/enigma/analysis/EntryReference.java index 0cde875..bb611df 100644 --- a/src/cuchaz/enigma/analysis/EntryReference.java +++ b/src/cuchaz/enigma/analysis/EntryReference.java @@ -18,74 +18,61 @@ import cuchaz.enigma.mapping.ClassEntry; import cuchaz.enigma.mapping.ConstructorEntry; import cuchaz.enigma.mapping.Entry; -public class EntryReference -{ - private static final List ConstructorNonNames = Arrays.asList( "this", "super", "static" ); +public class EntryReference { + + private static final List ConstructorNonNames = Arrays.asList("this", "super", "static"); public E entry; public C context; private boolean m_isNamed; - public EntryReference( E entry, String sourceName ) - { - this( entry, sourceName, null ); + public EntryReference(E entry, String sourceName) { + this(entry, sourceName, null); } - public EntryReference( E entry, String sourceName, C context ) - { - if( entry == null ) - { - throw new IllegalArgumentException( "Entry cannot be null!" ); + public EntryReference(E entry, String sourceName, C context) { + if (entry == null) { + throw new IllegalArgumentException("Entry cannot be null!"); } this.entry = entry; this.context = context; m_isNamed = sourceName != null && sourceName.length() > 0; - if( entry instanceof ConstructorEntry && ConstructorNonNames.contains( sourceName ) ) - { + if (entry instanceof ConstructorEntry && ConstructorNonNames.contains(sourceName)) { m_isNamed = false; } } - public EntryReference( E entry, C context, EntryReference other ) - { + public EntryReference(E entry, C context, EntryReference other) { this.entry = entry; this.context = context; m_isNamed = other.m_isNamed; } - public ClassEntry getLocationClassEntry( ) - { - if( context != null ) - { + public ClassEntry getLocationClassEntry() { + if (context != null) { return context.getClassEntry(); } return entry.getClassEntry(); } - public boolean isNamed( ) - { + public boolean isNamed() { return m_isNamed; } - public Entry getNameableEntry( ) - { - if( entry instanceof ConstructorEntry ) - { + public Entry getNameableEntry() { + if (entry instanceof ConstructorEntry) { // renaming a constructor really means renaming the class return entry.getClassEntry(); } return entry; } - public String getNamableName( ) - { - if( getNameableEntry() instanceof ClassEntry ) - { + public String getNamableName() { + if (getNameableEntry() instanceof ClassEntry) { ClassEntry classEntry = (ClassEntry)getNameableEntry(); - if( classEntry.isInnerClass() ) - { + if (classEntry.isInnerClass()) { // make sure we only rename the inner class name return classEntry.getInnerClassName(); } @@ -95,55 +82,44 @@ public class EntryReference } @Override - public int hashCode( ) - { - if( context != null ) - { - return Util.combineHashesOrdered( entry.hashCode(), context.hashCode() ); + public int hashCode() { + if (context != null) { + return Util.combineHashesOrdered(entry.hashCode(), context.hashCode()); } return entry.hashCode(); } @Override - public boolean equals( Object other ) - { - if( other instanceof EntryReference ) - { - return equals( (EntryReference)other ); + public boolean equals(Object other) { + if (other instanceof EntryReference) { + return equals((EntryReference)other); } return false; } - public boolean equals( EntryReference other ) - { + public boolean equals(EntryReference other) { // check entry first - boolean isEntrySame = entry.equals( other.entry ); - if( !isEntrySame ) - { + boolean isEntrySame = entry.equals(other.entry); + if (!isEntrySame) { return false; } // check caller - if( context == null && other.context == null ) - { + if (context == null && other.context == null) { return true; - } - else if( context != null && other.context != null ) - { - return context.equals( other.context ); + } else if (context != null && other.context != null) { + return context.equals(other.context); } return false; } @Override - public String toString( ) - { + public String toString() { StringBuilder buf = new StringBuilder(); - buf.append( entry ); - if( context != null ) - { - buf.append( " called from " ); - buf.append( context ); + buf.append(entry); + if (context != null) { + buf.append(" called from "); + buf.append(context); } return buf.toString(); } -- cgit v1.2.3