/** * Checks whether the given object is equal to this one. Two node states * are considered equal if all their properties and child nodes match, * regardless of ordering. Subclasses may override this method with a * more efficient equality check if one is available. * * @param that target of the comparison * @return {@code true} if the objects are equal, * {@code false} otherwise */ @Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof NodeState) { return equals(this, (NodeState) that); } else { return false; } }
/** * Checks whether the given object is equal to this one. Two node states * are considered equal if all their properties and child nodes match, * regardless of ordering. Subclasses may override this method with a * more efficient equality check if one is available. * * @param that target of the comparison * @return {@code true} if the objects are equal, * {@code false} otherwise */ @Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof NodeState) { return equals(this, (NodeState) that); } else { return false; } }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) that; if (!getPath().equals(other.getPath())) { // path does not match: not equals // (even if the properties are equal) return false; } if (revisionEquals(other)) { return true; } // revision does not match: might still be equals } else if (that instanceof ModifiedNodeState) { ModifiedNodeState modified = (ModifiedNodeState) that; if (modified.getBaseState() == this) { return EqualsDiff.equals(this, modified); } } if (that instanceof NodeState) { return AbstractNodeState.equals(this, (NodeState) that); } return false; }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) that; if (!getPath().equals(other.getPath())) { // path does not match: not equals // (even if the properties are equal) return false; } if (revisionEquals(other)) { return true; } // revision does not match: might still be equals } else if (that instanceof ModifiedNodeState) { ModifiedNodeState modified = (ModifiedNodeState) that; if (modified.getBaseState() == this) { return EqualsDiff.equals(this, modified); } } if (that instanceof NodeState) { return AbstractNodeState.equals(this, (NodeState) that); } return false; }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) that; if (!base.getPath().equals(other.getPath())) { // path does not match: not equals // (even if the properties are equal) return false; } if (revisionEquals(base, other)) { // other is equal to our base state // perform an equals diff with base and modified return EqualsDiff.equals(base, modified); } // revision does not match: might still be equals } else if (that instanceof ModifiedNodeState) { ModifiedNodeState modified = (ModifiedNodeState) that; if (modified.getBaseState() == base) { // base states are the same, compare the modified return EqualsDiff.equals(this.modified, modified); } } if (that instanceof NodeState) { return AbstractNodeState.equals(modified, (NodeState) that); } return false; }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof AbstractDocumentNodeState) { AbstractDocumentNodeState other = (AbstractDocumentNodeState) that; if (!base.getPath().equals(other.getPath())) { // path does not match: not equals // (even if the properties are equal) return false; } if (revisionEquals(base, other)) { // other is equal to our base state // perform an equals diff with base and modified return EqualsDiff.equals(base, modified); } // revision does not match: might still be equals } else if (that instanceof ModifiedNodeState) { ModifiedNodeState modified = (ModifiedNodeState) that; if (modified.getBaseState() == base) { // base states are the same, compare the modified return EqualsDiff.equals(this.modified, modified); } } if (that instanceof NodeState) { return AbstractNodeState.equals(modified, (NodeState) that); } return false; }
@Override public boolean equals(Object object) { if (object instanceof SegmentNodeState) { SegmentNodeState that = (SegmentNodeState) object; if (fastEquals(this, that)) { return true; } else { Template template = getTemplate(); return template.equals(that.getTemplate()) && template.compare(getRecordId(), that.getRecordId()); } } else { return object instanceof NodeState && AbstractNodeState.equals(this, (NodeState) object); } }