Module inet.ipaddr

Interface AddressTrieOps.AddressTrieAddOps<E extends Address>

Type Parameters:
E -
All Superinterfaces:
AddressTrieOps<E>, Cloneable, Iterable<E>, Serializable, TreeOps<E>
All Known Implementing Classes:
AddressTrie, AssociativeAddressTrie, IPv4AddressAssociativeTrie, IPv4AddressTrie, IPv6AddressAssociativeTrie, IPv6AddressTrie, MACAddressAssociativeTrie, MACAddressTrie
Enclosing interface:
AddressTrieOps<E extends Address>

public static interface AddressTrieOps.AddressTrieAddOps<E extends Address> extends AddressTrieOps<E>
Provides an interface to the trie add operations.

Operations which take an address as an argument require that the address is an individual address or prefix block.

Author:
scfoley
  • Method Details

    • add

      boolean add(E addr)
      Adds the given single address or prefix block subnet to the trie.

      If the given address is not a single address nor prefix block, then this method throws IllegalArgumentException.

      If not a single address nor prefix block, the Partition class can be used to convert the address before calling this method. Given a subnet s of type E and a trie of type AddressTrie<E>, such as IPv4Address and IPv4AddressTrie, you can convert and add the spanning prefix blocks with Partition.partitionWithSpanningBlocks(s).predicateForEach(trie::add), or you can convert and add using a single max block size with Partition.partitionWithSingleBlockSize(s).predicateForEach(trie::add).

      Returns true if the prefix block or address was inserted, false if already in the trie.

      Parameters:
      addr -
      Returns:
    • addNode

      AddressTrie.TrieNode<E> addNode(E addr)
      Adds the given single address or prefix block subnet to the trie, if not already there.

      If the given address is not a single address nor prefix block, then this method throws IllegalArgumentException.

      If not a single address nor prefix block, the Partition class can be used to convert the address before calling this method. See add(Address) for more details.

      Returns the node for the added address, whether it was already in the trie or not.

      If you wish to know whether the node was already there when adding, use add(Address), or before adding you can use AddressTrieOps.getAddedNode(Address)

      Parameters:
      addr -
      Returns:
    • addTrie

      Adds nodes matching the given sub-root node and all of its sub-nodes to the trie, if not already there.

      For each added in the given node that does not exist in the trie, a copy of each node will be made that matches the trie type (associative or not), and the copy will be inserted into the trie.

      The node type need not match the node type of the trie, although the address type/version E must match. You can add associative nodes to tries with this method but associated values will all be null. If you want to preserve the values, use AddressTrieOps.AssociativeAddressTriePutOps.putTrie(AssociativeTrieNode) instead.

      When adding one trie to another, this method is more efficient than adding each node of the first trie individually. When using this method, searching for the location to add sub-nodes starts from the inserted parent node.

      Returns the node corresponding to the given sub-root node, whether it was already in the trie or not.

      Parameters:
      trie -
      Returns: