Skip to content

Commit 384e4bd

Browse files
committed
added hashCode and equals for FunctionalExpression
1 parent 08ab79c commit 384e4bd

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/java/org/tensorics/core/functional/expressions/FunctionalExpression.java

+31
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,35 @@ public FuncN<R> function() {
3838
return func;
3939
}
4040

41+
@Override
42+
public int hashCode() {
43+
final int prime = 31;
44+
int result = 1;
45+
result = prime * result + ((children == null) ? 0 : children.hashCode());
46+
result = prime * result + ((func == null) ? 0 : func.hashCode());
47+
return result;
48+
}
49+
50+
@Override
51+
public boolean equals(Object obj) {
52+
if (this == obj)
53+
return true;
54+
if (obj == null)
55+
return false;
56+
if (getClass() != obj.getClass())
57+
return false;
58+
FunctionalExpression<?> other = (FunctionalExpression<?>) obj;
59+
if (children == null) {
60+
if (other.children != null)
61+
return false;
62+
} else if (!children.equals(other.children))
63+
return false;
64+
if (func == null) {
65+
if (other.func != null)
66+
return false;
67+
} else if (!func.equals(other.func))
68+
return false;
69+
return true;
70+
}
71+
4172
}

0 commit comments

Comments
 (0)