Package tech.units.indriya.spi
Class AbstractMeasurement<Q extends javax.measure.Quantity<Q>>
- java.lang.Object
-
- tech.units.indriya.spi.AbstractMeasurement<Q>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Measurement<Q>>,Measurement<Q>,tech.uom.lib.common.function.QuantitySupplier<Q>
- Direct Known Subclasses:
AbstractMeasurement.Default,AbstractMeasurement.DefaultComparable
abstract class AbstractMeasurement<Q extends javax.measure.Quantity<Q>> extends java.lang.Object implements Measurement<Q>, java.lang.Comparable<Measurement<Q>>
This class represents the immutable result of a measurement stated in a known quantity.
All instances of this class shall be immutable.
- Version:
- 0.4 $Date: 2016-10-15 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAbstractMeasurement.Default<Q extends javax.measure.Quantity<Q>>This class represents the default measurement.(package private) static classAbstractMeasurement.DefaultComparable<Q extends javax.measure.Quantity<Q>>This class represents the default measurement.
-
Field Summary
Fields Modifier and Type Field Description private java.time.Instantinstantprivate javax.measure.Quantity<Q>quantityprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMeasurement(javax.measure.Quantity<Q> q)constructor.protectedAbstractMeasurement(javax.measure.Quantity<Q> q, long t)constructor.protectedAbstractMeasurement(javax.measure.Quantity<Q> q, java.time.Instant i)constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.time.InstantgetInstant()Returns the measurement instant.javax.measure.Quantity<Q>getQuantity()Returns the measurement quantity.longgetTimestamp()Returns the measurement timestamp.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
instant
private final java.time.Instant instant
-
-
Constructor Detail
-
AbstractMeasurement
protected AbstractMeasurement(javax.measure.Quantity<Q> q, java.time.Instant i)
constructor.
-
AbstractMeasurement
protected AbstractMeasurement(javax.measure.Quantity<Q> q, long t)
constructor.
-
AbstractMeasurement
protected AbstractMeasurement(javax.measure.Quantity<Q> q)
constructor.
-
-
Method Detail
-
getQuantity
public javax.measure.Quantity<Q> getQuantity()
Returns the measurement quantity.
-
getInstant
public final java.time.Instant getInstant()
Returns the measurement instant.- Specified by:
getInstantin interfaceMeasurement<Q extends javax.measure.Quantity<Q>>- Returns:
- the instant.
-
getTimestamp
public final long getTimestamp()
Returns the measurement timestamp.- Specified by:
getTimestampin interfaceMeasurement<Q extends javax.measure.Quantity<Q>>- Returns:
- the timestamp.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-