jasi.sim.geo.cartesian
Class SpaceVec.Distance

java.lang.Object
  extended by jasi.sim.geo.cartesian.SpaceVec.Distance
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<SpaceVec>
Enclosing class:
SpaceVec

public static final class SpaceVec.Distance
extends java.lang.Object
implements java.util.Comparator<SpaceVec>, java.io.Serializable

Distance function, which imposes a total ordering of space vectors by comparing the distance to a center.

See Also:
Serialized Form

Constructor Summary
SpaceVec.Distance(SpaceVec center)
          Constructor of this distance comparator.
 
Method Summary
 int compare(SpaceVec s1, SpaceVec s2)
          Compares its two arguments for order.
 
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

SpaceVec.Distance

public SpaceVec.Distance(SpaceVec center)
Constructor of this distance comparator.

Parameters:
center - The center of the distances.
Method Detail

compare

public int compare(SpaceVec s1,
                   SpaceVec s2)
Compares its two arguments for order.

Specified by:
compare in interface java.util.Comparator<SpaceVec>
Parameters:
s1 - The first object to be compared.
s2 - The second object to be compared.
Returns:
A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.