mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-05 01:36:00 +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;
|
||||
|
||||
@@ -27,13 +27,14 @@ import java.util.Objects;
|
||||
*/
|
||||
public class DottedChain {
|
||||
|
||||
public List<String> parts = new ArrayList<>();
|
||||
public final List<String> parts;
|
||||
|
||||
public DottedChain(List<String> parts) {
|
||||
this.parts = new ArrayList<>(parts);
|
||||
}
|
||||
|
||||
public DottedChain(String... parts) {
|
||||
this.parts = new ArrayList<>();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
this.parts.add(parts[i]);
|
||||
}
|
||||
@@ -81,7 +82,7 @@ public class DottedChain {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 89 * hash + Objects.hashCode(this.parts);
|
||||
hash = 89 * hash + Objects.hashCode(parts);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ public class DottedChain {
|
||||
return false;
|
||||
}
|
||||
final DottedChain other = (DottedChain) obj;
|
||||
if (!Objects.equals(this.parts, other.parts)) {
|
||||
if (!Objects.equals(parts, other.parts)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -28,14 +28,21 @@ import java.util.List;
|
||||
public class GraphPart implements Serializable {
|
||||
|
||||
public static final int TYPE_NONE = 0;
|
||||
|
||||
public static final int TYPE_LOOP_HEADER = 1;
|
||||
|
||||
public static final int TYPE_PRELOOP = 3;
|
||||
|
||||
public static final int TYPE_REENTRY = 2;
|
||||
|
||||
public boolean traversed = false;
|
||||
|
||||
public int DFSP_pos = 0;
|
||||
|
||||
public GraphPart iloop_header;
|
||||
|
||||
public int type = TYPE_NONE;
|
||||
|
||||
public boolean irreducible = false;
|
||||
|
||||
public int start = 0;
|
||||
@@ -315,10 +322,10 @@ public class GraphPart implements Serializable {
|
||||
return false;
|
||||
}
|
||||
final GraphPart other = (GraphPart) obj;
|
||||
if (this.start != other.start) {
|
||||
if (start != other.start) {
|
||||
return false;
|
||||
}
|
||||
if (this.end != other.end) {
|
||||
if (end != other.end) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,7 +31,7 @@ public class GraphPath implements Serializable {
|
||||
|
||||
private final List<Integer> vals = new ArrayList<>();
|
||||
|
||||
public String rootName = "";
|
||||
public final String rootName;
|
||||
|
||||
public GraphPath(String rootName, List<Integer> keys, List<Integer> vals) {
|
||||
this.rootName = rootName;
|
||||
@@ -39,10 +40,15 @@ public class GraphPath implements Serializable {
|
||||
}
|
||||
|
||||
public GraphPath(List<Integer> keys, List<Integer> vals) {
|
||||
rootName = "";
|
||||
this.keys.addAll(keys);
|
||||
this.vals.addAll(vals);
|
||||
}
|
||||
|
||||
public GraphPath() {
|
||||
rootName = "";
|
||||
}
|
||||
|
||||
public boolean startsWith(GraphPath p) {
|
||||
if (p.length() > length()) {
|
||||
return false;
|
||||
@@ -52,10 +58,10 @@ public class GraphPath implements Serializable {
|
||||
List<Integer> otherVals = new ArrayList<>(p.vals);
|
||||
|
||||
for (int i = 0; i < p.length(); i++) {
|
||||
if (keys.get(i) != otherKeys.get(i)) {
|
||||
if (!Objects.equals(keys.get(i), otherKeys.get(i))) {
|
||||
return false;
|
||||
}
|
||||
if (vals.get(i) != otherVals.get(i)) {
|
||||
if (!Objects.equals(vals.get(i), otherVals.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -82,9 +88,6 @@ public class GraphPath implements Serializable {
|
||||
this.rootName = rootName;
|
||||
}
|
||||
|
||||
public GraphPath() {
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return vals.size();
|
||||
}
|
||||
@@ -100,9 +103,9 @@ public class GraphPath implements Serializable {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 23 * hash + (this.keys != null ? this.keys.hashCode() : 0);
|
||||
hash = 23 * hash + (this.vals != null ? this.vals.hashCode() : 0);
|
||||
hash = 23 * hash + (this.rootName != null ? this.rootName.hashCode() : 0);
|
||||
hash = 23 * hash + arrHashCode(keys);
|
||||
hash = 23 * hash + arrHashCode(vals);
|
||||
hash = 23 * hash + Objects.hashCode(rootName);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -115,34 +118,44 @@ public class GraphPath implements Serializable {
|
||||
return false;
|
||||
}
|
||||
final GraphPath other = (GraphPath) obj;
|
||||
if (this.rootName == null && other.rootName != null) {
|
||||
return false;
|
||||
}
|
||||
if (this.rootName != null && other.rootName == null) {
|
||||
if ((rootName == null) != (other.rootName == null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.rootName != null && other.rootName != null) {
|
||||
if (!this.rootName.equals(other.rootName)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(rootName, other.rootName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!arrMatch(keys, other.keys)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!arrMatch(vals, other.vals)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int arrHashCode(List<Integer> arr) {
|
||||
if (arr == null || arr.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hash = 5;
|
||||
for (Integer i : arr) {
|
||||
hash = 23 * hash + Objects.hashCode(i);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
private static boolean arrMatch(List<Integer> arr, List<Integer> arr2) {
|
||||
if (arr.size() != arr2.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
if (arr.get(i) != arr2.get(i)) {
|
||||
if (!Objects.equals(arr.get(i), arr2.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Loop implements Serializable {
|
||||
|
||||
public List<Integer> breakCandidatesLevels = new ArrayList<>();
|
||||
|
||||
public long id;
|
||||
public final long id;
|
||||
|
||||
public int leadsToMark;
|
||||
|
||||
@@ -73,10 +73,9 @@ public class Loop implements Serializable {
|
||||
return false;
|
||||
}
|
||||
final Loop other = (Loop) obj;
|
||||
if (this.id != other.id) {
|
||||
if (id != other.id) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class TypeFunctionItem extends GraphTargetItem {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 83 * hash + Objects.hashCode(this.fullTypeName);
|
||||
hash = 83 * hash + Objects.hashCode(fullTypeName);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TypeFunctionItem extends GraphTargetItem {
|
||||
return false;
|
||||
}
|
||||
final TypeFunctionItem other = (TypeFunctionItem) obj;
|
||||
if (!Objects.equals(this.fullTypeName, other.fullTypeName)) {
|
||||
if (!Objects.equals(fullTypeName, other.fullTypeName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TypeItem extends GraphTargetItem {
|
||||
|
||||
public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem();
|
||||
|
||||
public DottedChain fullTypeName;
|
||||
public final DottedChain fullTypeName;
|
||||
|
||||
public TypeItem(String s) {
|
||||
this(s == null ? new DottedChain() : new DottedChain(s.split("\\.")));
|
||||
@@ -58,7 +58,7 @@ public class TypeItem extends GraphTargetItem {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 83 * hash + Objects.hashCode(this.fullTypeName);
|
||||
hash = 83 * hash + Objects.hashCode(fullTypeName);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class TypeItem extends GraphTargetItem {
|
||||
return false;
|
||||
}
|
||||
final TypeItem other = (TypeItem) obj;
|
||||
if (!Objects.equals(this.fullTypeName, other.fullTypeName)) {
|
||||
if (!Objects.equals(fullTypeName, other.fullTypeName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.graph.GraphSourceItemPos;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
@@ -31,7 +32,7 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
|
||||
public GraphTargetItem rightSide;
|
||||
|
||||
protected String operator = "";
|
||||
protected final String operator;
|
||||
|
||||
@Override
|
||||
public GraphPart getFirstPart() {
|
||||
@@ -107,9 +108,9 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 71 * hash + (this.leftSide != null ? this.leftSide.hashCode() : 0);
|
||||
hash = 71 * hash + (this.rightSide != null ? this.rightSide.hashCode() : 0);
|
||||
hash = 71 * hash + (this.operator != null ? this.operator.hashCode() : 0);
|
||||
hash = 71 * hash + Objects.hashCode(leftSide);
|
||||
hash = 71 * hash + Objects.hashCode(rightSide);
|
||||
hash = 71 * hash + Objects.hashCode(operator);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -138,13 +139,13 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
return false;
|
||||
}
|
||||
final BinaryOpItem other = (BinaryOpItem) obj;
|
||||
if (this.leftSide != other.leftSide && (this.leftSide == null || !this.leftSide.equals(other.leftSide))) {
|
||||
if (!Objects.equals(leftSide, other.leftSide)) {
|
||||
return false;
|
||||
}
|
||||
if (this.rightSide != other.rightSide && (this.rightSide == null || !this.rightSide.equals(other.rightSide))) {
|
||||
if (!Objects.equals(rightSide, other.rightSide)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.operator == null) ? (other.operator != null) : !this.operator.equals(other.operator)) {
|
||||
if (!Objects.equals(operator, other.operator)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user