Class TunnelPeerSelector.Excluder

  • All Implemented Interfaces:
    Iterable<Hash>, Collection<Hash>, Set<Hash>
    Enclosing class:
    TunnelPeerSelector

    protected class TunnelPeerSelector.Excluder
    extends ExcluderBase
    A Set of Hashes that automatically adds to the Set in the contains() check. So we don't need to generate the exclude set up front.
    Since:
    0.9.58
    • Constructor Detail

      • Excluder

        public Excluder​(boolean isInbound,
                        boolean isExploratory)
        Automatically adds selectPeersInTooManyTunnels(), unless i2np.allowLocal.
      • Excluder

        public Excluder​(boolean isInbound,
                        boolean isExploratory,
                        Set<Hash> toAdd)
        Does not add selectPeersInTooManyTunnels(). Makes a copy of toAdd
        Parameters:
        toAdd - initial contents, copied
    • Method Detail

      • contains

        public boolean contains​(Object o)
        Overridden to automatically check our exclusion criteria and add the Hash to the set if the criteria are met.
        Specified by:
        contains in interface Collection<Hash>
        Specified by:
        contains in interface Set<Hash>
        Specified by:
        contains in class ExcluderBase
        Parameters:
        o - a Hash
        Returns:
        true if peer should be excluded