mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-03 09:35:12 +00:00
hashCode and equals
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -27,13 +27,14 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class CallFunctionActionItem extends ActionItem {
|
||||
|
||||
public GraphTargetItem functionName;
|
||||
public final GraphTargetItem functionName;
|
||||
|
||||
public List<GraphTargetItem> arguments;
|
||||
public final List<GraphTargetItem> arguments;
|
||||
|
||||
public GraphTargetItem calculatedFunction;
|
||||
|
||||
@@ -99,8 +100,8 @@ public class CallFunctionActionItem extends ActionItem {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 37 * hash + (this.functionName != null ? this.functionName.hashCode() : 0);
|
||||
hash = 37 * hash + (this.arguments != null ? this.arguments.hashCode() : 0);
|
||||
hash = 37 * hash + Objects.hashCode(functionName);
|
||||
hash = 37 * hash + Objects.hashCode(arguments);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -113,10 +114,10 @@ public class CallFunctionActionItem extends ActionItem {
|
||||
return false;
|
||||
}
|
||||
final CallFunctionActionItem other = (CallFunctionActionItem) obj;
|
||||
if (this.functionName != other.functionName && (this.functionName == null || !this.functionName.equals(other.functionName))) {
|
||||
if (!Objects.equals(functionName, other.functionName)) {
|
||||
return false;
|
||||
}
|
||||
if (this.arguments != other.arguments && (this.arguments == null || !this.arguments.equals(other.arguments))) {
|
||||
if (!Objects.equals(this.arguments, other.arguments)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -39,11 +39,11 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
|
||||
public Object value;
|
||||
|
||||
public List<String> constants;
|
||||
public final List<String> constants;
|
||||
|
||||
public GraphTargetItem computedRegValue;
|
||||
|
||||
public int pos = -1;
|
||||
public final int pos;
|
||||
|
||||
public DirectValueActionItem(Object o) {
|
||||
this(null, 0, o, new ArrayList<>());
|
||||
@@ -204,8 +204,8 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 71 * hash + Objects.hashCode(this.value);
|
||||
hash = 71 * hash + System.identityHashCode(this.constants);
|
||||
hash = 71 * hash + Objects.hashCode(value);
|
||||
hash = 71 * hash + Objects.hashCode(constants);
|
||||
hash = 71 * hash + pos;
|
||||
return hash;
|
||||
}
|
||||
@@ -219,10 +219,10 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
return false;
|
||||
}
|
||||
final DirectValueActionItem other = (DirectValueActionItem) obj;
|
||||
if (!Objects.equals(this.value, other.value)) {
|
||||
if (!Objects.equals(value, other.value)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.constants, other.constants)) {
|
||||
if (!Objects.equals(constants, other.constants)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -28,12 +28,13 @@ import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GetMemberActionItem extends ActionItem {
|
||||
|
||||
public GraphTargetItem object;
|
||||
public final GraphTargetItem object;
|
||||
|
||||
public GraphTargetItem memberName;
|
||||
public final GraphTargetItem memberName;
|
||||
|
||||
@Override
|
||||
public List<GraphTargetItem> getAllSubItems() {
|
||||
@@ -71,8 +72,8 @@ public class GetMemberActionItem extends ActionItem {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 47 * hash + (this.object != null ? this.object.hashCode() : 0);
|
||||
hash = 47 * hash + (this.memberName != null ? this.memberName.hashCode() : 0);
|
||||
hash = 47 * hash + Objects.hashCode(object);
|
||||
hash = 47 * hash + Objects.hashCode(memberName);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -85,10 +86,10 @@ public class GetMemberActionItem extends ActionItem {
|
||||
return false;
|
||||
}
|
||||
final GetMemberActionItem other = (GetMemberActionItem) obj;
|
||||
if (this.object != other.object && (this.object == null || !this.object.equals(other.object))) {
|
||||
if (!Objects.equals(object, other.object)) {
|
||||
return false;
|
||||
}
|
||||
if (this.memberName != other.memberName && (this.memberName == null || !this.memberName.equals(other.memberName))) {
|
||||
if (!Objects.equals(memberName, other.memberName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -29,11 +29,12 @@ import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class GetVariableActionItem extends ActionItem {
|
||||
|
||||
public GraphTargetItem name;
|
||||
public final GraphTargetItem name;
|
||||
|
||||
private GraphTargetItem computedValue;
|
||||
|
||||
@@ -115,7 +116,7 @@ public class GetVariableActionItem extends ActionItem {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 13 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 13 * hash + Objects.hashCode(name);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -128,7 +129,7 @@ public class GetVariableActionItem extends ActionItem {
|
||||
return false;
|
||||
}
|
||||
final GetVariableActionItem other = (GetVariableActionItem) obj;
|
||||
if (this.name != other.name && (this.name == null || !this.name.equals(other.name))) {
|
||||
if (!Objects.equals(name, other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -21,14 +21,14 @@ import java.io.Serializable;
|
||||
|
||||
public class RegisterNumber implements Serializable {
|
||||
|
||||
public int number;
|
||||
public final int number;
|
||||
|
||||
public String name = null;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 47 * hash + this.number;
|
||||
hash = 47 * hash + number;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RegisterNumber implements Serializable {
|
||||
return false;
|
||||
}
|
||||
final RegisterNumber other = (RegisterNumber) obj;
|
||||
if (this.number != other.number) {
|
||||
if (number != other.number) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -25,13 +25,13 @@ import java.awt.geom.Rectangle2D;
|
||||
*/
|
||||
public class ExportRectangle {
|
||||
|
||||
public double xMin;
|
||||
public final double xMin;
|
||||
|
||||
public double yMin;
|
||||
public final double yMin;
|
||||
|
||||
public double xMax;
|
||||
public final double xMax;
|
||||
|
||||
public double yMax;
|
||||
public final double yMax;
|
||||
|
||||
public ExportRectangle(double xMin, double yMin, double xMax, double yMax) {
|
||||
this.xMin = xMin;
|
||||
@@ -77,6 +77,6 @@ public class ExportRectangle {
|
||||
ExportRectangle r = (ExportRectangle) obj;
|
||||
return (xMin == r.xMin) && (yMin == r.yMin) && (xMax == r.xMax) && (yMax == r.yMax);
|
||||
}
|
||||
return super.equals(obj);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ package com.jpexs.decompiler.flash.exporters.commonshape;
|
||||
*/
|
||||
public class Point {
|
||||
|
||||
public double x;
|
||||
public final double x;
|
||||
|
||||
public double y;
|
||||
public final double y;
|
||||
|
||||
public Point(double x, double y) {
|
||||
this.x = x;
|
||||
@@ -44,6 +44,6 @@ public class Point {
|
||||
Point pt = (Point) obj;
|
||||
return (x == pt.x) && (y == pt.y);
|
||||
}
|
||||
return super.equals(obj);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,9 +217,9 @@ public class FontHelper {
|
||||
|
||||
public static class KerningPair {
|
||||
|
||||
public char char1;
|
||||
public final char char1;
|
||||
|
||||
public char char2;
|
||||
public final char char2;
|
||||
|
||||
public int kerning;
|
||||
|
||||
@@ -247,13 +247,13 @@ public class FontHelper {
|
||||
return false;
|
||||
}
|
||||
final KerningPair other = (KerningPair) obj;
|
||||
if (this.char1 != other.char1) {
|
||||
if (char1 != other.char1) {
|
||||
return false;
|
||||
}
|
||||
if (this.char2 != other.char2) {
|
||||
if (char2 != other.char2) {
|
||||
return false;
|
||||
}
|
||||
if (this.kerning != other.kerning) {
|
||||
if (kerning != other.kerning) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -44,8 +44,8 @@ public class MyEntry<K, V> implements Entry<K, V> {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 61 * hash + Objects.hashCode(this.key);
|
||||
hash = 61 * hash + Objects.hashCode(this.value);
|
||||
hash = 61 * hash + Objects.hashCode(key);
|
||||
hash = 61 * hash + Objects.hashCode(value);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -57,12 +57,11 @@ public class MyEntry<K, V> implements Entry<K, V> {
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
final MyEntry<K, V> other = (MyEntry<K, V>) obj;
|
||||
if (!Objects.equals(this.key, other.key)) {
|
||||
final MyEntry<?, ?> other = (MyEntry<?, ?>) obj;
|
||||
if (!Objects.equals(key, other.key)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.value, other.value)) {
|
||||
if (!Objects.equals(value, other.value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.types.RGB;
|
||||
import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
@@ -41,7 +42,7 @@ public class Frame implements TreeItem, Exportable {
|
||||
|
||||
public RGB backgroundColor = new RGBA(0, 0, 0, 0);
|
||||
|
||||
public Timeline timeline;
|
||||
public final Timeline timeline;
|
||||
|
||||
public List<Integer> sounds = new ArrayList<>();
|
||||
|
||||
@@ -92,7 +93,7 @@ public class Frame implements TreeItem, Exportable {
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Frame) {
|
||||
Frame frameObj = (Frame) obj;
|
||||
return timeline.equals(frameObj.timeline) && frame == frameObj.frame;
|
||||
return Objects.equals(timeline, frameObj.timeline) && frame == frameObj.frame;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -66,7 +67,7 @@ public class TagScript implements TreeItem, Exportable {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof TagScript) {
|
||||
return tag.equals(((TagScript) obj).getTag());
|
||||
return Objects.equals(tag, ((TagScript) obj).tag);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -175,12 +175,12 @@ public class MATRIX implements Serializable {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 37 * hash + this.getScaleX();
|
||||
hash = 37 * hash + this.getScaleY();
|
||||
hash = 37 * hash + this.getRotateSkew0();
|
||||
hash = 37 * hash + this.getRotateSkew1();
|
||||
hash = 37 * hash + this.translateX;
|
||||
hash = 37 * hash + this.translateY;
|
||||
hash = 37 * hash + getScaleX();
|
||||
hash = 37 * hash + getScaleY();
|
||||
hash = 37 * hash + getRotateSkew0();
|
||||
hash = 37 * hash + getRotateSkew1();
|
||||
hash = 37 * hash + translateX;
|
||||
hash = 37 * hash + translateY;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -193,22 +193,22 @@ public class MATRIX implements Serializable {
|
||||
return false;
|
||||
}
|
||||
final MATRIX other = (MATRIX) obj;
|
||||
if (this.getScaleX() != other.getScaleX()) {
|
||||
if (getScaleX() != other.getScaleX()) {
|
||||
return false;
|
||||
}
|
||||
if (this.getScaleY() != other.getScaleY()) {
|
||||
if (getScaleY() != other.getScaleY()) {
|
||||
return false;
|
||||
}
|
||||
if (this.getRotateSkew0() != other.getRotateSkew0()) {
|
||||
if (getRotateSkew0() != other.getRotateSkew0()) {
|
||||
return false;
|
||||
}
|
||||
if (this.getRotateSkew1() != other.getRotateSkew1()) {
|
||||
if (getRotateSkew1() != other.getRotateSkew1()) {
|
||||
return false;
|
||||
}
|
||||
if (this.translateX != other.translateX) {
|
||||
if (translateX != other.translateX) {
|
||||
return false;
|
||||
}
|
||||
if (this.translateY != other.translateY) {
|
||||
if (translateY != other.translateY) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user