QJCC homepage

biz.chitec.quarterback.util
Class StringRepresentationComparator

java.lang.Object
  extended bybiz.chitec.quarterback.util.StringRepresentationComparator
All Implemented Interfaces:
java.util.Comparator

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

Comparator which takes the objects' toString() representation for comparation.

Version:
$Id: aa5c0a9133f1f20c40ced726147458ad9a6618bb $
Author:
chitec/Dirk Hillbrecht 2002. Distributed under the terms of the GNU LGPL.

Field Summary
private static java.util.Comparator staticinstance
          Static instance of this class which is preinitialized
 
Constructor Summary
StringRepresentationComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare method as defined by Comparator interface
 boolean equals(java.lang.Object o1)
          Equality checking.
static java.util.Comparator getStaticInstance()
          Returns a static preinitialized instance of this class.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

staticinstance

private static final java.util.Comparator staticinstance
Static instance of this class which is preinitialized

Constructor Detail

StringRepresentationComparator

public StringRepresentationComparator()
Method Detail

getStaticInstance

public static java.util.Comparator getStaticInstance()
Returns a static preinitialized instance of this class.

Returns:
The static instance.

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare method as defined by Comparator interface

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - First object
o2 - Second object
Returns:
negative if o1<o2, zero on equality, positive if o1>o2.

equals

public boolean equals(java.lang.Object o1)
Equality checking. Only true if parameter is exactly of the same class as this.

Specified by:
equals in interface java.util.Comparator
Parameters:
o1 - Object to be checked.
Returns:
Result of equality check.

QJCC homepage