uk.ac.ebi.intact.util
Class ShortLabelComparator

java.lang.Object
  |
  +--uk.ac.ebi.intact.util.ShortLabelComparator
All Implemented Interfaces:
java.util.Comparator

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

This class provides a specific Comparator for use with AnnotatedObjects. The comparison is done on short labels, and is a typical String comparison. Common use of this class is for sorting AnnotatedObjects.

Author:
Chris Lewington

Constructor Summary
ShortLabelComparator()
           
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
          This method compares the two object parameters based on their short label values.
 
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

ShortLabelComparator

public ShortLabelComparator()
Method Detail

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
This method compares the two object parameters based on their short label values. The comparison is not case-sensitive.

Specified by:
compare in interface java.util.Comparator
Parameters:
obj1 -
obj2 -
Returns:
int -1 if obj1 is less than obj2, 0 if they are equal and 1 if obj1 is greater than obj2.
Throws:
java.lang.ClassCastException - thrown if the arguments are not AnnotatedObjects.
java.lang.NullPointerException - if either or both arguments have no shortLabel set.


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk