cbr.service
Class DistanceComparator

java.lang.Object
  extended bycbr.service.DistanceComparator
All Implemented Interfaces:
Comparator

public class DistanceComparator
extends Object
implements Comparator

A comparator that compares two picture entries according to their stored distances.

Version:
"$Id: DistanceComparator.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Volker Roth

Constructor Summary
DistanceComparator()
          Creates a new instance.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares two picture entries according to the distances stored in them.
 
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

DistanceComparator

public DistanceComparator()
Creates a new instance.

Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares two picture entries according to the distances stored in them. The result is -1, 0, or 1 if the distance of o1 is smaller than, equal to, or greater than the one of o2.

If o1 or o2 is not a PictureEntry then a ClassCastException is thrown.

Specified by:
compare in interface Comparator
Parameters:
o1 - The first PictureEntry.
o2 - The second PictureEntry.
Returns:
Either -1, 0, or 1 depending on the result of the comparison.
Throws:
ClassCastException - if o1 or o2 is not a PictureEntry


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.