public final class IntToken extends Object implements ScalarToken, Comparable<IntToken>
IntValued
object.Modifier and Type | Field and Description |
---|---|
static IntToken |
NULL
A null valued
IntToken |
static IntToken |
ZERO
A zero valued
IntToken |
static int |
ZERO_VALUE
The int zero value,
0 . |
MAX_INFINITY, MIN_INFINITY
Constructor and Description |
---|
IntToken(int value)
Constructs a new token with the given non-null
integer value.
|
IntToken(IntValued value)
Constructs a new token with the integer
value in the given container.
|
Modifier and Type | Method and Description |
---|---|
BigDecimal |
asBigDecimal()
Gets the contained numeric value.
|
double |
asDouble()
Gets the contained double value.
|
float |
asFloat()
Gets the contained float value.
|
int |
asInt()
Gets the contained integer value.
|
long |
asLong()
Gets the contained long value.
|
Integer |
asObject()
Gets the value of the token as an object.
|
int |
compareTo(IntToken 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 IntToken |
parse(String value)
Converts a string representation of an int value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public static final IntToken NULL
IntToken
public static final int ZERO_VALUE
0
.public static final IntToken ZERO
IntToken
public IntToken(IntValued value)
value
- a IntValued
containing the
desired valuepublic IntToken(int value)
NULL
.value
- the integer value of the tokenpublic Integer asObject()
null
if the token is null valued.public int compareTo(IntToken that)
compareTo
in interface Comparable<IntToken>
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 IntToken parse(String value)
value
- a string value to interpret as a int;
see Integer.valueOf(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 double asDouble()
DoubleValued
asDouble
in interface DoubleValued
double
. If null valued,
as indicated by TokenValued.isNull()
, Double.NaN
is returned.public final float asFloat()
FloatValued
asFloat
in interface FloatValued
float
. If null valued,
as indicated by TokenValued.isNull()
, Float.NaN
is returned.public final long asLong()
LongValued
asLong
in interface LongValued
long
. If null valued,
as indicated by TokenValued.isNull()
, 0
is returned.public final int asInt()
IntValued
asInt
in interface IntValued
int
. If null valued,
as indicated by TokenValued.isNull()
, 0
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 © 2024 Actian Corporation. All rights reserved.