public final class DurationToken extends Object implements ScalarToken, Comparable<DurationToken>
DurationValued
object.Modifier and Type | Field and Description |
---|---|
static DurationToken |
NULL
A null valued
DurationToken |
static DurationToken |
ZERO
A zero valued
DurationToken |
static Duration |
ZERO_VALUE
The duration zero value,
0 . |
Constructor and Description |
---|
DurationToken(Duration value)
Constructs a new token with the given non-null
duration value.
|
DurationToken(DurationValued value)
Constructs a new token with the duration
value in the given container.
|
DurationToken(long seconds,
int nanos)
Constructs a new token with the given non-null
duration value.
|
Modifier and Type | Method and Description |
---|---|
Duration |
asDuration()
Gets the contained Duration value as a
java.time.Duration . |
long |
asSeconds()
Get the contained duration value as the number of seconds.
|
int |
compareTo(DurationToken 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 DurationToken |
parse(String value)
Converts a string representation of a Duration value into
a token.
|
int |
subsecNanos()
Get the subsecond portion of the contained duration value.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public static final DurationToken NULL
DurationToken
public static final Duration ZERO_VALUE
0
.public static final DurationToken ZERO
DurationToken
public DurationToken(DurationValued value)
value
- a DurationValued
containing the
desired valuepublic DurationToken(Duration value)
NULL
.value
- the duration value of the tokenpublic DurationToken(long seconds, int nanos)
NULL
.seconds
- the second portion of the durationnanos
- the subsecond portion of the durationpublic int compareTo(DurationToken that)
compareTo
in interface Comparable<DurationToken>
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 DurationToken parse(String value)
value
- a string value to interpret as duration;
see Duration#parse(String)
public final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public long asSeconds()
DurationValued
asSeconds
in interface DurationValued
TokenValued.isNull()
,
0
is returned.DurationValued.subsecNanos()
public int subsecNanos()
DurationValued
subsecNanos
in interface DurationValued
TokenValued.isNull()
,
0
is returned.DurationValued.asSeconds()
public final Duration asDuration()
DurationValued
java.time.Duration
.asDuration
in interface DurationValued
java.time.Duration
. 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 © 2024 Actian Corporation. All rights reserved.