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, wait
getType, isZero
isNull
public static final NumericToken NULL
NumericToken
public static final BigDecimal ZERO_VALUE
BigDecimal.ZERO
.public static final NumericToken ZERO
NumericToken
public 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)
DataToken
TokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataToken
s in Map
s.public int hashCode()
DataToken
TokenConverter.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()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final BigDecimal asBigDecimal()
NumericValued
asBigDecimal
in interface NumericValued
java.math.BigDecimal
.
If null valued, as indicated by TokenValued.isNull()
, null
is returned.public final boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2020 Actian Corporation. All rights reserved.