public final class NumericToken extends Object implements ScalarToken, Comparable<NumericToken>
NumericValued object.| Modifier and Type | Field and Description |
|---|---|
static NumericToken |
NULL
A null valued
NumericToken |
static NumericToken |
ZERO
A zero valued
NumericToken |
static BigDecimal |
ZERO_VALUE
The numeric zero value,
BigDecimal.ZERO. |
MAX_INFINITY, MIN_INFINITY| Constructor and Description |
|---|
NumericToken(BigDecimal value)
Constructs a new token with the given non-null
numeric value specified as a
java.math.BigDecimal. |
NumericToken(double value)
Constructs a new token with the given non-null
double value.
|
NumericToken(long value)
Constructs a new token with the given non-null
long value.
|
NumericToken(NumericValued value)
Constructs a new token with the numeric
value in the given container.
|
| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
asBigDecimal()
Gets the contained numeric value.
|
int |
compareTo(NumericToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
int |
hashCode()
Returns a hash code for the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
static NumericToken |
parse(String value)
Converts a string representation of a numeric value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetType, isZeroisNullpublic static final NumericToken NULL
NumericTokenpublic static final BigDecimal ZERO_VALUE
BigDecimal.ZERO.public static final NumericToken ZERO
NumericTokenpublic NumericToken(NumericValued value)
value - a NumericValued containing the
desired valuepublic NumericToken(BigDecimal value)
java.math.BigDecimal.
If a null valued token is desired, use NULL.value - the numeric value of the tokenNullPointerException - if the value is null.public NumericToken(double value)
NULL.value - the long value of the tokenpublic NumericToken(long value)
NULL.value - the long value of the tokenpublic int compareTo(NumericToken that)
compareTo in interface Comparable<NumericToken>public boolean equals(Object obj)
DataTokenTokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataTokens in Maps.public int hashCode()
DataTokenTokenConverter.asHashCode(TokenValued).public static NumericToken parse(String value)
value - a string value to interpret as a BigDecimal;
see BigDecimal.BigDecimal(String)public final ScalarTokenType getType()
TokenValuedgetType in interface ScalarValuedgetType in interface TokenValuedgetType in interface ScalarTypedgetType in interface TokenTypedpublic final BigDecimal asBigDecimal()
NumericValuedasBigDecimal in interface NumericValuedjava.math.BigDecimal.
If null valued, as indicated by TokenValued.isNull(), null
is returned.public final boolean isZero()
ScalarValuedisZero in interface ScalarValuedtrue if the value is the zero value,
false otherwise.public final boolean isNull()
TokenValuedisNull in interface TokenValuedtrue if the token is null valued,
false otherwiseCopyright © 2016 Actian Corporation. All rights reserved.