- 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 T
toNumber()
The Gosu runtime calls this method when performing default operations.Methods inherited from interface java.lang.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
- Returns:
- The static Number derivation for this class. Must be the same as the T parameter. Note this is only useful in Java where the type is lost at runtime due to type erasure.
-