public abstract class BaseDualIPv4v6Tries<T4 extends AddressTrie<IPv4Address>,T6 extends AddressTrie<IPv6Address>> extends Object implements Iterable<IPAddress>, Serializable, Cloneable
AddressTrie
.public abstract T4 getIPv4Trie()
public abstract T6 getIPv6Trie()
public BaseDualIPv4v6Tries<T4,T6> clone()
public int size()
isEmpty()
returns true.public boolean isEmpty()
public boolean add(IPAddress 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 one of the two tries.
addr
- public boolean contains(IPAddress 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 AddressTrieOps.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.
addr
- public boolean remove(IPAddress addr)
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.
See AddressTrieOps.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 calling BinaryTreeNode.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.
addr
- removeElementsContainedBy(IPAddress)
public boolean elementContains(IPAddress 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 AddressTrieOps.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)
.
addr
- public AddressTrie.TrieNode<? extends IPAddress> elementsContaining(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> elementsContainedBy(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> removeElementsContainedBy(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> getAddedNode(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> longestPrefixMatchNode(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> addNode(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> addTrie(AddressTrie.TrieNode<? extends IPAddress> trie)
public AddressTrie.TrieNode<? extends IPAddress> floorAddedNode(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> lowerAddedNode(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> ceilingAddedNode(IPAddress addr)
public AddressTrie.TrieNode<? extends IPAddress> higherAddedNode(IPAddress addr)
public Spliterator<IPAddress> spliterator()
spliterator
in interface Iterable<IPAddress>
public Spliterator<IPAddress> descendingSpliterator()
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> nodeIterator(boolean forward)
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> containingFirstIterator(boolean forwardSubNodeOrder)
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> containedFirstIterator(boolean forwardSubNodeOrder)
public abstract Iterator<? extends AddressTrie.TrieNode<? extends IPAddress>> blockSizeNodeIterator(boolean lowerSubNodeFirst)
public abstract Spliterator<? extends AddressTrie.TrieNode<? extends IPAddress>> nodeSpliterator(boolean forward)