Interface Primitive
public sealed interface Primitive
Numeric style value
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatThe amount of degrees in a circle.static final floatThe amount of gradians in a circle.static final PrimitivePositive Infinity constantstatic final PrimitiveNot-A-Number constantstatic final PrimitiveNegative infinity constantstatic final PrimitiveOne value constantstatic final PrimitiveZero value constant -
Method Summary
Modifier and TypeMethodDescriptionstatic Primitivecreate(float base) Creates a new primitive value withPrimitive.Unit.NONE.static Primitivecreate(float base, @NotNull Primitive.Unit unit) Creates a new primitive value.@NotNull Primitive.UnitgetUnit()Gets the unit of the valuefloatgetValue()Gets the base value of the primitivebooleanisZero()Tests if this is a zero value.floatGet 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- Ifunitisnull
-
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.NONEor 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.
-