Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.util
Class StructuredEquals

java.lang.Object
  extended by eu.esdihumboldt.util.StructuredEquals

public class StructuredEquals
extends Object

StructuredEquals provides methods for equals and hashCode implementations for complex structures.

Author:
Simon Templer

Constructor Summary
StructuredEquals()
           
 
Method Summary
protected  Iterable<?> asIterable(Object object)
          Returns an iterable for the given objects contents, or null if it does not contain anything that needs to be compared.
 Collection<?> collectObjects(Object object)
          Collect all objects contained in an Iterable or array and in their elements.
 boolean deepIterableEquals(Object o1, Object o2)
          Determines if the given objects are equal, in turn descending into Iterables and arrays and checking if the elements are equal (in order).
 int deepIterableHashCode(Object object)
          Get the hash code for all contained objects, descending into Iterables and arrays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructuredEquals

public StructuredEquals()
Method Detail

deepIterableEquals

public boolean deepIterableEquals(Object o1,
                                  Object o2)
Determines if the given objects are equal, in turn descending into Iterables and arrays and checking if the elements are equal (in order).

Parameters:
o1 - the first object
o2 - the second object
Returns:
if both objects are equal
See Also:
deepIterableHashCode(Object)

deepIterableHashCode

public int deepIterableHashCode(Object object)
Get the hash code for all contained objects, descending into Iterables and arrays.

Parameters:
object - the object to determine the hash code from
Returns:
the hash code
See Also:
deepIterableEquals(Object, Object)

collectObjects

public Collection<?> collectObjects(Object object)
Collect all objects contained in an Iterable or array and in their elements.

Parameters:
object - the object to collect objects on
Returns:
the collected objects

asIterable

protected Iterable<?> asIterable(Object object)
Returns an iterable for the given objects contents, or null if it does not contain anything that needs to be compared.

Parameters:
object - the object in question
Returns:
an iterable for the given object

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d