public final class DoubleToken extends Object implements ScalarToken, Comparable<DoubleToken>
DoubleValued
object.Modifier and Type | Field and Description |
---|---|
static DoubleToken |
NULL
A null valued
DoubleToken |
static DoubleToken |
ZERO
A zero valued
DoubleToken |
static double |
ZERO_VALUE
The double zero value,
0.0d . |
MAX_INFINITY, MIN_INFINITY
Constructor and Description |
---|
DoubleToken(double value)
Constructs a new token with the given non-null
double value.
|
DoubleToken(DoubleValued value)
Constructs a new token with the double
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.
|
Double |
asObject()
Gets the value of the token as an object.
|
int |
compareTo(DoubleToken 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 DoubleToken |
parse(String value)
Converts a string representation of a double value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getType, isZero
isNull
public static final DoubleToken NULL
DoubleToken
public static final double ZERO_VALUE
0.0d
.public static final DoubleToken ZERO
DoubleToken
public DoubleToken(DoubleValued value)
value
- a DoubleValued
containing the
desired valuepublic DoubleToken(double value)
NULL
.value
- the double value of the tokenpublic Double asObject()
null
if the token is null valued.public int compareTo(DoubleToken that)
compareTo
in interface Comparable<DoubleToken>
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 DoubleToken parse(String value)
value
- a string value to interpret as a double;
see Double.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 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 © 2019 Actian Corporation. All rights reserved.