org.planx.routing.kademlia
Class Node.DistanceComparator
java.lang.Object
org.planx.routing.kademlia.Node.DistanceComparator
- All Implemented Interfaces:
- Comparator<Node>
- Enclosing class:
- Node
public static class Node.DistanceComparator
- extends Object
- implements Comparator<Node>
A DistanceComparator is capable of comparing Node objects according to
closeness to a predetermined identifier using the XOR metric.
|
Method Summary |
int |
compare(Node n1,
Node n2)
Compare two objects which must both be of type Node
and determine which is closest to the identifier specified in the
constructor. |
Node.DistanceComparator
public Node.DistanceComparator(Identifier relId)
- The identifier relative to which the distance should be measured.
compare
public int compare(Node n1,
Node n2)
- Compare two objects which must both be of type
Node
and determine which is closest to the identifier specified in the
constructor.
- Specified by:
compare in interface Comparator<Node>
Copyright © 2004-2005 Plan-X. All Rights Reserved.