public final class PeriodRegister extends Object implements ScalarRegister, PeriodSettable
PeriodValued
object.Constructor and Description |
---|
PeriodRegister()
Creates a new null-valued register.
|
Modifier and Type | Method and Description |
---|---|
Period |
asPeriod()
Gets the contained Period value as a
java.time.Period . |
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.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
void |
set(int years,
int months,
int days)
Sets the container to a directed period value specified as
years, months, and days.
|
void |
set(Period value)
Sets the container to a period value specified as a
java.time.Period object. |
void |
set(TokenValued value)
Sets the contained value to the given token value.
|
void |
setNull()
Sets the contained value to be null valued.
|
void |
setZero()
Sets the contained value to be zero valued.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public void setNull()
TokenSettable
setNull
in interface TokenSettable
public void setZero()
TokenSettable
setZero
in interface TokenSettable
public void set(int years, int months, int days)
PeriodSettable
set
in interface PeriodSettable
years
- number of years in periodmonths
- number of months in perioddays
- number of days in periodpublic void set(Period value)
PeriodSettable
java.time.Period
object.set
in interface PeriodSettable
value
- period value to which to set the containerpublic void set(TokenValued value)
TokenSettable
set
in interface TokenSettable
value
- the value to which to set the containerpublic final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public int getYears()
PeriodValued
getYears
in interface PeriodValued
TokenValued.isNull()
,
0
is returned.public int getMonths()
PeriodValued
getMonths
in interface PeriodValued
TokenValued.isNull()
,
0
is returned.public int getDays()
PeriodValued
getDays
in interface PeriodValued
TokenValued.isNull()
,
0
is returned.public final Period asPeriod()
PeriodValued
java.time.Period
.asPeriod
in interface PeriodValued
java.time.Period
. 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.