prefuse.util.collections
Class DefaultLiteralComparator

java.lang.Object
  extended by prefuse.util.collections.DefaultLiteralComparator
All Implemented Interfaces:
java.util.Comparator, LiteralComparator

public class DefaultLiteralComparator
extends java.lang.Object
implements LiteralComparator

Default LiteralComparator implementation that uses the natural ordering of all data types for comparing values. Object values will need to implement the Comparable interface.

Author:
jeffrey heer

Constructor Summary
DefaultLiteralComparator()
           
 
Method Summary
 int compare(boolean x1, boolean x2)
           
 int compare(byte x1, byte x2)
           
 int compare(double x1, double x2)
           
 int compare(float x1, float x2)
           
 int compare(int x1, int x2)
           
 int compare(long x1, long x2)
           
 int compare(java.lang.Object o1, java.lang.Object o2)
           
static DefaultLiteralComparator getInstance()
          Returns an instance of this comparator.
 
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

DefaultLiteralComparator

public DefaultLiteralComparator()
Method Detail

getInstance

public static DefaultLiteralComparator getInstance()
Returns an instance of this comparator.

Returns:
a DefaultLiteralComparator

compare

public int compare(byte x1,
                   byte x2)
Specified by:
compare in interface LiteralComparator
See Also:
LiteralComparator.compare(byte, byte)

compare

public int compare(int x1,
                   int x2)
Specified by:
compare in interface LiteralComparator
See Also:
LiteralComparator.compare(int, int)

compare

public int compare(long x1,
                   long x2)
Specified by:
compare in interface LiteralComparator
See Also:
LiteralComparator.compare(long, long)

compare

public int compare(float x1,
                   float x2)
Specified by:
compare in interface LiteralComparator
See Also:
LiteralComparator.compare(float, float)

compare

public int compare(double x1,
                   double x2)
Specified by:
compare in interface LiteralComparator
See Also:
LiteralComparator.compare(double, double)

compare

public int compare(boolean x1,
                   boolean x2)
Specified by:
compare in interface LiteralComparator
See Also:
LiteralComparator.compare(boolean, boolean)

compare

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


Copyright © 2007 Regents of the University of California