Package org.openwms.core.units.api
Interface Measurable<V extends Number,E extends Measurable<V,E,T>,T extends BaseUnit<T>>
- All Superinterfaces:
Comparable<E>
,Serializable
- All Known Subinterfaces:
AbstractMeasure
- All Known Implementing Classes:
MetricDimension
,Piece
,Weight
public interface Measurable<V extends Number,E extends Measurable<V,E,T>,T extends BaseUnit<T>>
extends Comparable<E>, Serializable
A Measurable.
- Author:
- Heiko Scherrer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionMeasurable
<V, E, T> add
(Measurable<V, E, T> other) Add another
Measurable to this one.default String
asString()
Return a combination of amount and unit, e.g. 24 PCConvert thisMeasurable
into anotherMeasurable
.Get the magnitude of thisMeasurable
.Returns the type ofMeasurable
.boolean
Check whether the magnitude is of negative value.boolean
isZero()
Check whether the magnitude is 0.Measurable
<V, E, T> subtract
(Measurable<V, E, T> other) Subtract another
Measurable instance from this one.Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
SEPARATOR
- See Also:
-
-
Method Details
-
getUnitType
T getUnitType()Returns the type ofMeasurable
.- Returns:
- The
Measurable
's type
-
getMagnitude
V getMagnitude()Get the magnitude of thisMeasurable
.- Returns:
- the magnitude
-
isZero
boolean isZero()Check whether the magnitude is 0.- Returns:
- true is magnitude is 0, otherwise false
-
isNegative
boolean isNegative()Check whether the magnitude is of negative value.- Returns:
- true if the magnitude is of negative value, otherwise false
-
convertTo
Convert thisMeasurable
into anotherMeasurable
.- Parameters:
unit
- TheBaseUnit
to convert to- Returns:
- The converted unit
-
asString
Return a combination of amount and unit, e.g. 24 PC -
add
Add another
Measurable to this one.- Parameters:
other
- The one to add- Returns:
- A new instance
-
subtract
Subtract another
Measurable instance from this one.- Parameters:
other
- The one to subtract- Returns:
- A new instance
-