Object
ClusterIdentifier

public class ClusterIdentifier extends Object
Uniquely identifies a cluster.

We deliberately rely on default Object.hashCode() and Object.equals(Object) so each instance of the class is unique in a map.

It assumes no two clusters will have the same min and max date-time.

Author:
Owen Feehan
  • Constructor Details

    • ClusterIdentifier

      public ClusterIdentifier(ZoneOffset offset)
      Creates with no name.

      The name is subsequently derived from the contents of the cluster.

      Parameters:
      offset - the offset to assume the time-stamp belongs in.
    • ClusterIdentifier

      public ClusterIdentifier(String name, ZoneOffset offset)
      Creates with a constant-name.
      Parameters:
      name - the unique name for the cluster.
      offset - the offset to assume the time-stamp belongs in.
  • Method Details

    • addTimestamp

      public void addTimestamp(long timestamp)
      Adds a timestamp to the cluster.
      Parameters:
      timestamp - the timestamp (seconds since the epoch).
    • assignName

      public void assignName(String name)
      Assigns a name for the cluster.
      Parameters:
      name - the name to assign.
    • name

      public String name() throws OperationFailedException
      Derives a name for the cluster, based upon its contents.
      Returns:
      the derived name.
      Throws:
      OperationFailedException - if assignName(String) has not occurred.
    • getMinTime

      public LocalDateTime getMinTime()
      Gets the earliest date-time in the cluster.

      This is computed the first time the method is called, and remembered for subsequent calls.

      Returns:
      the minimum date-time in the cluster.
    • getMaxTime

      public LocalDateTime getMaxTime()
      Gets the latest date-time in the cluster.

      This is computed the first time the method is called, and remembered for subsequent calls.

      Returns:
      the maximum date-time in the cluster.
    • getMinInstant

      public long getMinInstant()
      Minimum timestamp in cluster. This is the earliest time of any file in the cluster.
    • getMaxInstant

      public long getMaxInstant()
      Maximum timestamp in cluster. This is the latest time of any file in the cluster.
    • getOffset

      public ZoneOffset getOffset()
      The offset to assume the time-stamp belongs in.