Class ClusterIdentifier
Object
ClusterIdentifier
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 Summary
ConstructorsConstructorDescriptionClusterIdentifier
(String name, ZoneOffset offset) Creates with a constant-name.ClusterIdentifier
(ZoneOffset offset) Creates with no name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTimestamp
(long timestamp) Adds a timestamp to the cluster.void
assignName
(String name) Assigns a name for the cluster.long
Maximum timestamp in cluster.Gets the latest date-time in the cluster.long
Minimum timestamp in cluster.Gets the earliest date-time in the cluster.The offset to assume the time-stamp belongs in.name()
Derives a name for the cluster, based upon its contents.
-
Constructor Details
-
ClusterIdentifier
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
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
Assigns a name for the cluster.- Parameters:
name
- the name to assign.
-
name
Derives a name for the cluster, based upon its contents.- Returns:
- the derived name.
- Throws:
OperationFailedException
- ifassignName(String)
has not occurred.
-
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
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
The offset to assume the time-stamp belongs in.
-