Interface IDimension<S extends IDimension<S,T> , T extends Number>
- All Superinterfaces:
Comparable<S>
-
Method Summary
Modifier and TypeMethodDescriptionfromNumber(T units) Returns a separate instance of this type with the given number of units.default TtoNumber()The Gosu runtime calls this method when performing default operations.Methods inherited from interface Comparable
compareTo
-
Method Details
-
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
-
fromNumber
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.
-
numberType
-