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 anotherMeasurable to this one.default StringasString()Return a combination of amount and unit, e.g. 24 PCConvert thisMeasurableinto anotherMeasurable.Get the magnitude of thisMeasurable.Returns the type ofMeasurable.booleanCheck whether the magnitude is of negative value.booleanisZero()Check whether the magnitude is 0.Measurable<V, E, T> subtract(Measurable<V, E, T> other) Subtract anotherMeasurable 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 thisMeasurableinto anotherMeasurable.- Parameters:
unit- TheBaseUnitto convert to- Returns:
- The converted unit
-
asString
Return a combination of amount and unit, e.g. 24 PC -
add
Add anotherMeasurable to this one.- Parameters:
other- The one to add- Returns:
- A new instance
-
subtract
Subtract anotherMeasurable instance from this one.- Parameters:
other- The one to subtract- Returns:
- A new instance
-