Class PeriodRegister

java.lang.Object
com.pervasive.datarush.tokens.scalar.PeriodRegister
All Implemented Interfaces:
DataRegister, PeriodSettable, PeriodValued, ScalarRegister, ScalarSettable, ScalarValued, TokenSettable, TokenValued, ScalarTyped, TokenTyped, Serializable

public final class PeriodRegister extends Object implements ScalarRegister, PeriodSettable
A mutable PeriodValued object.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new null-valued register.
  • Method Summary

    Modifier and Type
    Method
    Description
    final Period
    Gets the contained Period value as a java.time.Period.
    int
    Gets the day portion of the contained period value.
    int
    Gets the month portion of the contained period value.
    Gets the data type of the token.
    int
    Gets the year portion of the contained period value.
    final boolean
    Indicates whether the token is null valued.
    final boolean
    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
    Sets the contained value to the given token value.
    void
    set(Period value)
    Sets the container to a period value specified as a java.time.Period object.
    void
    Sets the contained value to be null valued.
    void
    Sets the contained value to be zero valued.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.pervasive.datarush.types.ScalarTyped

    getType

    Methods inherited from interface com.pervasive.datarush.tokens.scalar.ScalarValued

    getType, isZero

    Methods inherited from interface com.pervasive.datarush.tokens.TokenValued

    isNull
  • Constructor Details

    • PeriodRegister

      public PeriodRegister()
      Creates a new null-valued register.
  • Method Details

    • setNull

      public void setNull()
      Description copied from interface: TokenSettable
      Sets the contained value to be null valued.
      Specified by:
      setNull in interface TokenSettable
    • setZero

      public void setZero()
      Description copied from interface: TokenSettable
      Sets the contained value to be zero valued.
      Specified by:
      setZero in interface TokenSettable
    • set

      public void set(int years, int months, int days)
      Description copied from interface: PeriodSettable
      Sets the container to a directed period value specified as years, months, and days.
      Specified by:
      set in interface PeriodSettable
      Parameters:
      years - number of years in period
      months - number of months in period
      days - number of days in period
    • set

      public void set(Period value)
      Description copied from interface: PeriodSettable
      Sets the container to a period value specified as a java.time.Period object.
      Specified by:
      set in interface PeriodSettable
      Parameters:
      value - period value to which to set the container
    • set

      public void set(TokenValued value)
      Description copied from interface: TokenSettable
      Sets the contained value to the given token value. The given value must have a type compatible with this object.
      Specified by:
      set in interface TokenSettable
      Parameters:
      value - the value to which to set the container
    • getType

      public final ScalarTokenType getType()
      Description copied from interface: TokenValued
      Gets the data type of the token. This type will dictate the valid values that can be contained.
      Specified by:
      getType in interface ScalarTyped
      Specified by:
      getType in interface ScalarValued
      Specified by:
      getType in interface TokenTyped
      Specified by:
      getType in interface TokenValued
      Returns:
      the token type.
    • getYears

      public int getYears()
      Description copied from interface: PeriodValued
      Gets the year portion of the contained period value.
      Specified by:
      getYears in interface PeriodValued
      Returns:
      the year portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • getMonths

      public int getMonths()
      Description copied from interface: PeriodValued
      Gets the month portion of the contained period value. This does not include the year portion.
      Specified by:
      getMonths in interface PeriodValued
      Returns:
      the month portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • getDays

      public int getDays()
      Description copied from interface: PeriodValued
      Gets the day portion of the contained period value. This does not include the year or month portion.
      Specified by:
      getDays in interface PeriodValued
      Returns:
      the day portion of the contained value If null valued, as indicated by TokenValued.isNull(), 0 is returned.
    • asPeriod

      public final Period asPeriod()
      Description copied from interface: PeriodValued
      Gets the contained Period value as a java.time.Period.
      Specified by:
      asPeriod in interface PeriodValued
      Returns:
      the contained value as a java.time.Period. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • isZero

      public final boolean isZero()
      Description copied from interface: ScalarValued
      Indicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.
      Specified by:
      isZero in interface ScalarValued
      Returns:
      true if the value is the zero value, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isNull

      public final boolean isNull()
      Description copied from interface: TokenValued
      Indicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.
      Specified by:
      isNull in interface TokenValued
      Returns:
      true if the token is null valued, false otherwise