Class PNumber

java.lang.Object
org.praxislive.core.Value
org.praxislive.core.types.PNumber
All Implemented Interfaces:
Comparable<PNumber>

public final class PNumber extends Value implements Comparable<PNumber>
  • Field Details

  • Method Details

    • value

      public double value()
    • toIntValue

      public int toIntValue()
    • toString

      public String toString()
      Description copied from class: Value
      Values must override the default method to return a string representation that is immutable.
      Specified by:
      toString in class Value
      Returns:
      String representation
    • hashCode

      public int hashCode()
      Description copied from class: Value
      Values must override the default hashcode method.
      Specified by:
      hashCode in class Value
      Returns:
      int hashcode
    • equals

      public boolean equals(Object obj)
      Description copied from class: Value
      Values must override the default equals method. This method should only return true if the supplied Object is of the same type as the implementing Value. Values of an unknown type should be coerced before calling this method. This method does not have to guarantee that this.equals(that) == this.toString().equals(that.toString())
      Specified by:
      equals in class Value
      Parameters:
      obj -
      Returns:
      boolean
    • equivalent

      public boolean equivalent(Value arg)
      Description copied from class: Value
      Indicates whether some other Value is equivalent to this one. Unlike Value.equals(java.lang.Object) this method is not symmetric - a value of a different type might be equivalent to this without the other type considering the reverse to be true.

      The default implementation uses identity or String equality.

      Overrides:
      equivalent in class Value
      Parameters:
      arg - value to test for equivalence
      Returns:
      true if value is equivalent to this
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Value
      Check whether this Value is an empty value and has a zero length string representation. Subclasses may wish to override this for efficiency if the String representation is lazily created.
      Overrides:
      isEmpty in class Value
      Returns:
      boolean true if empty
    • compareTo

      public int compareTo(PNumber o)
      Specified by:
      compareTo in interface Comparable<PNumber>
    • isInteger

      public boolean isInteger()
    • of

      public static PNumber of(double val)
    • of

      public static PNumber of(int val)
    • parse

      public static PNumber parse(String str) throws ValueFormatException
      Throws:
      ValueFormatException
    • from

      public static Optional<PNumber> from(Value arg)
    • info

      public static ArgumentInfo info()
    • info

      public static ArgumentInfo info(double min, double max)
    • info

      public static ArgumentInfo info(double min, double max, double skew)
    • integerInfo

      public static ArgumentInfo integerInfo()
    • integerInfo

      public static ArgumentInfo integerInfo(int min, int max)