From 6e464ea251cab63c776ece0b2a356f1498ffa294 Mon Sep 17 00:00:00 2001 From: Thog Date: Wed, 8 Mar 2017 08:17:04 +0100 Subject: Follow Fabric guidelines --- .../cuchaz/enigma/mapping/LocalVariableEntry.java | 186 ++++++++++----------- 1 file changed, 92 insertions(+), 94 deletions(-) (limited to 'src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java') diff --git a/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java b/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java index 8bbaaaf..2bb5e3f 100644 --- a/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/LocalVariableEntry.java @@ -7,98 +7,96 @@ import cuchaz.enigma.utils.Utils; * Created by Thog * 19/10/2016 */ -public class LocalVariableEntry implements Entry -{ - - protected final BehaviorEntry behaviorEntry; - protected final String name; - protected final Type type; - protected final int index; - - public LocalVariableEntry(BehaviorEntry behaviorEntry, int index, String name, Type type) { - if (behaviorEntry == null) { - throw new IllegalArgumentException("Behavior cannot be null!"); - } - if (index < 0) { - throw new IllegalArgumentException("Index must be non-negative!"); - } - if (name == null) { - throw new IllegalArgumentException("Variable name cannot be null!"); - } - if (type == null) { - throw new IllegalArgumentException("Variable type cannot be null!"); - } - - this.behaviorEntry = behaviorEntry; - this.name = name; - this.type = type; - this.index = index; - } - - - public LocalVariableEntry(LocalVariableEntry other, ClassEntry newClassEntry) { - this.behaviorEntry = (BehaviorEntry) other.behaviorEntry.cloneToNewClass(newClassEntry); - this.name = other.name; - this.type = other.type; - this.index = other.index; - } - - public BehaviorEntry getBehaviorEntry() { - return this.behaviorEntry; - } - - public Type getType() { - return type; - } - - public int getIndex() { - return index; - } - - @Override - public String getName() { - return this.name; - } - - @Override - public ClassEntry getClassEntry() { - return this.behaviorEntry.getClassEntry(); - } - - @Override - public String getClassName() { - return this.behaviorEntry.getClassName(); - } - - @Override - public LocalVariableEntry cloneToNewClass(ClassEntry classEntry) { - return new LocalVariableEntry(this, classEntry); - } - - public String getMethodName() { - return this.behaviorEntry.getName(); - } - - public Signature getMethodSignature() { - return this.behaviorEntry.getSignature(); - } - - @Override - public int hashCode() { - return Utils.combineHashesOrdered(this.behaviorEntry, this.type.hashCode(), this.name.hashCode(), Integer.hashCode(this.index)); - } - - @Override - public boolean equals(Object other) { - return other instanceof LocalVariableEntry && equals((LocalVariableEntry) other); - } - - public boolean equals(LocalVariableEntry other) { - return this.behaviorEntry.equals(other.behaviorEntry) && this.type.equals(other.type) && this.name.equals(other.name) && this.index == other.index; - } - - @Override - public String toString() { - return this.behaviorEntry.toString() + "(" + this.index + ":" + this.name + ":" + this.type + ")"; - } +public class LocalVariableEntry implements Entry { + + protected final BehaviorEntry behaviorEntry; + protected final String name; + protected final Type type; + protected final int index; + + public LocalVariableEntry(BehaviorEntry behaviorEntry, int index, String name, Type type) { + if (behaviorEntry == null) { + throw new IllegalArgumentException("Behavior cannot be null!"); + } + if (index < 0) { + throw new IllegalArgumentException("Index must be non-negative!"); + } + if (name == null) { + throw new IllegalArgumentException("Variable name cannot be null!"); + } + if (type == null) { + throw new IllegalArgumentException("Variable type cannot be null!"); + } + + this.behaviorEntry = behaviorEntry; + this.name = name; + this.type = type; + this.index = index; + } + + public LocalVariableEntry(LocalVariableEntry other, ClassEntry newClassEntry) { + this.behaviorEntry = (BehaviorEntry) other.behaviorEntry.cloneToNewClass(newClassEntry); + this.name = other.name; + this.type = other.type; + this.index = other.index; + } + + public BehaviorEntry getBehaviorEntry() { + return this.behaviorEntry; + } + + public Type getType() { + return type; + } + + public int getIndex() { + return index; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public ClassEntry getClassEntry() { + return this.behaviorEntry.getClassEntry(); + } + + @Override + public String getClassName() { + return this.behaviorEntry.getClassName(); + } + + @Override + public LocalVariableEntry cloneToNewClass(ClassEntry classEntry) { + return new LocalVariableEntry(this, classEntry); + } + + public String getMethodName() { + return this.behaviorEntry.getName(); + } + + public Signature getMethodSignature() { + return this.behaviorEntry.getSignature(); + } + + @Override + public int hashCode() { + return Utils.combineHashesOrdered(this.behaviorEntry, this.type.hashCode(), this.name.hashCode(), Integer.hashCode(this.index)); + } + + @Override + public boolean equals(Object other) { + return other instanceof LocalVariableEntry && equals((LocalVariableEntry) other); + } + + public boolean equals(LocalVariableEntry other) { + return this.behaviorEntry.equals(other.behaviorEntry) && this.type.equals(other.type) && this.name.equals(other.name) && this.index == other.index; + } + + @Override + public String toString() { + return this.behaviorEntry + "(" + this.index + ":" + this.name + ":" + this.type + ")"; + } } -- cgit v1.2.3