Some node equality changes

This commit is contained in:
Luck
2018-12-14 17:27:34 +00:00
Unverified
parent 085e7af681
commit de24817d9c
6 changed files with 41 additions and 49 deletions
@@ -430,17 +430,6 @@ public interface Node {
@Override
boolean equals(Object obj);
/**
* Gets if this Node is equal to another node as defined by the given
* {@link StandardNodeEquality} predicate.
*
* @param other the other node
* @param equalityPredicate the predicate
* @return true if this node is considered equal
* @since 4.1
*/
boolean standardEquals(Node other, StandardNodeEquality equalityPredicate);
/**
* Gets if this Node is equal to another node as defined by the given
* {@link NodeEqualityPredicate}.
@@ -450,9 +439,7 @@ public interface Node {
* @return true if this node is considered equal
* @since 4.1
*/
default boolean equals(Node other, NodeEqualityPredicate equalityPredicate) {
return equalityPredicate.areEqual(this, other);
}
boolean equals(Node other, NodeEqualityPredicate equalityPredicate);
/**
* Similar to {@link Node#equals(Object)}, except doesn't take note of the
@@ -41,7 +41,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
public interface NodeEqualityPredicate {
/**
* Returns if the two nodes are equal
* Returns if the two nodes are equal.
*
* <p>This method should avoid making calls to {@link Node#equals(Node, NodeEqualityPredicate)}
* with {@code this} as the second argument, directly or otherwise.</p>
*
* @param o1 the first node
* @param o2 the second node
@@ -73,6 +73,6 @@ public enum StandardNodeEquality implements NodeEqualityPredicate {
@Override
public boolean areEqual(@NonNull Node o1, @NonNull Node o2) {
return o1.standardEquals(o2, this);
return o1.equals(o2, this);
}
}