com.faunos.util.dim.line
Class RangeComparator

java.lang.Object
  extended by com.faunos.util.dim.line.RangeComparator
All Implemented Interfaces:
Comparator<Range>

public class RangeComparator
extends Object
implements Comparator<Range>

A simple Range comparator based on the range's low value.

Note: this comparator imposes orderings that are generally inconsistent with equals. Whether or not it does depends on implementation of Range.

Author:
Babak Farhang

Field Summary
static RangeComparator INSTANCE
          Ready-made instance.
 
Constructor Summary
RangeComparator()
           
 
Method Summary
 int compare(Range r1, Range r2)
          Compares the two given ranges by comparing their low values.
 boolean equals(Object obj)
          Returns true if and only if the given object's class is the same as that of this instance.
 int hashCode()
          Returns this instance's hash code.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final RangeComparator INSTANCE
Ready-made instance. Instances of the base class are both stateless, and thread-safe.

Constructor Detail

RangeComparator

public RangeComparator()
Method Detail

compare

public int compare(Range r1,
                   Range r2)
Compares the two given ranges by comparing their low values.

Specified by:
compare in interface Comparator<Range>
See Also:
Range.lo()

equals

public boolean equals(Object obj)
Returns true if and only if the given object's class is the same as that of this instance.

Specified by:
equals in interface Comparator<Range>
Overrides:
equals in class Object
See Also:
hashCode()

hashCode

public int hashCode()
Returns this instance's hash code.

Overrides:
hashCode in class Object
See Also:
equals(Object), Object.equals(Object), Object.hashCode()


SourceForge.net Logo