sos.dated.util
Interface DateIterator


public interface DateIterator

An iterator of ordered, non-overlapping date ranges. This iterator behaves similarly to java.util.ListIterator. The implicit cursor of the iterator is always between date ranges. Calls to nextFrom and nextTo return the dates of the range immediately ahead or the cursor, while calls to previousFrom and previousTo return the dates of the range immediately behind the cursor. These calls return null if the cursor is at the end of the sequence. The "from" date is always inclusive, while the "to" date is always exclusive.

Since:
1.0

Method Summary
 boolean hasNext()
          Indicates if this iterator has a next date range to report.
 boolean hasPrevious()
          Indicates if this iterator has a previous date range to report.
 void next()
          Advances this iterator to the next date range in the sequence.
 java.util.Date nextFrom()
          Returns the starting date of the next date range.
 java.util.Date nextTo()
          Returns the ending date of the next date range.
 void previous()
          Advances this iterator to the previous date range in the sequence.
 java.util.Date previousFrom()
          Returns the starting date of the preceding date range.
 java.util.Date previousTo()
          Returns the ending date of the preceding date range.
 

Method Detail

hasNext

public boolean hasNext()
Indicates if this iterator has a next date range to report.

Returns:
true if this iterator has a next date range to report

hasPrevious

public boolean hasPrevious()
Indicates if this iterator has a previous date range to report.

Returns:
true if this iterator has a previous date range to report

next

public void next()
Advances this iterator to the next date range in the sequence.

Throws:
java.util.ConcurrentModificationException - if the underlying dates have potentially changed (optional)
java.util.NoSuchElementException - if the iterator is currently positioned after the last date range in the sequence

nextFrom

public java.util.Date nextFrom()
Returns the starting date of the next date range.

Returns:
the starting date of the next date range

nextTo

public java.util.Date nextTo()
Returns the ending date of the next date range.

Returns:
the ending date of the next date range, or null if the iterator is at the end of the sequence

previous

public void previous()
Advances this iterator to the previous date range in the sequence.

Throws:
java.util.ConcurrentModificationException - if the underlying dates have potentially changed (optional)
java.util.NoSuchElementException - if the iterator is currently positioned before the first date range in the sequence

previousFrom

public java.util.Date previousFrom()
Returns the starting date of the preceding date range.

Returns:
the starting date of the preceding date range, or null if the iterator is at the beginning of the sequence

previousTo

public java.util.Date previousTo()
Returns the ending date of the preceding date range.

Returns:
the ending date of the preceding date range


Copyright 2003 Side of Software (SOS). All rights reserved.