Class RadixTrie.TrieNode
java.lang.Object
org.opendaylight.lispflowmapping.inmemorydb.radixtrie.RadixTrie.TrieNode
Trie node definition.
-
Method Summary
Modifier and TypeMethodDescriptionHelper method that converts prefix and prefix length to dotted decimal, string, representation.boolean
comparePrefix
(byte[] pref) Compare node prefix with prefix.data()
void
erase()
Erase node.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.Inserts node in trie near this node with prefix that has the first bit difference at diffbit.iterator()
Retrieve iterator.parentWithBitLessThan
(int bitlen) Find parent with bit less than given value.byte[]
prefix()
int
void
Clear node data.sibling()
Return sibling node.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
prefix
public byte[] prefix() -
prefixLength
public int prefixLength() -
data
-
findClosest
Finds closest prefix NOT the longest prefix match.- Parameters:
pref
- Searched prefixpreflen
- Searched prefix lengthvirtual
- Include virtual nodes in search- Returns:
- The node found
-
firstDifferentBit
public int firstDifferentBit(byte[] pref, int preflen) Compares prefix to node's prefix and returns position of first different bit.- Parameters:
pref
- Prefix to be compared.preflen
- Prefix length.- Returns:
- Position of first different bit.
-
parentWithBitLessThan
Find parent with bit less than given value.- Parameters:
bitlen
- Bit value- Returns:
- Parent with bit less than given value
-
sibling
Return sibling node.- Returns:
- Sibling node, if there is a parent, else null
-
insert
public RadixTrie<T>.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.- Parameters:
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 prefix- Returns:
- The trie node created or current node if it's an overwrite.
-
erase
public void erase()Erase node. -
resetData
public void resetData()Clear node data. -
comparePrefix
public boolean comparePrefix(byte[] pref) Compare node prefix with prefix.- Parameters:
pref
- Prefix to be compared- Returns:
- True if prefixes are equal, false otherwise
-
asIpPrefix
Helper method that converts prefix and prefix length to dotted decimal, string, representation.- Returns:
- String representation of prefix.
-
iterator
Retrieve iterator. -
toString
-