Compoze Software, Inc.

com.compoze.collab
Class Sort

java.lang.Object
  |
  +--com.compoze.collab.Sort
All Implemented Interfaces:
com.compoze.collab.util.IDigestSupport, java.io.Serializable

public class Sort
extends java.lang.Object
implements java.io.Serializable, com.compoze.collab.util.IDigestSupport

Represents a list of fields to sort on, with the earlier properties having higher sort priority.

See Also:
Serialized Form

Constructor Summary
Sort()
          Constructs an empty Sort.
Sort(SortProperty field)
          Constructs a Sort with one field.
Sort(SortProperty[] fields)
          Constructs a Sort with multiple fields.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.Comparator getComparator()
          Creates a comparator that can sort items based on this sort.
 java.util.Comparator getComparator(java.text.Collator collator)
          Creates a comparator that can sort items based on this sort.
 int getFieldCount()
          Get the number of fields in this Sort.
 int hashCode()
           
 boolean isEmpty()
          Determines if the sort contains no sort fields.
 void sortItemArray(IItem[] itemArray)
          Sorts an array of items based on this sort.
 void sortItemArray(IItem[] itemArray, java.text.Collator collator)
          Sorts an array of items based on this sort.
 void sortItemList(java.util.List itemList)
          Sorts a list of items based on this sort.
 void sortItemList(java.util.List itemList, java.text.Collator collator)
          Sorts a list of items based on this sort.
 SortProperty[] toArray()
          Gets an array representing the fields of this Sort.
 java.lang.String toString()
           
 void updateDigest(java.security.MessageDigest digest)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sort

public Sort()
Constructs an empty Sort.

Sort

public Sort(SortProperty[] fields)
Constructs a Sort with multiple fields.
Parameters:
fields - the fields to sort on; earlier ones have higher priority (not null)

Sort

public Sort(SortProperty field)
Constructs a Sort with one field.
Parameters:
field - the sort field (not null)
Method Detail

getComparator

public java.util.Comparator getComparator()
Creates a comparator that can sort items based on this sort.
Returns:
the comparator (not null)
See Also:
ItemComparator.ItemComparator(SortProperty[])

getComparator

public java.util.Comparator getComparator(java.text.Collator collator)
Creates a comparator that can sort items based on this sort.
Parameters:
collator - the Collator to use for String comparisons (null for the default Collator)
Returns:
the comparator (not null)
See Also:
ItemComparator.ItemComparator(SortProperty[])

sortItemList

public void sortItemList(java.util.List itemList)
Sorts a list of items based on this sort.
Parameters:
itemList - the list of items to sort (not null)
See Also:
getComparator()

sortItemList

public void sortItemList(java.util.List itemList,
                         java.text.Collator collator)
Sorts a list of items based on this sort.
Parameters:
itemList - the list of items to sort (not null)
collator - the Collator to use for String comparisons (null for the default Collator)
See Also:
getComparator()

sortItemArray

public void sortItemArray(IItem[] itemArray)
Sorts an array of items based on this sort.
Parameters:
itemArray - the array of items to sort (not null)
See Also:
getComparator(), (Object[], Comparator)

sortItemArray

public void sortItemArray(IItem[] itemArray,
                          java.text.Collator collator)
Sorts an array of items based on this sort.
Parameters:
itemArray - the array of items to sort (not null)
collator - the Collator to use for String comparisons (null for the default Collator)
See Also:
getComparator(), (Object[], Comparator)

toArray

public SortProperty[] toArray()
Gets an array representing the fields of this Sort.
Returns:
an array of SortProperty (not null)

getFieldCount

public int getFieldCount()
Get the number of fields in this Sort.
Returns:
the number of SortPropertys in this Sort

isEmpty

public boolean isEmpty()
Determines if the sort contains no sort fields.
Returns:
true if the sort contains no sort fields

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

updateDigest

public void updateDigest(java.security.MessageDigest digest)
Specified by:
updateDigest in interface com.compoze.collab.util.IDigestSupport

Compoze Software, Inc.

Copyright ©1999-2005 Compoze Software, Inc. All rights reserved.