Package org.tensorics.core.quantity
Class ImmutableQuantifiedValue<V>
- java.lang.Object
-
- org.tensorics.core.quantity.ImmutableQuantifiedValue<V>
-
- Type Parameters:
V- the type of the (numerical) scalar values.
- All Implemented Interfaces:
java.io.Serializable,ErronousValue<V>,Quantified,QuantifiedValue<V>,ValidityAware
public final class ImmutableQuantifiedValue<V> extends java.lang.Object implements QuantifiedValue<V>
Groups a value together with its base. Additionally an error and a validity flag can be provided. If the latter two are not present explicitely given, then the validity will betrueand the (optional) error will not be present.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)com.google.common.base.Optional<V>error()Retrieve the error of the scalarinthashCode()static <V> ImmutableQuantifiedValue<V>of(V value, Unit unit)java.lang.StringtoString()Unitunit()Retrieves the base of the entityjava.lang.Booleanvalidity()Retrieves the validity flag of the object.Vvalue()ImmutableQuantifiedValue<V>withError(com.google.common.base.Optional<V> newError)ImmutableQuantifiedValue<V>withError(V newError)ImmutableQuantifiedValue<V>withValidity(boolean newValidity)
-
-
-
Method Detail
-
of
public static <V> ImmutableQuantifiedValue<V> of(V value, Unit unit)
-
withValidity
public ImmutableQuantifiedValue<V> withValidity(boolean newValidity)
-
withError
public ImmutableQuantifiedValue<V> withError(com.google.common.base.Optional<V> newError)
-
withError
public ImmutableQuantifiedValue<V> withError(V newError)
-
value
public V value()
- Specified by:
valuein interfaceErronousValue<V>
-
unit
public Unit unit()
Description copied from interface:QuantifiedRetrieves the base of the entity- Specified by:
unitin interfaceQuantified- Returns:
- the base of the quantified entity.
-
validity
public java.lang.Boolean validity()
Description copied from interface:ValidityAwareRetrieves the validity flag of the object.- Specified by:
validityin interfaceValidityAware- Returns:
trueif the content is valid,falseif it is not.
-
error
public com.google.common.base.Optional<V> error()
Description copied from interface:ErronousValueRetrieve the error of the scalar- Specified by:
errorin interfaceErronousValue<V>- Returns:
- the error
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-