Interface Primitive


public sealed interface Primitive
Numeric style value
  • Field Details

    • DEGREES_IN_CIRCLE

      static final float DEGREES_IN_CIRCLE
      The amount of degrees in a circle.
      See Also:
    • GRADIANS_IN_CIRCLE

      static final float GRADIANS_IN_CIRCLE
      The amount of gradians in a circle.
      See Also:
    • ZERO

      static final Primitive ZERO
      Zero value constant
    • ONE

      static final Primitive ONE
      One value constant
    • NAN

      static final Primitive NAN
      Not-A-Number constant
    • INFINITY

      static final Primitive INFINITY
      Positive Infinity constant
    • NEGATIVE_INFINITY

      static final Primitive NEGATIVE_INFINITY
      Negative infinity constant
  • Method Details

    • create

      static Primitive create(float base, @NotNull @NotNull Primitive.Unit unit)
      Creates a new primitive value.
      Parameters:
      base - Base value
      unit - Value unit
      Returns:
      Created value
      Throws:
      NullPointerException - If unit is null
    • create

      static Primitive create(float base)
      Creates a new primitive value with Primitive.Unit.NONE.
      Parameters:
      base - Base value.
      Returns:
      Created value
    • getValue

      float getValue()
      Gets the base value of the primitive
      Returns:
      Base value
    • getUnit

      @NotNull @NotNull Primitive.Unit getUnit()
      Gets the unit of the value
      Returns:
      Value unit.
    • isZero

      boolean isZero()
      Tests if this is a zero value. Zero values have a getValue() 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 return 0. Otherwise, the primitive's value is converted to degrees.

      Returns:
      Value in degrees, or 0, if the primitive does not represent an angular value.