- 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>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.praxislive.core.Value
Value.Type<T extends Value>
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_IS_INTEGERstatic StringKEY_MAXIMUMstatic StringKEY_MINIMUMstatic StringKEY_SKEWstatic intMAX_VALUEstatic intMIN_VALUEstatic PNumberONEstatic PNumberZERO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PNumber o)booleanequals(Object obj)Values must override the default equals method.booleanequivalent(Value arg)static Optional<PNumber>from(Value arg)inthashCode()Values must override the default hashcode method.static ArgumentInfoinfo()static ArgumentInfoinfo(double min, double max)static ArgumentInfoinfo(double min, double max, double skew)static ArgumentInfointegerInfo()static ArgumentInfointegerInfo(int min, int max)booleanisEmpty()Check whether this Value is an empty value and has a zero length string representation.booleanisInteger()static PNumberof(double val)static PNumberof(int val)static PNumberparse(String str)inttoIntValue()StringtoString()Values must override the default method to return a string representation that is immutable.doublevalue()
-
-
-
Field Detail
-
ONE
public static final PNumber ONE
-
ZERO
public static final PNumber ZERO
-
KEY_MINIMUM
public static final String KEY_MINIMUM
- See Also:
- Constant Field Values
-
KEY_MAXIMUM
public static final String KEY_MAXIMUM
- See Also:
- Constant Field Values
-
KEY_IS_INTEGER
public static final String KEY_IS_INTEGER
- See Also:
- Constant Field Values
-
KEY_SKEW
public static final String KEY_SKEW
- See Also:
- Constant Field Values
-
MAX_VALUE
public static final int MAX_VALUE
- See Also:
- Constant Field Values
-
MIN_VALUE
public static final int MIN_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
value
public double value()
-
toIntValue
public int toIntValue()
-
toString
public String toString()
Description copied from class:ValueValues must override the default method to return a string representation that is immutable.
-
hashCode
public int hashCode()
Description copied from class:ValueValues must override the default hashcode method.
-
equals
public boolean equals(Object obj)
Description copied from class:ValueValues must override the default equals method. This method should only returntrueif 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 thatthis.equals(that) == this.toString().equals(that.toString())
-
equivalent
public boolean equivalent(Value arg)
- Overrides:
equivalentin classValue
-
isEmpty
public boolean isEmpty()
Description copied from class:ValueCheck 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.
-
compareTo
public int compareTo(PNumber o)
- Specified by:
compareToin interfaceComparable<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
-
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)
-
-