Interface Differentiable<T>

All Known Subinterfaces:
DatumMetadataOperations, DatumSamplesOperations, MutableDatumMetadataOperations, MutableDatumSamplesOperations
All Known Implementing Classes:
DatumSamples, GeneralDatum, GeneralDatumMetadata, MapSampleOperations

public interface Differentiable<T>
Common API for an object that can be compared to another for differences.

The actual meaning of different is implementation specific. For example an entity might implement this API in order to tell if a modified copy of an entity with the same identity as a persisted instance have different property values, and thus the copy should be persisted to save the updated property values.

Since:
1.59
Version:
1.1
Author:
matt
  • Method Details

    • differsFrom

      boolean differsFrom(T other)
      Test if this object differs from another.
      Parameters:
      other - the other object to compare to
      Returns:
      true if the object differs from this object
    • differ

      static <T extends Differentiable<T>> boolean differ(T l, T r)
      Test if two Differentiable objects differ.

      If both objects are null this method returns false. If one object is null this methdo returns true. Otherwise this method returns the result of l.differsFrom(r).

      Type Parameters:
      T - the Differentiable type
      Parameters:
      l - the first object
      r - the second object
      Returns:
      true if there are any difference between the objects
      Since:
      1.1
    • differ

      static <T extends Differentiable<T>> boolean differ(Collection<T> l, Collection<T> r)
      Test if two collections of Differentiable objects have any difference.

      This compares the objects in each collection in iteration order. If any pair of objects differ, this method returns true. If the collections are of different sizes, this method returns true. If both collections are null this method returns false.

      Type Parameters:
      T - the Differentiable type
      Parameters:
      l - the first collection
      r - the second collection
      Returns:
      true if there are any differences between the collections
      Since:
      1.1