hashCode and equals

This commit is contained in:
2015-07-12 18:14:26 +02:00
parent 904d1f64f1
commit 9a0a54bebb
24 changed files with 160 additions and 128 deletions
@@ -24,9 +24,9 @@ import java.util.Objects;
*/
public class ClassPath {
public String packageStr;
public final String packageStr;
public String className;
public final String className;
public ClassPath(String packageStr, String className) {
this.packageStr = packageStr;
@@ -41,8 +41,8 @@ public class ClassPath {
@Override
public int hashCode() {
int hash = 7;
hash = 37 * hash + Objects.hashCode(this.packageStr);
hash = 37 * hash + Objects.hashCode(this.className);
hash = 37 * hash + Objects.hashCode(packageStr);
hash = 37 * hash + Objects.hashCode(className);
return hash;
}
@@ -55,9 +55,9 @@ public class ClassPath {
return false;
}
final ClassPath other = (ClassPath) obj;
if (!Objects.equals(this.packageStr, other.packageStr)) {
if (!Objects.equals(packageStr, other.packageStr)) {
return false;
}
return Objects.equals(this.className, other.className);
return Objects.equals(className, other.className);
}
}
@@ -224,9 +224,9 @@ public class ScriptPack extends AS3ClassTreeItem {
@Override
public int hashCode() {
int hash = 7;
hash = 79 * hash + Objects.hashCode(this.abc);
hash = 79 * hash + this.scriptIndex;
hash = 79 * hash + Objects.hashCode(this.path);
hash = 79 * hash + Objects.hashCode(abc);
hash = 79 * hash + scriptIndex;
hash = 79 * hash + Objects.hashCode(path);
return hash;
}
@@ -239,13 +239,13 @@ public class ScriptPack extends AS3ClassTreeItem {
return false;
}
final ScriptPack other = (ScriptPack) obj;
if (!Objects.equals(this.abc, other.abc)) {
if (!Objects.equals(abc, other.abc)) {
return false;
}
if (this.scriptIndex != other.scriptIndex) {
if (scriptIndex != other.scriptIndex) {
return false;
}
if (!Objects.equals(this.path, other.path)) {
if (!Objects.equals(path, other.path)) {
return false;
}
return true;
@@ -298,6 +298,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -1767,9 +1768,9 @@ public class AVM2Code implements Cloneable {
private class Slot {
public GraphTargetItem scope;
public final GraphTargetItem scope;
public Multiname multiname;
public final Multiname multiname;
public Slot(GraphTargetItem scope, Multiname multiname) {
this.scope = scope;
@@ -1779,8 +1780,9 @@ public class AVM2Code implements Cloneable {
@Override
public boolean equals(Object obj) {
if (obj instanceof Slot) {
return (((Slot) obj).scope.getThroughRegister() == scope.getThroughRegister())
&& (((Slot) obj).multiname == multiname);
Slot slot = (Slot) obj;
return (slot.scope.getThroughRegister() == scope.getThroughRegister())
&& (slot.multiname == multiname);
}
return false;
}
@@ -1788,8 +1790,8 @@ public class AVM2Code implements Cloneable {
@Override
public int hashCode() {
int hash = 7;
hash = 59 * hash + (this.scope != null ? this.scope.hashCode() : 0);
hash = 59 * hash + (this.multiname != null ? this.multiname.hashCode() : 0);
hash = 59 * hash + (scope != null ? Objects.hashCode(scope.getThroughRegister()) : 0);
hash = 59 * hash + Objects.hashCode(multiname);
return hash;
}
}
@@ -36,7 +36,7 @@ import java.util.Set;
public class LocalRegAVM2Item extends AVM2Item {
public int regIndex;
public final int regIndex;
public GraphTargetItem computedValue;
@@ -53,17 +53,17 @@ public class Multiname {
private static final String[] multinameKindNames = new String[]{"Qname", "QnameA", "Multiname", "MultinameA", "RTQname", "RTQnameA", "MultinameL", "RTQnameL", "RTQnameLA", "MultinameLA", "TypeName"};
public int kind = -1;
public final int kind;
public int name_index = 0;
public int name_index;
public int namespace_index = 0;
public final int namespace_index;
public int namespace_set_index = 0;
public final int namespace_set_index;
public int qname_index = 0; //for TypeName
public final int qname_index; //for TypeName
public List<Integer> params; //for TypeName
public final List<Integer> params; //for TypeName
@Internal
public boolean deleted;
@@ -79,6 +79,11 @@ public class Multiname {
}
public Multiname() {
kind = -1;
namespace_index = 0;
namespace_set_index = 0;
qname_index = 0;
params = null;
}
public Multiname(int kind, int name_index, int namespace_index, int namespace_set_index, int qname_index, List<Integer> params) {
@@ -335,12 +340,12 @@ public class Multiname {
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + this.kind;
hash = 53 * hash + this.name_index;
hash = 53 * hash + this.namespace_index;
hash = 53 * hash + this.namespace_set_index;
hash = 53 * hash + this.qname_index;
hash = 53 * hash + Objects.hashCode(this.params);
hash = 53 * hash + kind;
hash = 53 * hash + name_index;
hash = 53 * hash + namespace_index;
hash = 53 * hash + namespace_set_index;
hash = 53 * hash + qname_index;
hash = 53 * hash + Objects.hashCode(params);
return hash;
}
@@ -368,7 +373,7 @@ public class Multiname {
if (this.qname_index != other.qname_index) {
return false;
}
if (!Objects.equals(this.params, other.params)) {
if (!Objects.equals(params, other.params)) {
return false;
}
return true;