public final class PeriodToken extends Object implements ScalarToken, Comparable<PeriodToken>
PeriodValued object.| Modifier and Type | Field and Description |
|---|---|
static PeriodToken |
NULL
A null valued
PeriodToken |
static PeriodToken |
ZERO
A zero valued
PeriodToken |
static Period |
ZERO_VALUE
The period zero value,
0. |
| Constructor and Description |
|---|
PeriodToken(int years,
int months,
int days)
Constructs a new token with the given non-null
period value.
|
PeriodToken(Period value)
Constructs a new token with the given non-null
period value.
|
PeriodToken(PeriodValued value)
Constructs a new token with the period
value in the given container.
|
| Modifier and Type | Method and Description |
|---|---|
Period |
asPeriod()
Gets the contained Period value as a
java.time.Period. |
int |
compareTo(PeriodToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
int |
getDays()
Gets the day portion of the contained period value.
|
int |
getMonths()
Gets the month portion of the contained period value.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
int |
getYears()
Gets the year portion of the contained period value.
|
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 PeriodToken |
parse(String value)
Converts a string representation of a Period value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetType, isZeroisNullpublic static final PeriodToken NULL
PeriodTokenpublic static final Period ZERO_VALUE
0.public static final PeriodToken ZERO
PeriodTokenpublic PeriodToken(PeriodValued value)
value - a PeriodValued containing the
desired valuepublic PeriodToken(Period value)
NULL.value - the period value of the tokenpublic PeriodToken(int years,
int months,
int days)
NULL.years - the year portion of the periodmonths - the month portion of the perioddays - the day portion of the periodpublic int compareTo(PeriodToken that)
compareTo in interface Comparable<PeriodToken>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 PeriodToken parse(String value)
value - a string value to interpret as period;
see Period#parse(String)public final ScalarTokenType getType()
TokenValuedgetType in interface ScalarValuedgetType in interface TokenValuedgetType in interface ScalarTypedgetType in interface TokenTypedpublic int getYears()
PeriodValuedgetYears in interface PeriodValuedTokenValued.isNull(),
0 is returned.public int getMonths()
PeriodValuedgetMonths in interface PeriodValuedTokenValued.isNull(),
0 is returned.public int getDays()
PeriodValuedgetDays in interface PeriodValuedTokenValued.isNull(),
0 is returned.public final Period asPeriod()
PeriodValuedjava.time.Period.asPeriod in interface PeriodValuedjava.time.Period. 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.