public class ClusterIdentifier extends Object
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.
Constructor and Description |
---|
ClusterIdentifier(String name,
java.time.ZoneOffset offset)
Creates with a constant-name.
|
ClusterIdentifier(java.time.ZoneOffset offset)
Creates with no name.
|
Modifier and Type | Method and Description |
---|---|
void |
addTimestamp(long timestamp)
Adds a timestamp to the cluster.
|
void |
assignName(String name)
Assigns a name for the cluster.
|
long |
getMaxInstant()
Maximum timestamp in cluster.
|
java.time.LocalDateTime |
getMaxTime()
Gets the latest date-time in the cluster.
|
long |
getMinInstant()
Minimum timestamp in cluster.
|
java.time.LocalDateTime |
getMinTime()
Gets the earliest date-time in the cluster.
|
java.time.ZoneOffset |
getOffset()
The offset to assume the time-stamp belongs in.
|
String |
name()
Derives a name for the cluster, based upon its contents.
|
public ClusterIdentifier(java.time.ZoneOffset offset)
The name is subsequently derived from the contents of the cluster.
offset
- the offset to assume the time-stamp belongs in.public ClusterIdentifier(String name, java.time.ZoneOffset offset)
name
- the unique name for the cluster.offset
- the offset to assume the time-stamp belongs in.public void addTimestamp(long timestamp)
timestamp
- the timestamp (seconds since the epoch).public void assignName(String name)
name
- the name to assign.public String name() throws OperationFailedException
OperationFailedException
- if assignName(String)
has not occurred.public java.time.LocalDateTime getMinTime()
This is computed the first time the method is called, and remembered for subsequent calls.
public java.time.LocalDateTime getMaxTime()
This is computed the first time the method is called, and remembered for subsequent calls.
public long getMinInstant()
public long getMaxInstant()
public java.time.ZoneOffset getOffset()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.