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>
Operations which take an address as an argument require that the address is an individual address or prefix block.
- Author:
- scfoley
-
Nested Class Summary
Nested classes/interfaces inherited from interface inet.ipaddr.format.util.AddressTrieOps
AddressTrieOps.AddressTrieAddOps<E extends Address>, AddressTrieOps.AssociativeAddressTrieOps<K extends Address,
V>, AddressTrieOps.AssociativeAddressTriePutOps<K extends Address, V> -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds the given single address or prefix block subnet to the trie.Adds the given single address or prefix block subnet to the trie, if not already there.addTrie
(AddressTrie.TrieNode<E> trie) Adds nodes matching the given sub-root node and all of its sub-nodes to the trie, if not already there.Methods inherited from interface inet.ipaddr.format.util.AddressTrieOps
allNodeIterator, allNodeSpliterator, ceilingAddedNode, containedFirstAllNodeIterator, containedFirstIterator, containingFirstAllNodeIterator, containingFirstIterator, contains, elementContains, elementsContainedBy, elementsContaining, firstAddedNode, firstNode, floorAddedNode, getAddedNode, getNode, higherAddedNode, lastAddedNode, lastNode, longestPrefixMatch, longestPrefixMatchNode, lowerAddedNode, nodeIterator, nodeSpliterator, remove, removeElementsContainedBy
Methods inherited from interface inet.ipaddr.format.util.TreeOps
descendingIterator, descendingSpliterator, iterator, spliterator
-
Method Details
-
add
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 asIPv4Address
andIPv4AddressTrie
, you can convert and add the spanning prefix blocks withPartition.partitionWithSpanningBlocks(s).predicateForEach(trie::add)
, or you can convert and add using a single max block size withPartition.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
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. Seeadd(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 useAddressTrieOps.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:
-