public final class TimeToken extends Object implements ScalarToken, Comparable<TimeToken>
TimeValued
object.Modifier and Type | Field and Description |
---|---|
static int |
MAX_DAY_OFFSET |
static int |
MIN_DAY_OFFSET |
static TimeToken |
NULL
A null valued
TimeToken |
static TimeToken |
ZERO
A zero valued
TimeToken |
static int |
ZERO_VALUE
The time representing a zero value, midnight.
|
Constructor and Description |
---|
TimeToken(int dayMillis)
Constructs a new token with the non-null time value
specified as the number of milliseconds since midnight.
|
TimeToken(int hourOfDay,
int minuteOfHour,
int secondOfMinute)
Constructs a new token with the non-null time of day.
|
TimeToken(int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int subsecMillis)
Constructs a new token with the non-null time of day.
|
TimeToken(TimeOfDay time)
Constructs a new token with the non-null time of day.
|
TimeToken(TimeValued value)
Constructs a new token with the time
value in the given container.
|
Modifier and Type | Method and Description |
---|---|
int |
asDayMillis()
Gets the contained time value as the number of milliseconds
elapsed since midnight.
|
TimeOfDay |
asTimeOfDay()
Gets the contained time value.
|
int |
compareTo(TimeToken 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 TimeToken |
parse(String value)
Converts a string representation of a time value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getType, isZero
isNull
public static final TimeToken NULL
TimeToken
public static final int ZERO_VALUE
public static final TimeToken ZERO
TimeToken
public static final int MIN_DAY_OFFSET
public static final int MAX_DAY_OFFSET
public TimeToken(TimeValued value)
value
- a TimeValued
containing the
desired valuepublic TimeToken(int dayMillis)
NULL
.dayMillis
- the time value of the token, expressed as the
number milliseconds elapsed since midnightpublic TimeToken(int hourOfDay, int minuteOfHour, int secondOfMinute)
NULL
.hourOfDay
- the hour portion of the time. Hours are expressed
in 24-hour format, ranging from 0 to 23.minuteOfHour
- the minute portion of the timesecondOfMinute
- the seconds portion of the timepublic TimeToken(int hourOfDay, int minuteOfHour, int secondOfMinute, int subsecMillis)
NULL
.hourOfDay
- the hour portion of the time. Hours are expressed
in 24-hour format, ranging from 0 to 23.minuteOfHour
- the minute portion of the timesecondOfMinute
- the seconds portion of the timesubsecMillis
- the milliseconds portion of the timepublic 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 int compareTo(TimeToken that)
compareTo
in interface Comparable<TimeToken>
public static TimeToken parse(String value)
value
- a string value to interpret as a time;
this must be in ISO8601 format.public final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final int asDayMillis()
TimeValued
asDayMillis
in interface TimeValued
TokenValued.isNull()
,
0
is returned.public final TimeOfDay asTimeOfDay()
TimeValued
asTimeOfDay
in interface TimeValued
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.