java.lang.Object
net.i2p.router.tunnel.pool.TunnelPool.TunnelInfoComparator
- All Implemented Interfaces:
Serializable, Comparator<TunnelInfo>
- Enclosing class:
TunnelPool
private static class TunnelPool.TunnelInfoComparatorextends Object implements Comparator<TunnelInfo>, Serializable
Find the tunnel with the far-end that is XOR-closest to a given hash.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether zero-hop tunnels are avoided.private final byte[]Destination prefix used to match peers.private static final longFixed serial version for the inner class.Constructor Summary
ConstructorsConstructorDescriptionTunnelInfoComparator(Hash target, boolean avoidZeroHop) The sort key and zero-hop handling for this comparator.Method Summary
All MethodsModifier and TypeMethodDescriptionintcompare(TunnelInfo lhs, TunnelInfo rhs) Compare tunnels by XOR distance to the target.Methods 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
serialVersionUID
private static final long serialVersionUIDFixed serial version for the inner class.- See Also:
_base
private final byte[] _baseDestination prefix used to match peers._avoidZero
private final boolean _avoidZeroWhether zero-hop tunnels are avoided.
Constructor Details
TunnelInfoComparator
The sort key and zero-hop handling for this comparator.- Parameters:
target- key to compare distances withavoidZeroHop- if true, zero-hop tunnels will be put last
Method Details
compare
Compare tunnels by XOR distance to the target.- Specified by:
comparein interfaceComparator<TunnelInfo>