Interface Primitive
public sealed interface Primitive
Numeric style value
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
The amount of degrees in a circle.static final float
The amount of gradians in a circle.static final Primitive
Positive Infinity constantstatic final Primitive
Not-A-Number constantstatic final Primitive
Negative infinity constantstatic final Primitive
One value constantstatic final Primitive
Zero value constant -
Method Summary
Modifier and TypeMethodDescriptionstatic Primitive
create
(float base) Creates a new primitive value withPrimitive.Unit.NONE
.static Primitive
create
(float base, @NotNull Primitive.Unit unit) Creates a new primitive value.@NotNull Primitive.Unit
getUnit()
Gets the unit of the valuefloat
getValue()
Gets the base value of the primitiveboolean
isZero()
Tests if this is a zero value.float
Get the primitive's value in degrees.
-
Field Details
-
DEGREES_IN_CIRCLE
static final float DEGREES_IN_CIRCLEThe amount of degrees in a circle.- See Also:
-
GRADIANS_IN_CIRCLE
static final float GRADIANS_IN_CIRCLEThe amount of gradians in a circle.- See Also:
-
ZERO
Zero value constant -
ONE
One value constant -
NAN
Not-A-Number constant -
INFINITY
Positive Infinity constant -
NEGATIVE_INFINITY
Negative infinity constant
-
-
Method Details
-
create
Creates a new primitive value.- Parameters:
base
- Base valueunit
- Value unit- Returns:
- Created value
- Throws:
NullPointerException
- Ifunit
isnull
-
create
Creates a new primitive value withPrimitive.Unit.NONE
.- Parameters:
base
- Base value.- Returns:
- Created value
-
getValue
float getValue()Gets the base value of the primitive- Returns:
- Base value
-
getUnit
-
isZero
boolean isZero()Tests if this is a zero value. Zero values have agetValue()
of 0.- Returns:
true
, if this is a 0 value,false
, otherwise.
-
toDegrees
float toDegrees()Get the primitive's value in degrees.If the primitive's value is not
Primitive.Unit.NONE
or an angle unit, then this function will return0
. Otherwise, the primitive's value is converted to degrees.- Returns:
- Value in degrees, or
0
, if the primitive does not represent an angular value.
-