Class AddressTrie.TrieNode<E extends Address>
- Type Parameters:
E-
- All Implemented Interfaces:
AddressTrieOps<E>, TreeOps<E>, Serializable, Cloneable, Iterable<E>
- Direct Known Subclasses:
AssociativeAddressTrie.AssociativeTrieNode, IPv4AddressTrie.IPv4TrieNode, IPv6AddressTrie.IPv6TrieNode, MACAddressTrie.MACTrieNode
- Enclosing class:
AddressTrie<E extends Address>
- Author:
- scfoley
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class BinaryTreeNode
BinaryTreeNode.CachingIterator<N,E, C> Nested classes/interfaces inherited from interface AddressTrieOps
AddressTrieOps.AddressTrieAddOps<E>, AddressTrieOps.AssociativeAddressTrieOps<K,V>, AddressTrieOps.AssociativeAddressTriePutOps<K, V> -
Method Summary
Modifier and TypeMethodDescriptionIterator<? extends AddressTrie.TrieNode<E>> allNodeIterator(boolean forward) Iterates through all the nodes of the sub-tree with this node as the root, in forward or reverse tree order.Spliterator<? extends AddressTrie.TrieNode<E>> allNodeSpliterator(boolean forward) Creates aSpliteratorover the nodes in forward or reverse natural tree order.Creates a new sub-trie, copying the nodes starting with this node as root.Iterator<? extends AddressTrie.TrieNode<E>> blockSizeAllNodeIterator(boolean lowerSubNodeFirst) Iterates all the nodes, ordered by keys from largest prefix blocks to smallest and then to individual addresses, in the sub-trie with this node as the root.<C> BinaryTreeNode.CachingIterator<? extends AddressTrie.TrieNode<E>, E, C> Iterates all nodes, ordered by keys from largest prefix blocks to smallest and then to individual addresses, in the sub-trie with this node as the root.Iterator<? extends AddressTrie.TrieNode<E>> blockSizeNodeIterator(boolean lowerSubNodeFirst) Iterates the added nodes, ordered by keys from largest prefix blocks to smallest and then to individual addresses, in the sub-trie with this node as the root.Returns the lowest added address greater than or equal to the given address.ceilingAddedNode(E addr) Returns the added node whose address is the lowest address greater than or equal to the given address.clone()Clones the node.Clones the sub-tree starting with this node as root.Iterator<? extends AddressTrie.TrieNode<E>> containedFirstAllNodeIterator(boolean forwardSubNodeOrder) Returns an iterator that does a post-order binary tree traversal.Iterator<? extends AddressTrie.TrieNode<E>> containedFirstIterator(boolean forwardSubNodeOrder) Returns an iterator that does a post-order binary tree traversal of the added nodes.<C> BinaryTreeNode.CachingIterator<? extends AddressTrie.TrieNode<E>, E, C> containingFirstAllNodeIterator(boolean forwardSubNodeOrder) Returns an iterator that does a pre-order binary tree traversal.Iterator<? extends AddressTrie.TrieNode<E>> containingFirstIterator(boolean forwardSubNodeOrder) Returns an iterator that does a pre-order binary tree traversal of the added nodes.booleanReturns whether the given address or prefix block subnet is in the trie (as an added element).Creates aSpliteratorover the keys of the added nodes in descending natural tree order.booleanelementContains(E addr) Checks if a prefix block subnet or address in the trie contains the given subnet or address.elementsContainedBy(E addr) Checks if a part of this trie is contained by the given prefix block subnet or individual address.elementsContaining(E addr) Finds the added subnets and/or addresses in the trie that contain the given individual address or prefix block subnet.booleanReturns whether the key values match those of the given nodeReturns the first (lowest valued) added node in the sub-tree originating from this node, or null if there are no added entries in this tree or sub-treeReturns the first (lowest valued) node in the sub-tree originating from this node.Returns the highest added address less than or equal to the given address.floorAddedNode(E addr) Returns the added node whose address is the highest address less than or equal to the given address.Returns the sub node whose address is smallest in valueGets the node corresponding to the given address, returns null if not such element exists.Returns the node for the subnet block containing this node.Returns the sub-node whose address is largest in valueReturns the lowest added address strictly greater than the given address.higherAddedNode(E addr) Returns the added node whose address is the lowest address strictly greater than the given address.Returns the last (highest valued) added node in the sub-tree originating from this node, or null if there are no added entries in this tree or sub-treelastNode()Returns the last (highest valued) node in the sub-tree originating from this node.longestPrefixMatch(E addr) Of all the added subnets or address whose prefix matches the given address, returns the one with the longest prefix.longestPrefixMatchNode(E addr) Finds the containing subnet or address in the trie with the smallest subnet size, which is equivalent to finding the subnet or address with the longest matching prefix.Returns the highest added address strictly less than the given address.lowerAddedNode(E addr) Returns the added node whose address is the highest address strictly less than the given address.Returns the next node in the tree that is an added node, following the tree order, or null if there is no such node.nextNode()Returns the node that follows this node following the tree orderIterator<? extends AddressTrie.TrieNode<E>> nodeIterator(boolean forward) Iterates through the added nodes of the sub-tree with this node as the root, in forward or reverse tree order.Spliterator<? extends AddressTrie.TrieNode<E>> nodeSpliterator(boolean forward) Creates aSpliteratorover the added nodes in forward or reverse natural tree order.Returns the previous node in the tree that is an added node, following the tree order in reverse, or null if there is no such node.Returns the node that precedes this node following the tree order.booleanRemoves the given single address or prefix block subnet from the trie.removeElementsContainedBy(E addr) Removes any single address or prefix block subnet from the trie that is contained in the given individual address or prefix block subnet.shortestPrefixMatch(E addr) Of all the added subnets or address whose prefix matches the given address, returns the one with the shortest prefix.shortestPrefixMatchNode(E addr) Finds the containing subnet or address in the trie with the largest subnet size, which is equivalent to finding the subnet or address with the shortest matching prefix.Creates aSpliteratorover the keys of the added nodes in natural tree order.Methods inherited from class BinaryTreeNode
clear, descendingIterator, getKey, hashCode, isAdded, isEmpty, isLeaf, isRoot, iterator, nodeSize, remove, setAdded, size, toString, toTreeString, treeEquals, treeHashCodeMethods inherited from interface AddressTrieOps
getAddedNodeMethods inherited from interface TreeOps
descendingIterator, iterator
-
Method Details
-
getParent
Returns the node for the subnet block containing this node.- Overrides:
getParentin classBinaryTreeNode<E extends Address>- Returns:
-
getUpperSubNode
Returns the sub-node whose address is largest in value- Overrides:
getUpperSubNodein classBinaryTreeNode<E extends Address>- Returns:
-
getLowerSubNode
Returns the sub node whose address is smallest in value- Overrides:
getLowerSubNodein classBinaryTreeNode<E extends Address>- Returns:
-
previousAddedNode
Description copied from class:BinaryTreeNodeReturns the previous node in the tree that is an added node, following the tree order in reverse, or null if there is no such node.- Overrides:
previousAddedNodein classBinaryTreeNode<E extends Address>- Returns:
-
nextAddedNode
Description copied from class:BinaryTreeNodeReturns the next node in the tree that is an added node, following the tree order, or null if there is no such node.- Overrides:
nextAddedNodein classBinaryTreeNode<E extends Address>- Returns:
-
nextNode
Description copied from class:BinaryTreeNodeReturns the node that follows this node following the tree order- Overrides:
nextNodein classBinaryTreeNode<E extends Address>- Returns:
-
previousNode
Description copied from class:BinaryTreeNodeReturns the node that precedes this node following the tree order.- Overrides:
previousNodein classBinaryTreeNode<E extends Address>- Returns:
-
firstNode
Description copied from class:BinaryTreeNodeReturns the first (lowest valued) node in the sub-tree originating from this node.- Specified by:
firstNodein interfaceAddressTrieOps<E extends Address>- Overrides:
firstNodein classBinaryTreeNode<E extends Address>- Returns:
-
firstAddedNode
Description copied from class:BinaryTreeNodeReturns the first (lowest valued) added node in the sub-tree originating from this node, or null if there are no added entries in this tree or sub-tree- Specified by:
firstAddedNodein interfaceAddressTrieOps<E extends Address>- Overrides:
firstAddedNodein classBinaryTreeNode<E extends Address>- Returns:
-
lastNode
Description copied from class:BinaryTreeNodeReturns the last (highest valued) node in the sub-tree originating from this node.- Specified by:
lastNodein interfaceAddressTrieOps<E extends Address>- Overrides:
lastNodein classBinaryTreeNode<E extends Address>- Returns:
-
lastAddedNode
Description copied from class:BinaryTreeNodeReturns the last (highest valued) added node in the sub-tree originating from this node, or null if there are no added entries in this tree or sub-tree- Specified by:
lastAddedNodein interfaceAddressTrieOps<E extends Address>- Overrides:
lastAddedNodein classBinaryTreeNode<E extends Address>- Returns:
-
lowerAddedNode
Description copied from interface:AddressTrieOpsReturns the added node whose address is the highest address strictly less than the given address.- Specified by:
lowerAddedNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
lower
Description copied from interface:AddressTrieOpsReturns the highest added address strictly less than the given address.- Specified by:
lowerin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
floorAddedNode
Description copied from interface:AddressTrieOpsReturns the added node whose address is the highest address less than or equal to the given address.- Specified by:
floorAddedNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
floor
Description copied from interface:AddressTrieOpsReturns the highest added address less than or equal to the given address.- Specified by:
floorin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
higherAddedNode
Description copied from interface:AddressTrieOpsReturns the added node whose address is the lowest address strictly greater than the given address.- Specified by:
higherAddedNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
higher
Description copied from interface:AddressTrieOpsReturns the lowest added address strictly greater than the given address.- Specified by:
higherin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
ceilingAddedNode
Description copied from interface:AddressTrieOpsReturns the added node whose address is the lowest address greater than or equal to the given address.- Specified by:
ceilingAddedNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
ceiling
Description copied from interface:AddressTrieOpsReturns the lowest added address greater than or equal to the given address.- Specified by:
ceilingin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
nodeIterator
Description copied from class:BinaryTreeNodeIterates through the added nodes of the sub-tree with this node as the root, in forward or reverse tree order.- Specified by:
nodeIteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
nodeIteratorin interfaceTreeOps<E extends Address>- Overrides:
nodeIteratorin classBinaryTreeNode<E extends Address>- Parameters:
forward- if true, goes in ascending order, otherwise descending- Returns:
-
allNodeIterator
Description copied from class:BinaryTreeNodeIterates through all the nodes of the sub-tree with this node as the root, in forward or reverse tree order.- Specified by:
allNodeIteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
allNodeIteratorin interfaceTreeOps<E extends Address>- Overrides:
allNodeIteratorin classBinaryTreeNode<E extends Address>- Parameters:
forward- if true, goes in ascending order, otherwise descending- Returns:
-
blockSizeNodeIterator
Iterates the added nodes, ordered by keys from largest prefix blocks to smallest and then to individual addresses, in the sub-trie with this node as the root.This iterator supports the
Iterator.remove()operation.- Parameters:
lowerSubNodeFirst- if true, for blocks of equal size the lower is first, otherwise the reverse order- Returns:
-
blockSizeAllNodeIterator
public Iterator<? extends AddressTrie.TrieNode<E>> blockSizeAllNodeIterator(boolean lowerSubNodeFirst) Iterates all the nodes, ordered by keys from largest prefix blocks to smallest and then to individual addresses, in the sub-trie with this node as the root.This iterator supports the
Iterator.remove()operation.- Parameters:
lowerSubNodeFirst- if true, for blocks of equal size the lower is first, otherwise the reverse order- Returns:
-
blockSizeCachingAllNodeIterator
public <C> BinaryTreeNode.CachingIterator<? extends AddressTrie.TrieNode<E>, E, C> blockSizeCachingAllNodeIterator()Iterates all nodes, ordered by keys from largest prefix blocks to smallest and then to individual addresses, in the sub-trie with this node as the root.- Returns:
-
containingFirstIterator
public Iterator<? extends AddressTrie.TrieNode<E>> containingFirstIterator(boolean forwardSubNodeOrder) Description copied from interface:TreeOpsReturns an iterator that does a pre-order binary tree traversal of the added nodes. All added nodes will be visited before their added sub-nodes. For an address trie this means added containing subnet blocks will be visited before their added contained addresses and subnet blocks.This iterator supports the
Iterator.remove()operation.See the docs for
TreeOpsfor more details on the ordering.- Specified by:
containingFirstIteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
containingFirstIteratorin interfaceTreeOps<E extends Address>- Overrides:
containingFirstIteratorin classBinaryTreeNode<E extends Address>- Parameters:
forwardSubNodeOrder- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
containingFirstAllNodeIterator
public <C> BinaryTreeNode.CachingIterator<? extends AddressTrie.TrieNode<E>, E, C> containingFirstAllNodeIterator(boolean forwardSubNodeOrder) Description copied from interface:TreeOpsReturns an iterator that does a pre-order binary tree traversal. All nodes will be visited before their sub-nodes. For an address trie this means containing subnet blocks will be visited before their contained addresses and subnet blocks.This iterator supports the
Iterator.remove()operation.Once a given node is visited, the iterator allows you to cache an object corresponding to the lower or upper sub-node that can be retrieved when you later visit that sub-node. That allows you to provide iteration context from a parent to its sub-nodes when iterating. The caching and retrieval is done in constant-time and linear space (proportional to tree size).
Here is an example showing usage of the caching. Consider this recursive code doing a pre-order traversal:
The following iterative code provides the same functionality:IPv6AddressTrie ipv6Tree = ...; visitRecursive(ipv6Tree.getRoot(), null); static <E> void visitRecursive(BinaryTreeNode<E> node, String direction) { if(direction == null) { direction = "root"; } System.out.println("visited " + direction + " " + node); BinaryTreeNode<E> sub = node.getLowerSubNode(); if(sub != null) { visitRecursive(sub, direction + " left"); } sub = node.getUpperSubNode(); if(sub != null) { visitRecursive(sub, direction + " right"); } }visitIterative(ipv6Tree.getRoot()); static <E> void visitIterative(BinaryTreeNode<E> node) { CachingIterator<? extends BinaryTreeNode<E>, E, String>iterator = node.containingFirstAllNodeIterator(true); while(iterator.hasNext()) { BinaryTreeNode<E> next = iterator.next(); String direction = iterator.getCached(); if(direction == null) { direction = "root"; } System.out.println("visited " + direction + " " + next); iterator.cacheWithLowerSubNode(direction + " left"); iterator.cacheWithUpperSubNode(direction + " right"); } }See
TreeOpsfor more details on the ordering.- Specified by:
containingFirstAllNodeIteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
containingFirstAllNodeIteratorin interfaceTreeOps<E extends Address>- Overrides:
containingFirstAllNodeIteratorin classBinaryTreeNode<E extends Address>- Parameters:
forwardSubNodeOrder- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
containedFirstIterator
public Iterator<? extends AddressTrie.TrieNode<E>> containedFirstIterator(boolean forwardSubNodeOrder) Description copied from interface:TreeOpsReturns an iterator that does a post-order binary tree traversal of the added nodes. All added sub-nodes will be visited before their parent nodes. For an address trie this means contained addresses and subnets will be visited before their containing subnet blocks.This iterator supports the
Iterator.remove()operation.See
TreeOpsfor more details on the ordering.- Specified by:
containedFirstIteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
containedFirstIteratorin interfaceTreeOps<E extends Address>- Overrides:
containedFirstIteratorin classBinaryTreeNode<E extends Address>- Parameters:
forwardSubNodeOrder- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
containedFirstAllNodeIterator
public Iterator<? extends AddressTrie.TrieNode<E>> containedFirstAllNodeIterator(boolean forwardSubNodeOrder) Description copied from interface:TreeOpsReturns an iterator that does a post-order binary tree traversal. All sub-nodes will be visited before their parent nodes. For an address trie this means contained addresses and subnets will be visited before their containing subnet blocks.This iterator does not support the
Iterator.remove()operation. IfIterator.remove()is called it will throwUnsupportedOperationException.See
TreeOpsfor more details on the ordering.- Specified by:
containedFirstAllNodeIteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
containedFirstAllNodeIteratorin interfaceTreeOps<E extends Address>- Overrides:
containedFirstAllNodeIteratorin classBinaryTreeNode<E extends Address>- Parameters:
forwardSubNodeOrder- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
nodeSpliterator
Description copied from interface:TreeOpsCreates aSpliteratorover the added nodes in forward or reverse natural tree order.See
TreeOpsfor more details on the ordering.- Specified by:
nodeSpliteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
nodeSpliteratorin interfaceTreeOps<E extends Address>- Parameters:
forward- if true, goes in ascending order, otherwise descending- Returns:
-
allNodeSpliterator
Description copied from interface:TreeOpsCreates aSpliteratorover the nodes in forward or reverse natural tree order.See
TreeOpsfor more details on the ordering.- Specified by:
allNodeSpliteratorin interfaceAddressTrieOps<E extends Address>- Specified by:
allNodeSpliteratorin interfaceTreeOps<E extends Address>- Parameters:
forward- if true, goes in ascending order, otherwise descending- Returns:
-
spliterator
Description copied from interface:TreeOpsCreates aSpliteratorover the keys of the added nodes in natural tree order.See
TreeOpsfor more details on the ordering.- Specified by:
spliteratorin interfaceIterable<E extends Address>- Specified by:
spliteratorin interfaceTreeOps<E extends Address>- Returns:
-
descendingSpliterator
Description copied from interface:TreeOpsCreates aSpliteratorover the keys of the added nodes in descending natural tree order.See
TreeOpsfor more details on the ordering.- Specified by:
descendingSpliteratorin interfaceTreeOps<E extends Address>- Returns:
-
contains
Description copied from interface:AddressTrieOpsReturns whether the given address or prefix block subnet is in the trie (as an added element).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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns true if the prefix block or address address exists already in the trie, false otherwise.
Use
AddressTrieOps.getAddedNode(Address)to get the node for the address rather than just checking for its existence.- Specified by:
containsin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
remove
Description copied from interface:AddressTrieOpsRemoves the given single address or prefix block subnet from the trie.Removing an element will not remove contained elements (nodes for contained blocks and addresses).
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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns true if the prefix block or address was removed, false if not already in the trie.
You can also remove by calling
AddressTrieOps.getAddedNode(Address)to get the node and then callingBinaryTreeNode.remove()on the node.When an address is removed, the corresponding node may remain in the trie if it remains a subnet block for two sub-nodes. If the corresponding node can be removed from the trie, it will be.
- Specified by:
removein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
- See Also:
-
getNode
Description copied from interface:AddressTrieOpsGets the node corresponding to the given address, returns null if not such element exists.If added is true, returns only nodes representing added elements, otherwise returns any node, including a prefix block that was not added.
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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.- Specified by:
getNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
- See Also:
-
removeElementsContainedBy
Description copied from interface:AddressTrieOpsRemoves any single address or prefix block subnet from the trie that is contained in the given individual address or prefix block subnet.Goes further than
AddressTrieOps.remove(Address), not requiring a match to an inserted node, and also removing all the sub-nodes of any removed node or sub-node.For example, after inserting 1.2.3.0 and 1.2.3.1, passing 1.2.3.0/31 to
AddressTrieOps.removeElementsContainedBy(Address)will remove them both, whileAddressTrieOps.remove(Address)will remove nothing. After inserting 1.2.3.0/31, then #remove(Address) will remove 1.2.3.0/31, but will leave 1.2.3.0 and 1.2.3.1 in the trie.It cannot partially delete a node, such as deleting a single address from a prefix block represented by a node. It can only delete the whole node if the whole address or block represented by that node is contained in the given address or block.
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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns the root node of the subtrie that was removed from the trie, or null if nothing was removed.
- Specified by:
removeElementsContainedByin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
elementsContainedBy
Description copied from interface:AddressTrieOpsChecks if a part of this trie is contained by the given prefix block subnet or individual address.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns the root node of the contained subtrie, or null if no subtrie is contained. The node returned need not be an "added" node, see
BinaryTreeNode.isAdded()for more details on added nodes. The returned subtrie is backed by this trie, so changes in this trie are reflected in those nodes and vice-versa.- Specified by:
elementsContainedByin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
elementsContaining
Description copied from interface:AddressTrieOpsFinds the added subnets and/or addresses in the trie that contain the given individual address or prefix block subnet.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns a list of the nodes for prefix block subnets and addresses from the trie that contain the address or block. The list consists only of added nodes, see
BinaryTreeNode.isAdded()for more details on added nodes. The list is constructed as a trie in which each parent node has only one sub-node.Use
AddressTrieOps.elementContains(Address)to check for the existence of a containing address.- Specified by:
elementsContainingin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
longestPrefixMatch
Description copied from interface:AddressTrieOpsOf all the added subnets or address whose prefix matches the given address, returns the one with the longest prefix. This is equivalent to finding the containing subnet or address with the smallest subnet size.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns null if no added subnet or address contains the given argument.
Use
AddressTrieOps.elementContains(Address)to check for the existence of a containing address.
To get all the containing addresses (subnets with matching prefix), useAddressTrieOps.elementsContaining(Address).
To get the node corresponding to the result of this method, useAddressTrieOps.longestPrefixMatchNode(Address)- Specified by:
longestPrefixMatchin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
longestPrefixMatchNode
Description copied from interface:AddressTrieOpsFinds the containing subnet or address in the trie with the smallest subnet size, which is equivalent to finding the subnet or address with the longest matching prefix. Returns the node corresponding to that subnet.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns null if no added subnet or address contains the given argument.
Use
AddressTrieOps.elementContains(Address)to check for the existence of a containing address.
To get all the containing addresses, useAddressTrieOps.elementsContaining(Address).
UseAddressTrieOps.longestPrefixMatch(Address)to get the address corresponding to the result of this method.- Specified by:
longestPrefixMatchNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
shortestPrefixMatch
Description copied from interface:AddressTrieOpsOf all the added subnets or address whose prefix matches the given address, returns the one with the shortest prefix. This is equivalent to finding the containing subnet or address with the largest subnet size.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns null if no added subnet or address contains the given argument.
Use
AddressTrieOps.elementContains(Address)to check for the existence of a containing address.
To get all the containing addresses (subnets with matching prefix), useAddressTrieOps.elementsContaining(Address).
To get the node corresponding to the result of this method, useAddressTrieOps.shortestPrefixMatchNode(Address)- Specified by:
shortestPrefixMatchin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
shortestPrefixMatchNode
Description copied from interface:AddressTrieOpsFinds the containing subnet or address in the trie with the largest subnet size, which is equivalent to finding the subnet or address with the shortest matching prefix. Returns the node corresponding to that subnet.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns null if no added subnet or address contains the given argument.
Use
AddressTrieOps.elementContains(Address)to check for the existence of a containing address.
To get all the containing addresses, useAddressTrieOps.elementsContaining(Address).
UseAddressTrieOps.shortestPrefixMatch(Address)to get the address corresponding to the result of this method.- Specified by:
shortestPrefixMatchNodein interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
elementContains
Description copied from interface:AddressTrieOpsChecks if a prefix block subnet or address in the trie contains the given subnet or address.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
Partitionclass can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)for more details.Returns true if the subnet or address is contained by a trie element, false otherwise.
To get all the containing addresses, use
AddressTrieOps.elementsContaining(Address).- Specified by:
elementContainsin interfaceAddressTrieOps<E extends Address>- Parameters:
addr-- Returns:
-
asNewTrie
Creates a new sub-trie, copying the nodes starting with this node as root. The nodes are copies of the nodes in this sub-trie, but their keys and values are not copies. -
cloneTree
Description copied from class:BinaryTreeNodeClones the sub-tree starting with this node as root. The nodes are cloned, but their keys and values are not cloned.- Overrides:
cloneTreein classBinaryTreeNode<E extends Address>
-
clone
Description copied from class:BinaryTreeNodeClones the node. Keys remain the same, but the parent node and the lower and upper sub-nodes are all set to null.- Overrides:
clonein classBinaryTreeNode<E extends Address>
-
equals
Description copied from class:BinaryTreeNodeReturns whether the key values match those of the given node- Overrides:
equalsin classBinaryTreeNode<E extends Address>
-