Class PeriodList

    • Constructor Detail

      • PeriodList

        public PeriodList()
        Default constructor.
      • PeriodList

        public PeriodList​(boolean utc)
        Parameters:
        utc - indicates whether the period list is in UTC time
      • PeriodList

        public PeriodList​(boolean utc,
                          boolean unmodifiable)
        Parameters:
        utc - indicates whether the period list is in UTC time
      • PeriodList

        public PeriodList​(String aValue)
                   throws ParseException
        Parses the specified string representation to create a list of periods.
        Parameters:
        aValue - a string representation of a list of periods
        Throws:
        ParseException - thrown when an invalid string representation of a period list is specified
    • Method Detail

      • normalise

        public final PeriodList normalise()
        Returns a normalised version of this period list. Normalisation includes combining overlapping periods, removing periods contained by other periods, combining adjacent periods, and removing periods that consume no time. NOTE: If the period list is already normalised then this period list is returned.
        Returns:
        a period list
      • add

        public final PeriodList add​(PeriodList periods)
        A convenience method that combines all the periods in the specified list to this list. The result returned is a new PeriodList instance, except where no periods are specified in the arguments. In such cases this instance is returned. Normalisation is also performed automatically after all periods have been added.
        Parameters:
        periods - a list of periods to add
        Returns:
        a period list instance
      • subtract

        public final PeriodList subtract​(PeriodList subtractions)
        Subtracts the intersection of this list with the specified list of periods from this list and returns the results as a new period list. If no intersection is identified this list is returned.
        Parameters:
        subtractions - a list of periods to subtract from this list
        Returns:
        a period list
      • isUtc

        public final boolean isUtc()
        Indicates whether this list is in local or UTC format.
        Returns:
        Returns true if in UTC format, otherwise false.
      • isUnmodifiable

        public boolean isUnmodifiable()
      • setUtc

        public final void setUtc​(boolean utc)
        Sets whether this list is in UTC or local time format.
        Parameters:
        utc - The utc to set.
      • setTimeZone

        public final void setTimeZone​(TimeZone timeZone)
        Applies the specified timezone to all dates in the list. All dates added to this list will also have this timezone applied.
        Parameters:
        timeZone - the timezone for the period list
      • getTimeZone

        public final TimeZone getTimeZone()
        Returns:
        Returns the timeZone.