inet.ipaddr.ipv6.IPv6AddressAssociativeTrie Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ipaddress Show documentation
Show all versions of ipaddress Show documentation
Library for handling IP addresses, both IPv4 and IPv6
/*
* Copyright 2020 Sean C Foley
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* or at
* https://github.com/seancfoley/IPAddress/blob/master/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inet.ipaddr.ipv6;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.Function;
import java.util.function.Supplier;
import inet.ipaddr.format.util.AssociativeAddedTree;
import inet.ipaddr.format.util.AssociativeAddressTrie;
import inet.ipaddr.format.util.BinaryTreeNode;
import inet.ipaddr.format.util.BinaryTreeNode.CachingIterator;
/**
* An IPv6 address trie in which each node can be associated with a value.
*
* See {@link AssociativeAddressTrie} for more details.
*
* @author scfoley
*
* @param the type of the associated values
*/
public class IPv6AddressAssociativeTrie extends AssociativeAddressTrie {
private static final long serialVersionUID = 1L;
private static final IPv6Address INIT_ROOT = IPv6AddressTrie.INIT_ROOT;
public IPv6AddressAssociativeTrie() {
super(new IPv6AssociativeTrieNode());
}
protected IPv6AddressAssociativeTrie(AddressBounds bounds) {
super(new IPv6AssociativeTrieNode(), bounds);
}
protected IPv6AddressAssociativeTrie(IPv6AssociativeTrieNode root, AddressBounds bounds) {
super(root, bounds);
}
@Override
public IPv6AssociativeTrieNode getRoot() {
return (IPv6AssociativeTrieNode) super.getRoot();
}
@Override
protected IPv6AssociativeTrieNode absoluteRoot() {
return (IPv6AssociativeTrieNode) super.absoluteRoot();
}
@Override
protected IPv6AddressAssociativeTrie createNew(AddressBounds bounds) {
return new IPv6AddressAssociativeTrie(bounds);
}
@Override
protected IPv6AddressAssociativeTrie createSubTrie(AddressBounds bounds) {
return new IPv6AddressAssociativeTrie(absoluteRoot(), bounds);
}
public static class IPv6AssociativeTrieNode extends AssociativeTrieNode {
private static final long serialVersionUID = 1L;
protected IPv6AssociativeTrieNode(IPv6Address addr) {
super(addr);
}
public IPv6AssociativeTrieNode() { // root node
super(INIT_ROOT);
}
@Override
protected void replaceThisRoot(BinaryTreeNode replacement) {
super.replaceThisRoot(replacement);
if(!FREEZE_ROOT && replacement == null) {
setKey(INIT_ROOT);
}
}
@Override
public IPv6AssociativeTrieNode getUpperSubNode() {
return (IPv6AssociativeTrieNode) super.getUpperSubNode();
}
@Override
public IPv6AssociativeTrieNode getLowerSubNode() {
return (IPv6AssociativeTrieNode) super.getLowerSubNode();
}
@Override
public IPv6AssociativeTrieNode getParent() {
return (IPv6AssociativeTrieNode) super.getParent();
}
@Override
protected IPv6AssociativeTrieNode createNewImpl(IPv6Address addr) {
return new IPv6AssociativeTrieNode(addr);
}
@Override
public IPv6AssociativeTrieNode removeElementsContainedBy(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.removeElementsContainedBy(addr);
}
@Override
public IPv6AssociativeTrieNode elementsContainedBy(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.elementsContainedBy(addr);
}
@Override
public IPv6AssociativeTrieNode elementsContaining(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.elementsContaining(addr);
}
@Override
public IPv6AssociativeTrieNode longestPrefixMatchNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.longestPrefixMatchNode(addr);
}
@Override
public IPv6AssociativeTrieNode getAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.getAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode getNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.getNode(addr);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> nodeIterator(boolean forward) {
return (Iterator>) super.nodeIterator(forward);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> allNodeIterator(boolean forward) {
return (Iterator>) super.allNodeIterator(forward);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> blockSizeNodeIterator(boolean lowerSubNodeFirst) {
return (Iterator>) super.blockSizeNodeIterator(lowerSubNodeFirst);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> blockSizeAllNodeIterator(boolean lowerSubNodeFirst) {
return (Iterator>) super.blockSizeAllNodeIterator(lowerSubNodeFirst);
}
@SuppressWarnings("unchecked")
@Override
public CachingIterator, IPv6Address, C> blockSizeCachingAllNodeIterator() {
return (CachingIterator, IPv6Address, C>) super.blockSizeCachingAllNodeIterator();
}
@SuppressWarnings("unchecked")
@Override
public CachingIterator, IPv6Address, C> containingFirstIterator(boolean forwardSubNodeOrder) {
return (CachingIterator, IPv6Address, C>) super.containingFirstIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public CachingIterator, IPv6Address, C> containingFirstAllNodeIterator(boolean forwardSubNodeOrder) {
return (CachingIterator, IPv6Address, C>) super.containingFirstAllNodeIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> containedFirstIterator(boolean forwardSubNodeOrder) {
return (Iterator>) super.containedFirstIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> containedFirstAllNodeIterator(boolean forwardSubNodeOrder) {
return (Iterator>) super.containedFirstAllNodeIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public Spliterator> nodeSpliterator(boolean forward) {
return (Spliterator>) super.nodeSpliterator(forward);
}
@SuppressWarnings("unchecked")
@Override
public Spliterator> allNodeSpliterator(boolean forward) {
return (Spliterator>) super.allNodeSpliterator(forward);
}
@Override
public IPv6AssociativeTrieNode previousAddedNode() {
return (IPv6AssociativeTrieNode) super.previousAddedNode();
}
@Override
public IPv6AssociativeTrieNode nextAddedNode() {
return (IPv6AssociativeTrieNode) super.nextAddedNode();
}
@Override
public IPv6AssociativeTrieNode nextNode() {
return (IPv6AssociativeTrieNode) super.nextNode();
}
@Override
public IPv6AssociativeTrieNode previousNode() {
return (IPv6AssociativeTrieNode) super.previousNode();
}
@Override
public IPv6AssociativeTrieNode lowerAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.lowerAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode floorAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.floorAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode higherAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.higherAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode ceilingAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.ceilingAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode firstNode() {
return (IPv6AssociativeTrieNode) super.firstNode();
}
@Override
public IPv6AssociativeTrieNode lastNode() {
return (IPv6AssociativeTrieNode) super.lastNode();
}
@Override
public IPv6AssociativeTrieNode firstAddedNode() {
return (IPv6AssociativeTrieNode) super.firstAddedNode();
}
@Override
public IPv6AssociativeTrieNode lastAddedNode() {
return (IPv6AssociativeTrieNode) super.lastAddedNode();
}
@Override
protected IPv6AddressAssociativeTrie createNewTree() {
return new IPv6AddressAssociativeTrie();
}
@Override
public IPv6AddressAssociativeTrie asNewTrie() {
return (IPv6AddressAssociativeTrie) super.asNewTrie();
}
@Override
public IPv6AssociativeTrieNode cloneTree() {
return (IPv6AssociativeTrieNode) super.cloneTree();
}
@Override
public IPv6AssociativeTrieNode clone() {
return (IPv6AssociativeTrieNode) super.clone();
}
@Override
public boolean equals(Object o) {
return o instanceof IPv6AddressAssociativeTrie.IPv6AssociativeTrieNode && super.equals(o);
}
}
@Override
public IPv6AssociativeTrieNode removeElementsContainedBy(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.removeElementsContainedBy(addr);
}
@Override
public IPv6AssociativeTrieNode elementsContainedBy(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.elementsContainedBy(addr);
}
@Override
public IPv6AssociativeTrieNode elementsContaining(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.elementsContaining(addr);
}
@Override
public IPv6AssociativeTrieNode longestPrefixMatchNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.longestPrefixMatchNode(addr);
}
@Override
public IPv6AssociativeTrieNode getAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.getAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode getNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.getNode(addr);
}
@Override
public IPv6AssociativeTrieNode addNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.addNode(addr);
}
@SuppressWarnings("unchecked")
@Override
public IPv6AssociativeTrieNode addTrie(TrieNode trie) {
return (IPv6AssociativeTrieNode) super.addTrie(trie);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> nodeIterator(boolean forward) {
return (Iterator>) super.nodeIterator(forward);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> allNodeIterator(boolean forward) {
return (Iterator>) super.allNodeIterator(forward);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> blockSizeNodeIterator(boolean lowerSubNodeFirst) {
return (Iterator>) super.blockSizeNodeIterator(lowerSubNodeFirst);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> blockSizeAllNodeIterator(boolean lowerSubNodeFirst) {
return (Iterator>) super.blockSizeAllNodeIterator(lowerSubNodeFirst);
}
@SuppressWarnings("unchecked")
@Override
public CachingIterator, IPv6Address, C> blockSizeCachingAllNodeIterator() {
return (CachingIterator, IPv6Address, C>) super.blockSizeCachingAllNodeIterator();
}
@SuppressWarnings("unchecked")
@Override
public CachingIterator, IPv6Address, C> containingFirstIterator(boolean forwardSubNodeOrder) {
return (CachingIterator, IPv6Address, C>) super.containingFirstIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public CachingIterator, IPv6Address, C> containingFirstAllNodeIterator(boolean forwardSubNodeOrder) {
return (CachingIterator, IPv6Address, C>) super.containingFirstAllNodeIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> containedFirstIterator(boolean forwardSubNodeOrder) {
return (Iterator>) super.containedFirstIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public Iterator> containedFirstAllNodeIterator(boolean forwardSubNodeOrder) {
return (Iterator>) super.containedFirstAllNodeIterator(forwardSubNodeOrder);
}
@SuppressWarnings("unchecked")
@Override
public Spliterator> nodeSpliterator(boolean forward) {
return (Spliterator>) super.nodeSpliterator(forward);
}
@SuppressWarnings("unchecked")
@Override
public Spliterator> allNodeSpliterator(boolean forward) {
return (Spliterator>) super.allNodeSpliterator(forward);
}
@Override
public IPv6AssociativeTrieNode lowerAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.lowerAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode floorAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.floorAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode higherAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.higherAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode ceilingAddedNode(IPv6Address addr) {
return (IPv6AssociativeTrieNode) super.ceilingAddedNode(addr);
}
@Override
public IPv6AssociativeTrieNode firstNode() {
return (IPv6AssociativeTrieNode) super.firstNode();
}
@Override
public IPv6AssociativeTrieNode lastNode() {
return (IPv6AssociativeTrieNode) super.lastNode();
}
@Override
public IPv6AssociativeTrieNode firstAddedNode() {
return (IPv6AssociativeTrieNode) super.firstAddedNode();
}
@Override
public IPv6AssociativeTrieNode lastAddedNode() {
return (IPv6AssociativeTrieNode) super.lastAddedNode();
}
@Override
public IPv6AssociativeTrieNode putNode(IPv6Address addr, V value) {
return (IPv6AssociativeTrieNode) super.putNode(addr, value);
}
@Override
public IPv6AssociativeTrieNode putTrie(AssociativeTrieNode trie) {
return (IPv6AssociativeTrieNode) super.putTrie(trie);
}
@Override
public IPv6AssociativeTrieNode remap(IPv6Address addr, Function super V, ? extends V> remapper) {
return (IPv6AssociativeTrieNode) super.remap(addr, remapper);
}
@Override
public IPv6AssociativeTrieNode remapIfAbsent(IPv6Address addr, Supplier extends V> remapper, boolean insertNull) {
return (IPv6AssociativeTrieNode) super.remapIfAbsent(addr, remapper, insertNull);
}
@Override
public boolean equals(Object o) {
return o instanceof IPv6AddressAssociativeTrie && super.equals(o);
}
@Override
public IPv6AddressAssociativeTrie clone() {
return (IPv6AddressAssociativeTrie) super.clone();
}
@Override
public AssociativeAddedTree constructAddedNodesTree() {
IPv6AddressAssociativeTrie> trie = new IPv6AddressAssociativeTrie>();
contructAssociativeAddedTree(trie);
return new AssociativeAddedTree(trie);
}
@Override
public String toAddedNodesTreeString() {
IPv6AddressAssociativeTrie> trie = new IPv6AddressAssociativeTrie>();
contructAssociativeAddedTree(trie);
return toAddedNodesTreeString(trie);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy