From 6e464ea251cab63c776ece0b2a356f1498ffa294 Mon Sep 17 00:00:00 2001 From: Thog Date: Wed, 8 Mar 2017 08:17:04 +0100 Subject: Follow Fabric guidelines --- src/main/java/cuchaz/enigma/mapping/Signature.java | 154 ++++++++++----------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'src/main/java/cuchaz/enigma/mapping/Signature.java') diff --git a/src/main/java/cuchaz/enigma/mapping/Signature.java b/src/main/java/cuchaz/enigma/mapping/Signature.java index f30b606..78130d6 100644 --- a/src/main/java/cuchaz/enigma/mapping/Signature.java +++ b/src/main/java/cuchaz/enigma/mapping/Signature.java @@ -8,99 +8,99 @@ * Contributors: * Jeff Martin - initial API and implementation ******************************************************************************/ + package cuchaz.enigma.mapping; import com.google.common.collect.Lists; +import cuchaz.enigma.utils.Utils; import java.util.List; -import cuchaz.enigma.utils.Utils; - public class Signature { - private List argumentTypes; - private Type returnType; + private List argumentTypes; + private Type returnType; - public Signature(String signature) { - try { - this.argumentTypes = Lists.newArrayList(); - int i = 0; - while (i < signature.length()) { - char c = signature.charAt(i); - if (c == '(') { - assert (this.argumentTypes.isEmpty()); - assert (this.returnType == null); - i++; - } else if (c == ')') { - i++; - break; - } else { - String type = Type.parseFirst(signature.substring(i)); - this.argumentTypes.add(new Type(type)); - i += type.length(); - } - } - this.returnType = new Type(Type.parseFirst(signature.substring(i))); - } catch (Exception ex) { - throw new IllegalArgumentException("Unable to parse signature: " + signature, ex); - } - } + public Signature(String signature) { + try { + this.argumentTypes = Lists.newArrayList(); + int i = 0; + while (i < signature.length()) { + char c = signature.charAt(i); + if (c == '(') { + assert (this.argumentTypes.isEmpty()); + assert (this.returnType == null); + i++; + } else if (c == ')') { + i++; + break; + } else { + String type = Type.parseFirst(signature.substring(i)); + this.argumentTypes.add(new Type(type)); + i += type.length(); + } + } + this.returnType = new Type(Type.parseFirst(signature.substring(i))); + } catch (Exception ex) { + throw new IllegalArgumentException("Unable to parse signature: " + signature, ex); + } + } - public Signature(Signature other, ClassNameReplacer replacer) { - this.argumentTypes = Lists.newArrayList(other.argumentTypes); - for (int i = 0; i < this.argumentTypes.size(); i++) { - this.argumentTypes.set(i, new Type(this.argumentTypes.get(i), replacer)); - } - this.returnType = new Type(other.returnType, replacer); - } + public Signature(Signature other, ClassNameReplacer replacer) { + this.argumentTypes = Lists.newArrayList(other.argumentTypes); + for (int i = 0; i < this.argumentTypes.size(); i++) { + this.argumentTypes.set(i, new Type(this.argumentTypes.get(i), replacer)); + } + this.returnType = new Type(other.returnType, replacer); + } - public List getArgumentTypes() { - return this.argumentTypes; - } + public List getArgumentTypes() { + return this.argumentTypes; + } - public Type getReturnType() { - return this.returnType; - } + public Type getReturnType() { + return this.returnType; + } - @Override - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append("("); - for (Type type : this.argumentTypes) { - buf.append(type.toString()); - } - buf.append(")"); - buf.append(this.returnType.toString()); - return buf.toString(); - } + @Override + public String toString() { + StringBuilder buf = new StringBuilder(); + buf.append("("); + for (Type type : this.argumentTypes) { + buf.append(type); + } + buf.append(")"); + buf.append(this.returnType); + return buf.toString(); + } - public Iterable types() { - List types = Lists.newArrayList(); - types.addAll(this.argumentTypes); - types.add(this.returnType); - return types; - } + public Iterable types() { + List types = Lists.newArrayList(); + types.addAll(this.argumentTypes); + types.add(this.returnType); + return types; + } - @Override - public boolean equals(Object other) { - return other instanceof Signature && equals((Signature) other); - } + @Override + public boolean equals(Object other) { + return other instanceof Signature && equals((Signature) other); + } - public boolean equals(Signature other) { - return this.argumentTypes.equals(other.argumentTypes) && this.returnType.equals(other.returnType); - } + public boolean equals(Signature other) { + return this.argumentTypes.equals(other.argumentTypes) && this.returnType.equals(other.returnType); + } - @Override - public int hashCode() { - return Utils.combineHashesOrdered(this.argumentTypes.hashCode(), this.returnType.hashCode()); - } + @Override + public int hashCode() { + return Utils.combineHashesOrdered(this.argumentTypes.hashCode(), this.returnType.hashCode()); + } - public boolean hasClass(ClassEntry classEntry) { - for (Type type : types()) { - if (type.hasClass() && type.getClassEntry().equals(classEntry)) { - return true; - } - } - return false; - } + public boolean hasClass(ClassEntry classEntry) { + for (Type type : types()) { + if (type.hasClass() && type.getClassEntry().equals(classEntry)) { + return true; + } + } + return false; + } } -- cgit v1.2.3