com.compoze.collab
Class Sort

java.lang.Object
  extended by com.compoze.collab.Sort
All Implemented Interfaces
IDigestSupport, Serializable

public class Sort
extends Object
implements Serializable, 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(Object obj)
           
 Comparator getComparator()
          Creates a comparator that can sort items based on this sort.
 Comparator getComparator(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, Collator collator)
          Sorts an array of items based on this sort.
 void sortItemList(List itemList)
          Sorts a list of items based on this sort.
 void sortItemList(List itemList, Collator collator)
          Sorts a list of items based on this sort.
 SortProperty[] toArray()
          Gets an array representing the fields of this Sort.
 String toString()
           
 void updateDigest(MessageDigest digest)
          Updates the specified MessageDigest with the object's internal state.
 
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 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 Comparator getComparator(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(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(List itemList,
                         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,
                          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(Object obj)
Overrides:
equals in class Object
See Also
Object.equals(java.lang.Object)

hashCode

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

toString

public String toString()
Overrides:
toString in class Object

updateDigest

public void updateDigest(MessageDigest digest)
Description copied from interface: IDigestSupport
Updates the specified MessageDigest with the object's internal state.

Specified by:
updateDigest in interface IDigestSupport
Parameters
digest - the digest to update (not null)


Copyright © 2006 BEA Systems, Inc. All Rights Reserved