org.norvelle.textcite.model
Class CitationSet

java.lang.Object
  extended by org.norvelle.textcite.model.CitationSet

public class CitationSet
extends java.lang.Object

A CitationSet holds an ordered set of Citations, that can be iterated over. It can hold sub-sets, each of which can provide a header. It can be generated by providing an Iterator to the constructor, or by using the add() method to add Citations one by one


Constructor Summary
CitationSet()
          Creates an empty CitationSet, to which Citations can be added by the add() method, preserving the order in which they are added.
CitationSet(java.util.Iterator iterator)
          This constructor is used to create a CitationSet containing all of the Citations from the CiteBook, via an Iterator directly.
 
Method Summary
 void add(Citation citation)
          Add a Citation to the CitationSet, preserving the current order of elements
 Citation getNextCitation()
          Returns the next Citation in the currently sorted CitationSet.
 int getSize()
           
 boolean hasNext()
          Returns true if there is at least one more Citation left in the CitationSet
 void setComparators(java.util.Vector comparators)
          Sets the Comparators to be used in sorting.
 void sort()
          Perform a sort of the CitationSet, according to the Commparators currently registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CitationSet

public CitationSet(java.util.Iterator iterator)
This constructor is used to create a CitationSet containing all of the Citations from the CiteBook, via an Iterator directly. Builds a Vector out of the given Iterator, retaining the order of elements in the original Iterator.


CitationSet

public CitationSet()
Creates an empty CitationSet, to which Citations can be added by the add() method, preserving the order in which they are added.

Method Detail

getSize

public int getSize()

getNextCitation

public Citation getNextCitation()
Returns the next Citation in the currently sorted CitationSet. Also notifies listeners when there has been a change in one of the fields, in comparison with the prior Citation.

Returns:
Returns the next Citation in the CitationSet, null if there is none left.

hasNext

public boolean hasNext()
Returns true if there is at least one more Citation left in the CitationSet


add

public void add(Citation citation)
Add a Citation to the CitationSet, preserving the current order of elements

Parameters:
citation -

setComparators

public void setComparators(java.util.Vector comparators)
Sets the Comparators to be used in sorting. The order of the Comparators in the Vector indicates their precedence in the sort.

Parameters:
comparators - A Vector of Comparator objects

sort

public void sort()
Perform a sort of the CitationSet, according to the Commparators currently registered. If there are no Comparators registered, retains the current ordering.