public interface StructuralObject
structuralEquals(Object) complements the object equality
Object.equals(Object), and can be used to identify not necessarily
equal objects that consist of (structurally) equal parts. This is in a
similar way that Object.equals(Object) complements ==. The
main purpose is to use an additional comparison functions (which is not used
in standard collections) to identify structurally equal objects, which can be
used, for example, for
memoization.
Unlike Object.equals(Object), the method
structuralEquals(Object) does not return a boolean but either the
input object, if the equality holds, or null if it does not hold.
As for the object equality, structural equality must be symmetric and
transitive. The structural equality must extend equality in the same way as
Object.equals(Object) extends ==. That is, any two equal
structural objects must be structurally equal.
In addition to structural equality, there is also a structural hash code
structuralHashCode() that is similar to the object hash code
Object.hashCode(). As usual, the structural hash code must be
compatible with structural equality, that is, if two object are structurally
equal, they must have the same hash code.| Modifier and Type | Method and Description |
|---|---|
StructuralObject |
structuralEquals(Object other)
Performs the structural equality comparison of this object with the given
object.
|
int |
structuralHashCode()
Computes the structural hash code of this object, which is an integer
uniquely determined by the structure of this object.
|
StructuralObject structuralEquals(Object other)
StructuralObject, and it is returned in the output.other - the object with which the comparison is performednull
if the structural equality test does not holdObject.equals(Object)int structuralHashCode()
structuralEquals(Object).Object.hashCode()Copyright © 2011–2024 Live Ontologies Project. All rights reserved.