org.sakaiproject.util
Class ContentHostingComparator

java.lang.Object
  extended byorg.sakaiproject.util.ContentHostingComparator
All Implemented Interfaces:
Comparator

public class ContentHostingComparator
extends Object
implements Comparator

ContentHostingComparator can be used to sort stuff (collections, resources) from the content hosting service.

Version:
$Revision: 2371 $
Author:
University of Michigan, CHEF Software Development Team

Constructor Summary
ContentHostingComparator(String property, boolean ascending)
          Construct.
 
Method Summary
 int compare(Object o1, Object o2)
          Compare these objects based on my property and ascending settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ContentHostingComparator

public ContentHostingComparator(String property,
                                boolean ascending)
Construct.

Parameters:
property - The property name used for the sort.
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compare these objects based on my property and ascending settings. Collections sort lower than Resources.

Specified by:
compare in interface Comparator
Parameters:
o1 - The first object, ContentCollection or ContentResource
o2 - The second object, ContentCollection or ContentResource
Returns:
The compare result: -1 if o1 < o2, 0 if they are equal, and 1 if o1 > o2