public final class Utilities extends Static
Defined in the sis-utility
module
Modifier and Type | Method and Description |
---|---|
static boolean |
deepEquals(Object object1,
Object object2,
ComparisonMode mode)
Convenience method for testing two objects for equality using the given level of strictness.
|
static int |
deepHashCode(Object object)
Returns a hash code for the specified object, which may be an array.
|
static String |
deepToString(Object object)
Returns a string representation of the specified object, which may be an array.
|
static boolean |
equalsApproximatively(Object object1,
Object object2)
Compares the specified objects for equality, ignoring metadata and slight differences
in numerical values.
|
static boolean |
equalsIgnoreMetadata(Object object1,
Object object2)
Compares the specified objects for equality, ignoring metadata.
|
public static boolean equalsIgnoreMetadata(Object object1, Object object2)
true
, then:
findMathTransform(crs1, crs2)
will return an identity transform.equalsApproximatively(Object, Object)
can be used instead.
return deepEquals(object1, object2, ComparisonMode.IGNORE_METADATA);
object1
- The first object to compare (may be null).object2
- The second object to compare (may be null).true
if both objects are equal, ignoring metadata.deepEquals(Object, Object, ComparisonMode)
,
ComparisonMode.IGNORE_METADATA
public static boolean equalsApproximatively(Object object1, Object object2)
true
, then:
findMathTransform(crs1, crs2)
will return a transform close to the identity transform.return deepEquals(object1, object2, ComparisonMode.APPROXIMATIVE);
object1
- The first object to compare (may be null).object2
- The second object to compare (may be null).true
if both objects are approximatively equal.deepEquals(Object, Object, ComparisonMode)
,
ComparisonMode.APPROXIMATIVE
public static boolean deepEquals(Object object1, Object object2, ComparisonMode mode)
LenientComparable
interface, then
the comparison is performed using the LenientComparable.equals(Object, ComparisonMode)
method. Otherwise this method performs the same work than the
Objects.deepEquals(Object, Object)
convenience method.
If both arguments are arrays or collections, then the elements are compared recursively.
object1
- The first object to compare, or null
.object2
- The second object to compare, or null
.mode
- The strictness level of the comparison.true
if both objects are equal for the given level of strictness.equalsIgnoreMetadata(Object, Object)
,
equalsApproximatively(Object, Object)
public static int deepHashCode(Object object)
null
, then this method returns 0.Arrays.deepHashCode(Object[])
is invoked.Arrays.hashCode(...)
method is invoked.Object.hashCode()
is invoked.Object
, not as some subtype like Object[]
, String
or
float[]
. In the later cases, use the appropriate Arrays
method instead.object
- The object to compute hash code. May be null
.public static String deepToString(Object object)
Arrays.deepToString(Object[])
is invoked.Arrays.toString(...)
method is invoked.String.valueOf(Object)
is invoked.Object
, not as some subtype like Object[]
, Number
or
float[]
. In the later cases, use the appropriate Arrays
method instead.object
- The object to format as a string. May be null
.Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.