Class PeriodRegister

    • Constructor Summary

      Constructors 
      Constructor Description
      PeriodRegister()
      Creates a new null-valued register.
    • Constructor Detail

      • PeriodRegister

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

      • 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
      • 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.
      • 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