public class UPLNumeric extends UPLValue
isBreakValue, isContinueValue, isEmptyReturnValue, isReturnValue, isValid, kTYPE_BOOL, kTYPE_COLOR, kTYPE_ID, kTYPE_LAMBDA, kTYPE_LIST, kTYPE_NULL, kTYPE_NUMERIC, kTYPE_PRG, kTYPE_STRING, kTYPE_UNKNOWN, kTYPE_VALUE, kTYPE_VOID, type
Constructor and Description |
---|
UPLNumeric()
Constructs a new Numeric.
|
UPLNumeric(double value)
Constructs a Numeric with power 0, i.e. it is simply a number.
|
UPLNumeric(double value,
int pow)
Constructs a new Numeric.
|
UPLNumeric(java.lang.String inText)
Constructs a new Numeric.
|
Modifier and Type | Method and Description |
---|---|
UPLValue |
add(UPLValue v)
Implements the addition of this UPLValue with the given value.
|
UPLValue |
affirmate()
unary +.
|
UPLValue |
castAs(int toType,
de.infinityloop.upcast.util.namespace.NamespaceManager namespaceManager) |
static UPLNumeric |
castToNumeric(UPLValue from) |
int |
compareTo(int compareType,
UPLNumeric to) |
int |
compareTo(int compareType,
UPLValue to)
Compares this object with the specified object for order.
|
UPLValue |
decrement()
unary decrement.
|
UPLNumeric |
deepCopy()
Creates a deep copy of a UPLValue.
|
UPLValue |
div(UPLValue v)
Implements the division of this value and the given UPLValue.
|
java.lang.String |
getAsString()
Returns a string representation of this Numeric.
|
java.lang.String |
getAsUPL() |
java.lang.String |
getDebugString() |
boolean |
getEffectiveBooleanValue()
The effective boolean value of an UPLValue as per the XPath spec.
|
int |
getPow()
Returns the power of the Numeric.
|
double |
getValue()
Returns the value of the Numeric.
|
java.lang.String |
getValueAsString() |
long |
getValueRounded() |
UPLValue |
increment()
unary increment.
|
UPLValue |
mod(UPLValue v) |
UPLValue |
negate()
Calculates the negative of this Numeric.
|
void |
setPow(int i)
Sets the power of the Numeric.
|
void |
setValue(double d)
Sets the value of the Numeric.
|
void |
setValue(java.lang.String d)
Sets the value of the Numeric.
|
UPLValue |
sub(UPLValue v)
Implements the subtraction of the given UPLValue from this value.
|
UPLValue |
times(UPLValue v)
Implements the multiplication of the given UPLValue with this value.
|
castableAs, castValueToType, coerceToType, equals, eval, getInstanceofDistance, getType, getType, getTypeName, getTypeName, isBreakValue, isContinueValue, isEmptyReturnValue, isReturnValue, isValid, matchRating, not, setBreakValue, setContinueValue, setEmptyReturnValue, setReturnValue, setValid, toString
public UPLNumeric()
public UPLNumeric(double value)
value
- public UPLNumeric(double value, int pow)
value
- the value of the Numericpow
- the power of the Numericpublic UPLNumeric(java.lang.String inText)
inText
- the text based on which the value for this Numeric is setpublic UPLValue castAs(int toType, de.infinityloop.upcast.util.namespace.NamespaceManager namespaceManager) throws UPLValueException
castAs
in class UPLValue
UPLValueException
public static UPLNumeric castToNumeric(UPLValue from) throws UPLValueException
UPLValueException
public UPLValue add(UPLValue v) throws UPLValueException
UPLValue
add
in class UPLValue
v
- the value to be addedUPLValueException
public UPLValue sub(UPLValue v) throws UPLValueException
UPLValue
sub
in class UPLValue
v
- the value to subtractUPLValueException
public UPLValue times(UPLValue v) throws UPLValueException
UPLValue
times
in class UPLValue
v
- the value to be used as factorUPLValueException
public UPLValue div(UPLValue v) throws UPLValueException
UPLValue
div
in class UPLValue
v
- the value to be used as divisorUPLValueException
public UPLValue mod(UPLValue v) throws UPLValueException
mod
in class UPLValue
UPLValueException
public int compareTo(int compareType, UPLValue to) throws UPLValueException
UPLValue
compareTo
in class UPLValue
compareType
- see RelationalExpr: kEQ, kNEQ, kLT, kGT, kLTEQ, kGTEQto
- the Object to be comparedUPLValueException
public int compareTo(int compareType, UPLNumeric to) throws UPLValueException
UPLValueException
public boolean getEffectiveBooleanValue()
UPLValue
getEffectiveBooleanValue
in class UPLValue
UPLValue.getEffectiveBooleanValue()
public UPLValue affirmate() throws UPLValueException
affirmate
in class UPLValue
UPLValueException
UPLValue.affirmate()
public UPLValue negate()
public UPLValue increment()
UPLValue
increment
in class UPLValue
UPLValueException
public UPLValue decrement()
UPLValue
decrement
in class UPLValue
UPLValueException
public int getPow()
public double getValue()
public long getValueRounded()
public java.lang.String getValueAsString()
public void setPow(int i)
i
- the power of the Numericpublic void setValue(double d)
d
- the value of the Numericpublic void setValue(java.lang.String d) throws UPLValueException
d
- the value of the NumericUPLValueException
public java.lang.String getAsString()
getAsString
in class UPLValue
public java.lang.String getDebugString()
getDebugString
in class UPLValue
public UPLNumeric deepCopy() throws UPLValueException
UPLValue
deepCopy
in class UPLValue
UPLValueException