java.lang.Object
net.i2p.kademlia.XORComparator<T>
- Type Parameters:
T- type of SimpleDataStructure objects being compared
- All Implemented Interfaces:
Serializable, Comparator<T>
public class XORComparator<T extends SimpleDataStructure>extends Object implements Comparator<T>, Serializable
Help sort Hashes in relation to a base key using the XOR metric.
- See Also:
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
All MethodsMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, max, min, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Field Details
_base
private final byte[] _baseKey to compare distances with.
Constructor Details
XORComparator
Create a comparator with the given target key.- Parameters:
target- key to compare distances with
Method Details
compare
Compare two entries by XOR distance to the base key.- Specified by:
comparein interfaceComparator<T extends SimpleDataStructure>