public interface LenientComparable
MathTransform implementations can be
compared ignoring some properties (remarks, etc.) that are not relevant to the
coordinates calculation.
ISOMetadata subclasses
STRICT – Objects must be of the same class
and all attributes must be equal, including xlink and others
identifiers.BY_CONTRACT – The same attributes than the above
STRICT mode must be equal, but the metadata object don't need to be implemented
by the same class provided that they implement the same GeoAPI interface.IGNORE_METADATA – Only the attributes defined
in the GeoAPI interfaces are compared. The above-cited identifiers and xlinks
attributes are ignored.APPROXIMATIVE – The same attributes than the above
IGNORE_METADATA mode are compared, but a slight (implementation dependant)
difference is tolerated in floating point numbers.AbstractIdentifiedObject subclasses
STRICT – Objects must be of the same class
and all attributes must be equal.BY_CONTRACT – The same attributes than the above
STRICT mode must be equal, but the referencing object don't need to be
implemented by the same class provided that they implement the same GeoAPI interface.IGNORE_METADATA – The
identifiers,
aliases,
scope,
domain of validity and
remarks
are ignored because they have no incidence on the coordinate values to be computed by
coordinate operations.
All other attributes that are relevant to coordinate calculations, must be equal.APPROXIMATIVE – The same attributes than the above
IGNORE_METADATA mode are compared, but a slight (implementation dependant)
difference is tolerated in floating point numbers.AbstractMathTransform subclasses
except LinearTransform
STRICT – Objects must be of the same class and all
attributes must be equal, including the
parameter values.BY_CONTRACT – Synonymous to the STRICT mode,
because there is no GeoAPI interfaces for the various kind of math transforms.IGNORE_METADATA – Objects must be of the same class,
but the parameter values can be different if they are different way to formulate the same transform.
For example a "Mercator (2SP)" projection on a sphere with a standard parallel
value of 60° produces the same results than a "Mercator (1SP)" projection on the same sphere
with a scale factor value of 0.5.APPROXIMATIVE – The same attributes than the above
IGNORE_METADATA mode are compared, but a slight (implementation dependant)
difference is tolerated in floating point numbers.MatrixSIS and
LinearTransform implementations
STRICT – Objects must be of the same class, matrixes
must have the same size and all matrix elements must be equal.BY_CONTRACT – Matrixes must have the same size
and all matrix elements must be equal, but the matrixes are not required to be the
same implementation class (any Matrix is okay).IGNORE_METADATA – Synonymous to the
BY_CONTRACT mode, because matrixes don't have metadata.APPROXIMATIVE – The same attributes than the above
BY_CONTRACT mode are compared, but a slight (implementation dependant)
difference is tolerated in floating point numbers.Defined in the sis-utility module
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other)
Returns
true if this object is strictly equals to the given object. |
boolean |
equals(Object other,
ComparisonMode mode)
Compares this object with the given object for equality.
|
boolean equals(Object other, ComparisonMode mode)
STRICT: |
All attributes of the compared objects shall be strictly equal. |
BY_CONTRACT: |
Only the attributes published in the interface contract need to be compared. |
IGNORE_METADATA: |
Only the attributes relevant to the object functionality are compared. |
APPROXIMATIVE: |
Only the attributes relevant to the object functionality are compared, with some tolerance threshold on numerical values. |
DEBUG: |
Special mode for figuring out why two objects expected to be equal are not. |
equals(Object) method contractComparisonMode.STRICT is the only mode compliant with the Object.equals(Object) contract.
For all other modes m, the comparison is not guaranteed to be symmetric neither
transitive:
x.equals(y,m) is not guaranteed to be equal to y.equals(x,m).
In particular, the BY_CONTRACT mode and all modes below it will typically compare only the
properties known to this instance, ignoring any properties that may be known only by the other
instance.x.equals(y,m) and y.equals(z,m) does not implies
x.equals(z,m). In particular, the use of a comparison threshold for the
APPROXIMATIVE mode is incompatible with the transitivity contract.other - the object to compare to this.mode - the strictness level of the comparison.true if both objects are equal according the given comparison mode.Utilities.deepEquals(Object, Object, ComparisonMode)boolean equals(Object other)
true if this object is strictly equals to the given object.
This method is usually implemented as below:
public boolean equals(Object other) {
return equals(other, ComparisonMode.STRICT);
}
Implementors shall ensure that the following conditions hold. Unless the equals
behavior is clearly documented in the interface javadoc (as for example in the Java
collection framework), ComparisonMode.STRICT is the only reliable mode for
this method implementation.
A.equals(B) implies B.equals(A);A.equals(B) and B.equals(C) implies A.equals(C);A.equals(B) implies A.hashCode() == B.hashCode();final in most SIS implementations for ensuring that
subclasses override the above equals(Object, ComparisonMode) method instead
than this one.equals in class Objectother - the object to compare to this.true if both objects are strictly equal.ComparisonMode.STRICTCopyright © 2010–2017 The Apache Software Foundation. All rights reserved.