Class BaseDualIPv4v6Tries<T4 extends AddressTrie<IPv4Address>,T6 extends AddressTrie<IPv6Address>>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<IPAddress>
- Direct Known Subclasses:
DualIPv4v6AssociativeTries
,DualIPv4v6Tries
AddressTrie
.- Author:
- scfoley
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds the given single address or prefix block subnet to one of the two tries.AddressTrie.TrieNode
<? extends IPAddress> AddressTrie.TrieNode
<? extends IPAddress> addTrie
(AddressTrie.TrieNode<? extends IPAddress> trie) abstract Iterator
<? extends AddressTrie.TrieNode<? extends IPAddress>> blockSizeNodeIterator
(boolean lowerSubNodeFirst) AddressTrie.TrieNode
<? extends IPAddress> ceilingAddedNode
(IPAddress addr) clone()
abstract Iterator
<? extends AddressTrie.TrieNode<? extends IPAddress>> containedFirstIterator
(boolean forwardSubNodeOrder) abstract Iterator
<? extends AddressTrie.TrieNode<? extends IPAddress>> containingFirstIterator
(boolean forwardSubNodeOrder) boolean
Returns whether the given address or prefix block subnet is in one of the two tries (as an added element).boolean
elementContains
(IPAddress addr) Checks if a prefix block subnet or address in ones of the two tries contains the given subnet or address.AddressTrie.TrieNode
<? extends IPAddress> elementsContainedBy
(IPAddress addr) AddressTrie.TrieNode
<? extends IPAddress> elementsContaining
(IPAddress addr) boolean
AddressTrie.TrieNode
<? extends IPAddress> floorAddedNode
(IPAddress addr) AddressTrie.TrieNode
<? extends IPAddress> getAddedNode
(IPAddress addr) abstract T4
returns the contained IPv4 trieabstract T6
returns the contained IPv6 trieAddressTrie.TrieNode
<? extends IPAddress> higherAddedNode
(IPAddress addr) boolean
isEmpty()
Returns true if there are no added nodes within the two triesiterator()
longestPrefixMatch
(IPAddress addr) AddressTrie.TrieNode
<? extends IPAddress> AddressTrie.TrieNode
<? extends IPAddress> lowerAddedNode
(IPAddress addr) abstract Iterator
<? extends AddressTrie.TrieNode<? extends IPAddress>> nodeIterator
(boolean forward) abstract Spliterator
<? extends AddressTrie.TrieNode<? extends IPAddress>> nodeSpliterator
(boolean forward) boolean
Removes the given single address or prefix block subnet from the tries.AddressTrie.TrieNode
<? extends IPAddress> int
size()
Returns the number of elements in the tries.toString()
-
Method Details
-
getIPv4Trie
returns the contained IPv4 trie- Returns:
-
getIPv6Trie
returns the contained IPv6 trie- Returns:
-
clone
-
equals
-
toString
-
size
public int size()Returns the number of elements in the tries. Only added nodes are counted. When zero is returned,isEmpty()
returns true.- Returns:
-
isEmpty
public boolean isEmpty()Returns true if there are no added nodes within the two tries -
add
Adds the given single address or prefix block subnet to one of the two tries.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 one of the two tries.
- Parameters:
addr
-- Returns:
-
contains
Returns whether the given address or prefix block subnet is in one of the two tries (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
Partition
class 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 one the two tries, false otherwise.
Use
getAddedNode(IPAddress)
to get the node for the address rather than just checking for its existence.- Parameters:
addr
-- Returns:
-
remove
Removes the given single address or prefix block subnet from the tries.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
Partition
class 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 one of the two tries.
You can also remove by calling
getAddedNode(IPAddress)
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.
- Parameters:
addr
-- Returns:
- See Also:
-
elementContains
Checks if a prefix block subnet or address in ones of the two tries 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
Partition
class 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
elementsContaining(IPAddress)
.- Parameters:
addr
-- Returns:
-
elementsContaining
-
elementsContainedBy
-
removeElementsContainedBy
-
getAddedNode
-
longestPrefixMatchNode
-
longestPrefixMatch
-
addNode
-
addTrie
public AddressTrie.TrieNode<? extends IPAddress> addTrie(AddressTrie.TrieNode<? extends IPAddress> trie) -
floorAddedNode
-
lowerAddedNode
-
ceilingAddedNode
-
higherAddedNode
-
floor
-
lower
-
ceiling
-
higher
-
iterator
- Specified by:
iterator
in interfaceIterable<T4 extends AddressTrie<IPv4Address>>
-
descendingIterator
-
spliterator
- Specified by:
spliterator
in interfaceIterable<T4 extends AddressTrie<IPv4Address>>
-
descendingSpliterator
-
nodeIterator
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> nodeIterator(boolean forward) -
containingFirstIterator
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> containingFirstIterator(boolean forwardSubNodeOrder) -
containedFirstIterator
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> containedFirstIterator(boolean forwardSubNodeOrder) -
blockSizeNodeIterator
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> blockSizeNodeIterator(boolean lowerSubNodeFirst) -
nodeSpliterator
public abstract Spliterator<? extends AddressTrie.TrieNode<? extends IPAddress>> nodeSpliterator(boolean forward)
-