org.norvelle.textcite.model.sort
Class SortComparator

java.lang.Object
  extended by org.norvelle.textcite.model.sort.SortComparator
Direct Known Subclasses:
AuthorSortComparator, BookSortComparator, OutlineSortComparator, PageRefSortComparator

public abstract class SortComparator
extends java.lang.Object

The classes derived from this superclass can be used to compare two citations on a given field, and to signal listeners that the compared field is not equal (i.e. that there has been a change from, e.g. one author or one book to another between the compared Citations.


Field Summary
static int ASCENDING
           
static int DESCENDING
           
protected  int direction
           
 
Constructor Summary
SortComparator(int direction)
          The superclass constructor.
 
Method Summary
abstract  int compare(Citation citation1, Citation citation2)
           
 int getDirection()
           
abstract  void signalChange(Citation changedCitation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values

direction

protected int direction
Constructor Detail

SortComparator

public SortComparator(int direction)
The superclass constructor. Just saves the direction of the comparison.

Parameters:
direction - One of the directional values ASCENDING or DESCENDING
Method Detail

compare

public abstract int compare(Citation citation1,
                            Citation citation2)
Returns:
a negative integer, zero, or a positive integer as the first object is less than, equal to, or greater than the second object.

getDirection

public int getDirection()

signalChange

public abstract void signalChange(Citation changedCitation)