public class StringRedBlackTree extends Object implements Dictionary
Dictionary.IMPL, Dictionary.Visitor, Dictionary.VisitorContext| Modifier and Type | Field and Description | 
|---|---|
| protected int | lastAdd | 
| static int | NULL | 
| protected int | root | 
| protected int | size | 
INITIAL_DICTIONARY_SIZE| Constructor and Description | 
|---|
| StringRedBlackTree(int initialCapacity) | 
| Modifier and Type | Method and Description | 
|---|---|
| protected boolean | add()Add the new key to the tree. | 
| int | add(byte[] bytes,
   int offset,
   int length) | 
| int | add(String value) | 
| int | add(Text value) | 
| void | clear()Reset the table to empty. | 
| protected int | compareValue(int position)Compare the value at the given position to the new value. | 
| int | getCharacterSize()Get the size of the character data in the table. | 
| protected int | getLeft(int position)Get the left field of the given position. | 
| protected int | getRight(int position)Get the right field of the given position. | 
| long | getSizeInBytes()Calculate the approximate size in memory. | 
| ByteBuffer | getText(int positionInKeyOffset) | 
| void | getText(Text result,
       int originalPosition)Given the position index, return the original string before being encoded. | 
| protected boolean | isRed(int position)Is the given node red as opposed to black? To prevent having an extra word
 in the data array, we just the low bit on the left child index. | 
| int | size()Get the number of elements in the set. | 
| void | visit(Dictionary.Visitor visitor)Visit all of the nodes in the tree in sorted order. | 
| int | writeTo(OutputStream out,
       int position)Given the position index, write the original string, before being encoded,
 to the OutputStream. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsizepublic static final int NULL
protected int size
protected int root
protected int lastAdd
public int add(String value)
public int add(Text value)
public int add(byte[] bytes,
               int offset,
               int length)
add in interface Dictionaryprotected int compareValue(int position)
public void visit(Dictionary.Visitor visitor) throws IOException
visit in interface Dictionaryvisitor - the action to be applied to each nodeIOExceptionpublic void clear()
clear in interface Dictionarypublic void getText(Text result, int originalPosition)
Dictionaryresult.getText in interface Dictionaryresult - the holder to copy the dictionary text intooriginalPosition - the position where the key was addedpublic ByteBuffer getText(int positionInKeyOffset)
getText in interface Dictionarypublic int writeTo(OutputStream out, int position) throws IOException
DictionarywriteTo in interface Dictionaryout - the output stream to which to write the dataposition - the position where the key was originally addedIOException - if an I/O error occurspublic int getCharacterSize()
public long getSizeInBytes()
getSizeInBytes in interface Dictionaryprotected boolean isRed(int position)
protected int getLeft(int position)
protected int getRight(int position)
protected boolean add()
public int size()
Copyright © 2013–2023 The Apache Software Foundation. All rights reserved.