public class StringRedBlackTree extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
StringRedBlackTree.Visitor
The interface for visitors.
|
static interface |
StringRedBlackTree.VisitorContext
The information about each node.
|
Modifier and Type | Field and Description |
---|---|
protected int |
lastAdd |
static int |
NULL |
protected int |
root |
protected int |
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(org.apache.hadoop.io.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.
|
void |
getText(org.apache.hadoop.io.Text result,
int originalPosition) |
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(StringRedBlackTree.Visitor visitor)
Visit all of the nodes in the tree in sorted order.
|
public static final int NULL
protected int size
protected int root
protected int lastAdd
public int add(String value)
public int add(org.apache.hadoop.io.Text value)
public int add(byte[] bytes, int offset, int length)
protected int compareValue(int position)
public void visit(StringRedBlackTree.Visitor visitor) throws IOException
visitor
- the action to be applied to each nodeIOException
public void clear()
public void getText(org.apache.hadoop.io.Text result, int originalPosition)
public int getCharacterSize()
public long getSizeInBytes()
protected boolean isRed(int position)
protected int getLeft(int position)
protected int getRight(int position)
protected boolean add()
public int size()
Copyright © 2016 The Apache Software Foundation. All rights reserved.