public class RadixTrie.TrieNode extends Object implements Iterable<RadixTrie.TrieNode>
Modifier and Type | Method and Description |
---|---|
String |
asIpPrefix()
Helper method that converts prefix and prefix length to dotted decimal, string, representation.
|
boolean |
comparePrefix(byte[] pref)
Compare node prefix with prefix.
|
T |
data() |
void |
erase()
Erase node.
|
RadixTrie.TrieNode |
findClosest(byte[] pref,
int preflen,
boolean virtual)
Finds closest prefix NOT the longest prefix match.
|
int |
firstDifferentBit(byte[] pref,
int preflen)
Compares prefix to node's prefix and returns position of first different bit.
|
RadixTrie.TrieNode |
insert(byte[] pref,
int preflen,
int diffbit,
T prefdata,
byte[] closest)
Inserts node in trie near this node with prefix that has the first bit difference at diffbit.
|
Iterator<RadixTrie.TrieNode> |
iterator()
Retrieve iterator.
|
RadixTrie.TrieNode |
parentWithBitLessThan(int bitlen)
Find parent with bit less than given value.
|
byte[] |
prefix() |
int |
prefixLength() |
void |
resetData()
Clear node data.
|
RadixTrie.TrieNode |
sibling()
Return sibling node.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public byte[] prefix()
public int prefixLength()
public T data()
public RadixTrie.TrieNode findClosest(byte[] pref, int preflen, boolean virtual)
pref
- Searched prefixpreflen
- Searched prefix lengthvirtual
- Include virtual nodes in searchpublic int firstDifferentBit(byte[] pref, int preflen)
pref
- Prefix to be compared.preflen
- Prefix length.public RadixTrie.TrieNode parentWithBitLessThan(int bitlen)
bitlen
- Bit valuepublic RadixTrie.TrieNode sibling()
public RadixTrie.TrieNode insert(byte[] pref, int preflen, int diffbit, T prefdata, byte[] closest)
pref
- Prefix to be inserted.preflen
- Prefix length of the prefix to be inserted.diffbit
- Bit index of the first different bit between prefix and current nodeprefdata
- Data to be stored together with the prefixpublic void erase()
public void resetData()
public boolean comparePrefix(byte[] pref)
pref
- Prefix to be comparedpublic String asIpPrefix()
public Iterator<RadixTrie.TrieNode> iterator()
iterator
in interface Iterable<RadixTrie.TrieNode>
Copyright © 2019 OpenDaylight. All rights reserved.