Side of Software
Dated Collections Library 2.0

sos.dated.util
Interface DateIterator<D>

Type Parameters:
D - the type of dates being iterated over

public interface DateIterator<D>

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.
 D nextFrom()
          Returns the starting date of the next date range.
 D nextTo()
          Returns the ending date of the next date range.
 void previous()
          Advances this iterator to the previous date range in the sequence.
 D previousFrom()
          Returns the starting date of the preceding date range.
 D previousTo()
          Returns the ending date of the preceding date range.
 

Method Detail

hasNext

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

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

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

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

nextFrom

D nextFrom()
Returns the starting date of the next date range.

Returns:
the starting date of the next date range

nextTo

D 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

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

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

previousFrom

D 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

D previousTo()
Returns the ending date of the preceding date range.

Returns:
the ending date of the preceding date range

Side of Software
Dated Collections Library 2.0

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