com.ibm.tivoli.maximo.util

Class IterableDateRange

  • java.lang.Object
    • com.ibm.tivoli.maximo.util.IterableDateRange
  • All Implemented Interfaces:
    java.lang.Iterable, java.util.Iterator


    public class IterableDateRange
    extends java.lang.Object
    implements java.lang.Iterable, java.util.Iterator
    This is both an Iterator and Iterable for Range items. You give it a List of Date objects and this iterator will expose them as Range objects for stand and end ranges. (ie, every Pair of dates is Range, provided they are within the start/end inclusion initial range. if you use "shiftDates=true" then it will skip the first date, create a rang pattern that basically goes from the end of the first range pair to the start of the next pair.
    • Constructor Summary

      Constructors 
      Constructor and Description
      IterableDateRange(java.util.Collection dates, boolean shiftDates)
      Lists of dates to put into the Iterator.
      IterableDateRange(java.util.Iterator availCalInfoIterator, boolean shiftDates)
      Lists of dates to put into the Iterator.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean hasNext() 
      java.util.Iterator iterator() 
      Range next()
      the Range object is reused for each .next() operation.
      void remove() 
      void returnPosition() 
      static java.util.List toDateList(java.util.Collection dates)
      Turns a collection of DateRange items into a Collection of Dates
      static java.util.List toDateRangeList(java.util.Collection dates, boolean shift) 
      static java.util.Set toDateRangeSet(java.util.Collection dates, boolean shift)
      Given the list of Dates return an Ordered Set of Date Ranges
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • IterableDateRange

        public IterableDateRange(java.util.Iterator availCalInfoIterator,
                                 boolean shiftDates)
        Lists of dates to put into the Iterator.
        Parameters:
        dates -
        shiftDates - if true, the first date is skipped to create an offset pattern
      • IterableDateRange

        public IterableDateRange(java.util.Collection dates,
                                 boolean shiftDates)
        Lists of dates to put into the Iterator.
        Parameters:
        dates -
        shiftDates - if true, the first date is skipped to create an offset pattern
    • Method Detail

      • iterator

        public java.util.Iterator iterator()
        Specified by:
        iterator in interface java.lang.Iterable
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator
      • next

        public Range next()
        the Range object is reused for each .next() operation. If you need to hold onto the Range value, then use the Range.copy() to create a copy of the range.
        Specified by:
        next in interface java.util.Iterator
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator
      • toDateRangeList

        public static java.util.List toDateRangeList(java.util.Collection dates,
                                                     boolean shift)
      • returnPosition

        public void returnPosition()
      • toDateList

        public static java.util.List toDateList(java.util.Collection dates)
        Turns a collection of DateRange items into a Collection of Dates
        Parameters:
        dates -
        Returns:
      • toDateRangeSet

        public static java.util.Set toDateRangeSet(java.util.Collection dates,
                                                   boolean shift)
        Given the list of Dates return an Ordered Set of Date Ranges
        Parameters:
        dates -
        shift -
        Returns: