net.sf.statcvs.model
Class RevisionSortIterator

java.lang.Object
  |
  +--net.sf.statcvs.model.ListRevisionIterator
        |
        +--net.sf.statcvs.model.RevisionSortIterator
All Implemented Interfaces:
RevisionIterator

public class RevisionSortIterator
extends ListRevisionIterator

Sorts the output of a given RevisionIterator by date, starting with the oldest revision. This is achieved by caching the output of the source iterator.

Version:
$Id: RevisionSortIterator.java,v 1.13 2003/03/18 10:33:54 lukasz Exp $
Author:
Richard Cyganiak

Field Summary
static int ORDER_ASC
          constant for descending sort order to be used in RevisionSortIterator(RevisionIterator, int)
static int ORDER_DESC
          constant for ascending sort order to be used in RevisionSortIterator(RevisionIterator, int)
 
Constructor Summary
RevisionSortIterator(java.util.List revisions)
          Returns a new instance which sorts a List of revisions by date, starting with oldest.
RevisionSortIterator(RevisionIterator source)
          Creates a new iterator from a source iterator.
RevisionSortIterator(RevisionIterator source, int order)
          Creates a new iterator from a source iterator.
 
Methods inherited from class net.sf.statcvs.model.ListRevisionIterator
getList, hasNext, initList, initListFromIterator, next, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORDER_ASC

public static final int ORDER_ASC
constant for descending sort order to be used in RevisionSortIterator(RevisionIterator, int)

See Also:
Constant Field Values

ORDER_DESC

public static final int ORDER_DESC
constant for ascending sort order to be used in RevisionSortIterator(RevisionIterator, int)

See Also:
Constant Field Values
Constructor Detail

RevisionSortIterator

public RevisionSortIterator(RevisionIterator source)
Creates a new iterator from a source iterator. The new iterator will return all CvsRevision objects of the source, but sorted by date, starting with oldest.

Parameters:
source - the source iterator to be sorted by date.

RevisionSortIterator

public RevisionSortIterator(RevisionIterator source,
                            int order)
Creates a new iterator from a source iterator. The new iterator will return all CvsRevision objects of the source, but sorted by date. The sort order can be specified.

Parameters:
source - the source iterator to be sorted by date.
order - one of ORDER_ASC or ORDER_DESC

RevisionSortIterator

public RevisionSortIterator(java.util.List revisions)
Returns a new instance which sorts a List of revisions by date, starting with oldest.

Parameters:
revisions - a list of revisions