-
- All Superinterfaces:
Comparable<S>
public interface IDimension<S extends IDimension<S,T>,T extends Number> extends Comparable<S>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description S
fromNumber(T units)
Returns a separate instance of this type with the given number of units.Class<T>
numberType()
default T
toBaseNumber()
T
toNumber()
The Gosu runtime calls this method when performing default operations.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
toNumber
T toNumber()
The Gosu runtime calls this method when performing default operations. For instance, when adding two of the same dimension types, Gosu calls this method on each operand, adds the numbers, and then calls fromNumber() for the result.- Returns:
- the number of units for this dimension instance.
-
toBaseNumber
default T toBaseNumber()
-
fromNumber
S fromNumber(T units)
Returns a separate instance of this type with the given number of units.The Gosu runtime calls this method when performing default operations. For instance, when adding two of the same dimension types, Gosu calls toNumber() on each operand, adds the numbers, and then calls fromNumber() for the result.
- Returns:
- a separate instance of this type given the number of units.
-
-