blackboard.platform.plugin
Class PlugInComparator

java.lang.Object
  extended by blackboard.platform.plugin.PlugInComparator
All Implemented Interfaces:
java.util.Comparator

public class PlugInComparator
extends java.lang.Object
implements java.util.Comparator

Comparator implementation to sort lists of PlugIns. The mode property is used to select the PlugIn attribute to use for the sort.

Since:
Blackboard 6
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Field Summary
static int MODE_AVAILABILITY
          PlugIns are compared based on the isAvailable attribute
static int MODE_NAME
          PlugIn objects are compared based on the name attribute
static int MODE_VENDOR
          PlugIns are compared on the vendorName attribute
static int MODE_VERSION
          PlugIns are compared on the Version attribute
static int MODE_WEBAPP_TYPE
          PlugIns are compared on the webAppType attribute
 
Constructor Summary
PlugInComparator(int mode)
          Instantiates a comparator with the specified mode.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares its two arguments for order.
 
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
 

Field Detail

MODE_NAME

public static final int MODE_NAME
PlugIn objects are compared based on the name attribute

See Also:
Constant Field Values

MODE_AVAILABILITY

public static final int MODE_AVAILABILITY
PlugIns are compared based on the isAvailable attribute

See Also:
Constant Field Values

MODE_VERSION

public static final int MODE_VERSION
PlugIns are compared on the Version attribute

See Also:
Constant Field Values

MODE_VENDOR

public static final int MODE_VENDOR
PlugIns are compared on the vendorName attribute

See Also:
Constant Field Values

MODE_WEBAPP_TYPE

public static final int MODE_WEBAPP_TYPE
PlugIns are compared on the webAppType attribute

See Also:
Constant Field Values
Constructor Detail

PlugInComparator

public PlugInComparator(int mode)
Instantiates a comparator with the specified mode.

Parameters:
mode - Comparison mode. Should match to one of the MODE_* constants defined on this class
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Behavior depends on the mode

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - the first object to be compared.
o2 - the second object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Throws:
java.lang.ClassCastException - if the arguments' types prevent them from being compared by this Comparator.


Copyright © 2003 Blackboard, Inc. All Rights Reserved.