E
- public static interface AddressTrieOps.AddressTrieAddOps<E extends Address> extends AddressTrieOps<E>
Operations which take an address as an argument require that the address is an individual address or prefix block.
AddressTrieOps.AddressTrieAddOps<E extends Address>, AddressTrieOps.AssociativeAddressTrieOps<K extends Address,V>, AddressTrieOps.AssociativeAddressTriePutOps<K extends Address,V>
Modifier and Type | Method and Description |
---|---|
boolean |
add(E addr)
Adds the given single address or prefix block subnet to the trie.
|
AddressTrie.TrieNode<E> |
addNode(E addr)
Adds the given single address or prefix block subnet to the trie, if not already there.
|
AddressTrie.TrieNode<E> |
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.
|
allNodeIterator, allNodeSpliterator, ceiling, ceilingAddedNode, containedFirstAllNodeIterator, containedFirstIterator, containingFirstAllNodeIterator, containingFirstIterator, contains, elementContains, elementsContainedBy, elementsContaining, firstAddedNode, firstNode, floor, floorAddedNode, getAddedNode, getNode, higher, higherAddedNode, lastAddedNode, lastNode, longestPrefixMatch, longestPrefixMatchNode, lower, lowerAddedNode, nodeIterator, nodeSpliterator, remove, removeElementsContainedBy, shortestPrefixMatch, shortestPrefixMatchNode
descendingIterator, descendingSpliterator, iterator, spliterator
boolean add(E addr)
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.
addr
- AddressTrie.TrieNode<E> addNode(E addr)
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)
addr
- AddressTrie.TrieNode<E> addTrie(AddressTrie.TrieNode<E> trie)
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 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.
trie
-