- java.lang.Object
-
- inet.ipaddr.format.util.AddressTrie<IPv6Address>
-
- inet.ipaddr.ipv6.IPv6AddressTrie
-
- All Implemented Interfaces:
AddressTrieOps<IPv6Address>
,AddressTrieOps.AddressTrieAddOps<IPv6Address>
,TreeOps<IPv6Address>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<IPv6Address>
public class IPv6AddressTrie extends AddressTrie<IPv6Address>
An IPv6 address trie. SeeAddressTrie
for more details.- Author:
- scfoley
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IPv6AddressTrie.IPv6TrieNode
-
Nested classes/interfaces inherited from class inet.ipaddr.format.util.AddressTrie
AddressTrie.AddressComparator<E extends Address>, AddressTrie.TrieComparator<E extends Address>, AddressTrie.TrieNode<E extends Address>
-
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>
-
-
Constructor Summary
Constructors Constructor Description IPv6AddressTrie()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IPv6AddressTrie.IPv6TrieNode
addNode(IPv6Address addr)
Adds the given single address or prefix block subnet to the trie, if not already there.IPv6AddressTrie.IPv6TrieNode
addTrie(AddressTrie.TrieNode<IPv6Address> trie)
Adds nodes matching the given sub-root node and all of its sub-nodes to the trie, if not already there.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
allNodeIterator(boolean forward)
Iterates through the nodes (not just the added nodes) in forward or reverse tree order.java.util.Spliterator<IPv6AddressTrie.IPv6TrieNode>
allNodeSpliterator(boolean forward)
Creates aSpliterator
over the nodes in forward or reverse natural tree order.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
blockSizeAllNodeIterator(boolean lowerSubNodeFirst)
Iterates all nodes in the trie, ordered by keys from largest prefix blocks to smallest, and then to individual addresses.<C> BinaryTreeNode.CachingIterator<IPv6AddressTrie.IPv6TrieNode,IPv6Address,C>
blockSizeCachingAllNodeIterator()
Iterates all nodes, ordered by keys from largest prefix blocks to smallest, and then to individual addresses.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
blockSizeNodeIterator(boolean lowerSubNodeFirst)
Iterates the added nodes in the trie, ordered by keys from largest prefix blocks to smallest, and then to individual addresses.IPv6AddressTrie.IPv6TrieNode
ceilingAddedNode(IPv6Address addr)
Returns the added node whose address is the lowest address greater than or equal to the given address.IPv6AddressTrie
clone()
Copies the trie, but not the keys or values.AddedTree<IPv6Address>
constructAddedNodesTree()
Provides an associative trie in which the root and each added node are mapped to a list of their respective direct added nodes.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
containedFirstAllNodeIterator(boolean forwardSubNodeOrder)
Returns an iterator that does a post-order binary tree traversal.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
containedFirstIterator(boolean forwardSubNodeOrder)
Returns an iterator that does a post-order binary tree traversal of the added nodes.<C> BinaryTreeNode.CachingIterator<IPv6AddressTrie.IPv6TrieNode,IPv6Address,C>
containingFirstAllNodeIterator(boolean forwardSubNodeOrder)
Returns an iterator that does a pre-order binary tree traversal.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
containingFirstIterator(boolean forwardSubNodeOrder)
Returns an iterator that does a pre-order binary tree traversal of the added nodes.java.util.Iterator<E>
descendingIterator()
Traverses the added node keys in reverse natural tree order.IPv6AddressTrie.IPv6TrieNode
elementsContainedBy(IPv6Address addr)
Checks if a part of this trie is contained by the given prefix block subnet or individual address.IPv6AddressTrie.IPv6TrieNode
elementsContaining(IPv6Address addr)
Finds the added subnets and/or addresses in the trie that contain the given individual address or prefix block subnet.boolean
equals(java.lang.Object o)
Returns whether the given argument is a trie with a set of nodes that equal the set of nodes in this trieIPv6AddressTrie.IPv6TrieNode
firstAddedNode()
Returns the added node with the first (lowest valued) key, or null if there are no added entries in this trie or subtrieIPv6AddressTrie.IPv6TrieNode
firstNode()
Returns the node with the first (lowest valued) key, whether the node is added or notIPv6AddressTrie.IPv6TrieNode
floorAddedNode(IPv6Address addr)
Returns the added node whose address is the highest address less than or equal to the given address.IPv6AddressTrie.IPv6TrieNode
getAddedNode(IPv6Address addr)
Gets trie nodes representing added elements.IPv6AddressTrie.IPv6TrieNode
getNode(IPv6Address addr)
Gets the node corresponding to the given address, returns null if not such element exists.IPv6AddressTrie.IPv6TrieNode
getRoot()
Returns the root of this trieint
hashCode()
IPv6AddressTrie.IPv6TrieNode
higherAddedNode(IPv6Address addr)
Returns the added node whose address is the lowest address strictly greater than the given address.java.util.Iterator<E>
iterator()
Traverses the added node keys in natural tree order.IPv6AddressTrie.IPv6TrieNode
lastAddedNode()
Returns the added node with the last (highest valued) key, or null if there are no added elements in this trie or subtrieIPv6AddressTrie.IPv6TrieNode
lastNode()
Returns the node with the last (highest valued) key, whether the node is added or notIPv6AddressTrie.IPv6TrieNode
longestPrefixMatchNode(IPv6Address 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.IPv6AddressTrie.IPv6TrieNode
lowerAddedNode(IPv6Address addr)
Returns the added node whose address is the highest address strictly less than the given address.java.util.Iterator<IPv6AddressTrie.IPv6TrieNode>
nodeIterator(boolean forward)
Iterates through the added nodes in forward or reverse natural tree order.java.util.Spliterator<IPv6AddressTrie.IPv6TrieNode>
nodeSpliterator(boolean forward)
Creates aSpliterator
over the added nodes in forward or reverse natural tree order.IPv6AddressTrie.IPv6TrieNode
removeElementsContainedBy(IPv6Address addr)
Removes any single address or prefix block subnet from the trie that is contained in the given individual address or prefix block subnet.java.lang.String
toAddedNodesTreeString()
Provides a flattened version of the trie showing only the contained added nodes and their containment structure, which is non-binary.-
Methods inherited from class inet.ipaddr.format.util.AddressTrie
add, asSet, ceiling, clear, contains, decrement, descendingSpliterator, elementContains, floor, getComparator, higher, increment, isEmpty, longestPrefixMatch, lower, nodeSize, remove, shortestPrefixMatch, shortestPrefixMatchNode, size, spliterator, toString, toString, toString
-
-
-
-
Method Detail
-
getRoot
public IPv6AddressTrie.IPv6TrieNode getRoot()
Returns the root of this trie- Overrides:
getRoot
in classAddressTrie<IPv6Address>
- Returns:
-
removeElementsContainedBy
public IPv6AddressTrie.IPv6TrieNode removeElementsContainedBy(IPv6Address addr)
Description copied from interface:AddressTrieOps
Removes 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
Partition
class 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:
removeElementsContainedBy
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
removeElementsContainedBy
in classAddressTrie<IPv6Address>
- Returns:
-
elementsContainedBy
public IPv6AddressTrie.IPv6TrieNode elementsContainedBy(IPv6Address addr)
Description copied from interface:AddressTrieOps
Checks 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
Partition
class 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:
elementsContainedBy
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
elementsContainedBy
in classAddressTrie<IPv6Address>
- Returns:
-
elementsContaining
public IPv6AddressTrie.IPv6TrieNode elementsContaining(IPv6Address addr)
Description copied from interface:AddressTrieOps
Finds 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
Partition
class 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:
elementsContaining
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
elementsContaining
in classAddressTrie<IPv6Address>
- Returns:
-
longestPrefixMatchNode
public IPv6AddressTrie.IPv6TrieNode longestPrefixMatchNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
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 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
Partition
class 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:
longestPrefixMatchNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
longestPrefixMatchNode
in classAddressTrie<IPv6Address>
- Returns:
-
getAddedNode
public IPv6AddressTrie.IPv6TrieNode getAddedNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
Gets trie nodes representing added elements.Use
AddressTrieOps.contains(Address)
to check for the existence of a given address in the trie, as well asAddressTrieOps.getNode(Address)
to search for all nodes including those not-added but also auto-generated nodes for subnet blocks.- Returns:
-
getNode
public IPv6AddressTrie.IPv6TrieNode getNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
Gets 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
Partition
class can be used to convert the address before calling this method. SeeAddressTrieOps.AddressTrieAddOps.add(Address)
for more details.- Specified by:
getNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
getNode
in classAddressTrie<IPv6Address>
- Returns:
- See Also:
AddressTrieOps.contains(Address)
-
addNode
public IPv6AddressTrie.IPv6TrieNode addNode(IPv6Address addr)
Description copied from interface:AddressTrieOps.AddressTrieAddOps
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. SeeAddressTrieOps.AddressTrieAddOps.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
AddressTrieOps.AddressTrieAddOps.add(Address)
, or before adding you can useAddressTrieOps.getAddedNode(Address)
- Specified by:
addNode
in interfaceAddressTrieOps.AddressTrieAddOps<IPv6Address>
- Overrides:
addNode
in classAddressTrie<IPv6Address>
- Returns:
-
addTrie
public IPv6AddressTrie.IPv6TrieNode addTrie(AddressTrie.TrieNode<IPv6Address> trie)
Description copied from interface:AddressTrieOps.AddressTrieAddOps
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.
- Specified by:
addTrie
in interfaceAddressTrieOps.AddressTrieAddOps<IPv6Address>
- Overrides:
addTrie
in classAddressTrie<IPv6Address>
- Returns:
-
nodeIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> nodeIterator(boolean forward)
Description copied from interface:TreeOps
Iterates through the added nodes in forward or reverse natural tree order.This iterator supports the
Iterator.remove()
operation.See
TreeOps
for more details on the ordering.- Specified by:
nodeIterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
nodeIterator
in interfaceTreeOps<IPv6Address>
- Overrides:
nodeIterator
in classAddressTrie<IPv6Address>
- Parameters:
forward
- if true, goes in ascending order, otherwise descending- Returns:
-
allNodeIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> allNodeIterator(boolean forward)
Description copied from interface:TreeOps
Iterates through the nodes (not just the added nodes) in forward or reverse tree order.See
TreeOps
for more details on the ordering. This iterator supports theIterator.remove()
operation.- Specified by:
allNodeIterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
allNodeIterator
in interfaceTreeOps<IPv6Address>
- Overrides:
allNodeIterator
in classAddressTrie<IPv6Address>
- Parameters:
forward
- if true, goes in ascending order, otherwise descending- Returns:
-
blockSizeNodeIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> blockSizeNodeIterator(boolean lowerSubNodeFirst)
Description copied from class:AddressTrie
Iterates the added nodes in the trie, ordered by keys from largest prefix blocks to smallest, and then to individual addresses.This iterator supports the
Iterator.remove()
operation.- Overrides:
blockSizeNodeIterator
in classAddressTrie<IPv6Address>
- Parameters:
lowerSubNodeFirst
- if true, for blocks of equal size the lower is first, otherwise the reverse order- Returns:
-
blockSizeAllNodeIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> blockSizeAllNodeIterator(boolean lowerSubNodeFirst)
Description copied from class:AddressTrie
Iterates all nodes in the trie, ordered by keys from largest prefix blocks to smallest, and then to individual addresses.This iterator supports the
Iterator.remove()
operation.- Overrides:
blockSizeAllNodeIterator
in classAddressTrie<IPv6Address>
- Parameters:
lowerSubNodeFirst
- if true, for blocks of equal size the lower is first, otherwise the reverse order- Returns:
-
blockSizeCachingAllNodeIterator
public <C> BinaryTreeNode.CachingIterator<IPv6AddressTrie.IPv6TrieNode,IPv6Address,C> blockSizeCachingAllNodeIterator()
Description copied from class:AddressTrie
Iterates all nodes, ordered by keys from largest prefix blocks to smallest, and then to individual addresses.This iterator supports the
Iterator.remove()
operation.- Overrides:
blockSizeCachingAllNodeIterator
in classAddressTrie<IPv6Address>
- Returns:
-
containingFirstIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> containingFirstIterator(boolean forwardSubNodeOrder)
Description copied from interface:TreeOps
Returns 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
TreeOps
for more details on the ordering.- Specified by:
containingFirstIterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
containingFirstIterator
in interfaceTreeOps<IPv6Address>
- Overrides:
containingFirstIterator
in classAddressTrie<IPv6Address>
- 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<IPv6AddressTrie.IPv6TrieNode,IPv6Address,C> containingFirstAllNodeIterator(boolean forwardSubNodeOrder)
Description copied from interface:TreeOps
Returns 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
TreeOps
for more details on the ordering.- Specified by:
containingFirstAllNodeIterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
containingFirstAllNodeIterator
in interfaceTreeOps<IPv6Address>
- Overrides:
containingFirstAllNodeIterator
in classAddressTrie<IPv6Address>
- Parameters:
forwardSubNodeOrder
- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
containedFirstIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> containedFirstIterator(boolean forwardSubNodeOrder)
Description copied from interface:TreeOps
Returns 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
TreeOps
for more details on the ordering.- Specified by:
containedFirstIterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
containedFirstIterator
in interfaceTreeOps<IPv6Address>
- Overrides:
containedFirstIterator
in classAddressTrie<IPv6Address>
- Parameters:
forwardSubNodeOrder
- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
containedFirstAllNodeIterator
public java.util.Iterator<IPv6AddressTrie.IPv6TrieNode> containedFirstAllNodeIterator(boolean forwardSubNodeOrder)
Description copied from interface:TreeOps
Returns 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
TreeOps
for more details on the ordering.- Specified by:
containedFirstAllNodeIterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
containedFirstAllNodeIterator
in interfaceTreeOps<IPv6Address>
- Overrides:
containedFirstAllNodeIterator
in classAddressTrie<IPv6Address>
- Parameters:
forwardSubNodeOrder
- if true, a left sub-node will be visited before the right sub-node of the same parent node.- Returns:
-
nodeSpliterator
public java.util.Spliterator<IPv6AddressTrie.IPv6TrieNode> nodeSpliterator(boolean forward)
Description copied from interface:TreeOps
Creates aSpliterator
over the added nodes in forward or reverse natural tree order.See
TreeOps
for more details on the ordering.- Specified by:
nodeSpliterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
nodeSpliterator
in interfaceTreeOps<IPv6Address>
- Overrides:
nodeSpliterator
in classAddressTrie<IPv6Address>
- Parameters:
forward
- if true, goes in ascending order, otherwise descending- Returns:
-
allNodeSpliterator
public java.util.Spliterator<IPv6AddressTrie.IPv6TrieNode> allNodeSpliterator(boolean forward)
Description copied from interface:TreeOps
Creates aSpliterator
over the nodes in forward or reverse natural tree order.See
TreeOps
for more details on the ordering.- Specified by:
allNodeSpliterator
in interfaceAddressTrieOps<IPv6Address>
- Specified by:
allNodeSpliterator
in interfaceTreeOps<IPv6Address>
- Overrides:
allNodeSpliterator
in classAddressTrie<IPv6Address>
- Parameters:
forward
- if true, goes in ascending order, otherwise descending- Returns:
-
lowerAddedNode
public IPv6AddressTrie.IPv6TrieNode lowerAddedNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
Returns the added node whose address is the highest address strictly less than the given address.- Specified by:
lowerAddedNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
lowerAddedNode
in classAddressTrie<IPv6Address>
- Returns:
-
floorAddedNode
public IPv6AddressTrie.IPv6TrieNode floorAddedNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
Returns the added node whose address is the highest address less than or equal to the given address.- Specified by:
floorAddedNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
floorAddedNode
in classAddressTrie<IPv6Address>
- Returns:
-
higherAddedNode
public IPv6AddressTrie.IPv6TrieNode higherAddedNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
Returns the added node whose address is the lowest address strictly greater than the given address.- Specified by:
higherAddedNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
higherAddedNode
in classAddressTrie<IPv6Address>
- Returns:
-
ceilingAddedNode
public IPv6AddressTrie.IPv6TrieNode ceilingAddedNode(IPv6Address addr)
Description copied from interface:AddressTrieOps
Returns the added node whose address is the lowest address greater than or equal to the given address.- Specified by:
ceilingAddedNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
ceilingAddedNode
in classAddressTrie<IPv6Address>
- Returns:
-
firstNode
public IPv6AddressTrie.IPv6TrieNode firstNode()
Description copied from interface:AddressTrieOps
Returns the node with the first (lowest valued) key, whether the node is added or not- Specified by:
firstNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
firstNode
in classAddressTrie<IPv6Address>
- Returns:
-
lastNode
public IPv6AddressTrie.IPv6TrieNode lastNode()
Description copied from interface:AddressTrieOps
Returns the node with the last (highest valued) key, whether the node is added or not- Specified by:
lastNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
lastNode
in classAddressTrie<IPv6Address>
- Returns:
-
firstAddedNode
public IPv6AddressTrie.IPv6TrieNode firstAddedNode()
Description copied from interface:AddressTrieOps
Returns the added node with the first (lowest valued) key, or null if there are no added entries in this trie or subtrie- Specified by:
firstAddedNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
firstAddedNode
in classAddressTrie<IPv6Address>
- Returns:
-
lastAddedNode
public IPv6AddressTrie.IPv6TrieNode lastAddedNode()
Description copied from interface:AddressTrieOps
Returns the added node with the last (highest valued) key, or null if there are no added elements in this trie or subtrie- Specified by:
lastAddedNode
in interfaceAddressTrieOps<IPv6Address>
- Overrides:
lastAddedNode
in classAddressTrie<IPv6Address>
- Returns:
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:AddressTrie
Returns whether the given argument is a trie with a set of nodes that equal the set of nodes in this trie- Overrides:
equals
in classAddressTrie<IPv6Address>
-
clone
public IPv6AddressTrie clone()
Copies the trie, but not the keys or values.- Overrides:
clone
in classAddressTrie<IPv6Address>
-
constructAddedNodesTree
public AddedTree<IPv6Address> constructAddedNodesTree()
Description copied from class:AddressTrie
Provides an associative trie in which the root and each added node are mapped to a list of their respective direct added nodes. This trie provides an alternative non-binary tree structure of the added nodes. It is used byAddressTrie.toAddedNodesTreeString()
to produce a string showing the alternative structure. If there are no non-added nodes in this trie, then the alternative tree structure provided by this method is the same as the original trie.- Specified by:
constructAddedNodesTree
in classAddressTrie<IPv6Address>
- Returns:
-
toAddedNodesTreeString
public java.lang.String toAddedNodesTreeString()
Description copied from class:AddressTrie
Provides a flattened version of the trie showing only the contained added nodes and their containment structure, which is non-binary. The root node is included, which may or may not be added.- Specified by:
toAddedNodesTreeString
in classAddressTrie<IPv6Address>
- Returns:
-
iterator
public java.util.Iterator<E> iterator()
Description copied from interface:TreeOps
Traverses the added node keys in natural tree order.This iterator supports the
Iterator.remove()
operation.See
TreeOps
for more details on the ordering.
-
descendingIterator
public java.util.Iterator<E> descendingIterator()
Description copied from interface:TreeOps
Traverses the added node keys in reverse natural tree order.This iterator supports the
Iterator.remove()
operation.See
TreeOps
for more details on the ordering.- Specified by:
descendingIterator
in interfaceTreeOps<E extends Address>
- Returns:
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-