com.compoze.collab
Class ItemComparator

java.lang.Object
  extended by com.compoze.collab.ItemComparator
All Implemented Interfaces
Comparator

public class ItemComparator
extends Object
implements Comparator

Comparator for arbitrary properties on items. Items are compared by one or more property values. The following sort criteria is used for each of the different property value types:

Value Type Sort Criteria
Key.VALUE_STRING Collator
Key.VALUE_SHORT Comparable
Key.VALUE_INTEGER Comparable
Key.VALUE_LONG Comparable
Key.VALUE_BOOLEAN false < true
Key.VALUE_FLOAT Comparable
Key.VALUE_DOUBLE Comparable
Key.VALUE_BINARY IllegalArgumentException
Key.VALUE_DATE Comparable
Key.VALUE_ITEM IllegalArgumentException
Key.VALUE_ENUMELEMENT Comparable
Key.VALUE_UNKNOWN Comparable or IllegalArgumentException if unknown objects do not implement Comparable
Key.VALUE_SERIALIZABLE Comparable or IllegalArgumentException if serialized objects do not implement Comparable


Constructor Summary
ItemComparator(SortProperty[] sortProps)
          Constructor (default Collator).
ItemComparator(SortProperty[] sortProps, Collator collator)
          Constructor.
 
Method Summary
 int compare(Object o1, Object o2)
           
 boolean equals(Object obj)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemComparator

public ItemComparator(SortProperty[] sortProps)
Constructor (default Collator).

Parameters
sortProps - the sort properties (not null). Properties earlier in the array have higher sort priority.

ItemComparator

public ItemComparator(SortProperty[] sortProps,
                      Collator collator)
Constructor.

Parameters
sortProps - the sort properties (not null). Properties earlier in the array have higher sort priority.
collator - the collator for comparing String values (null for default Collator)
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator
See Also
(Object, Object)

equals

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


Copyright © 2006 BEA Systems, Inc. All Rights Reserved