com.pallas.swing.pcombobox
Class ToStringComparator

java.lang.Object
  |
  +--com.pallas.swing.pcombobox.ToStringComparator
All Implemented Interfaces:
java.util.Comparator

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

Title: $FileName: ToStringComparator.java$

Version:
$VerNum: 2$
Author:
$AuthorName: Rob MacGrogan$

$Description: Comparator that calls toString() method on objects to sort them.$
$KeyWordsOff: $

Comparator that calls toString() method on objects to sort them.

Field Summary
private  boolean invert
           
 
Constructor Summary
ToStringComparator()
          Sorts in alphabetical order if this constructor is used.
ToStringComparator(boolean invert)
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
static boolean firstStringSortsBeforeSecond(java.lang.String sOne, java.lang.String sTwo, boolean invert)
           
 
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

invert

private boolean invert
Constructor Detail

ToStringComparator

public ToStringComparator()
Sorts in alphabetical order if this constructor is used.


ToStringComparator

public ToStringComparator(boolean invert)
Parameters:
invert - -- if true, sorts in reverse alphabetical order. If false, sorts in alphabetical order.
Method Detail

compare

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

firstStringSortsBeforeSecond

public static boolean firstStringSortsBeforeSecond(java.lang.String sOne,
                                                   java.lang.String sTwo,
                                                   boolean invert)


Copyright 2003 Pallas Technology.