java.lang.Object
net.i2p.router.networkdb.kademlia.StoreJob.LeaseComparator
- All Implemented Interfaces:
Serializable, Comparator<Lease>
- Enclosing class:
StoreJob
private static class StoreJob.LeaseComparatorextends Object implements Comparator<Lease>, Serializable
Compare leases by XOR distance to a target hash.
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[] _baseThe target hash for distance comparison.
Constructor Details
LeaseComparator
Create a comparator for a target hash.- Parameters:
target- key to compare distances with
Method Details
compare
Compare two leases by XOR distance to the target.- Specified by:
comparein interfaceComparator<Lease>- Parameters:
lhs- first lease to comparerhs- second lease to compare- Returns:
- negative if lhs is closer, positive if rhs is closer, 0 if equal