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, toString, wait, wait, waitgetType, isZeroisNullpublic static final DurationToken NULL
DurationTokenpublic static final Duration ZERO_VALUE
0.public static final DurationToken ZERO
DurationTokenpublic 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)
DataTokenTokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataTokens in Maps.public int hashCode()
DataTokenTokenConverter.asHashCode(TokenValued).public static DurationToken parse(String value)
value - a string value to interpret as duration;
see Duration#parse(String)public final ScalarTokenType getType()
TokenValuedgetType in interface ScalarValuedgetType in interface TokenValuedgetType in interface ScalarTypedgetType in interface TokenTypedpublic long asSeconds()
DurationValuedasSeconds in interface DurationValuedTokenValued.isNull(),
0 is returned.DurationValued.subsecNanos()public int subsecNanos()
DurationValuedsubsecNanos in interface DurationValuedTokenValued.isNull(),
0 is returned.DurationValued.asSeconds()public final Duration asDuration()
DurationValuedjava.time.Duration.asDuration in interface DurationValuedjava.time.Duration. 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 © 2020 Actian Corporation. All rights reserved.