org.apache.uima.internal.util.rb_trees
Class IntRedBlackTree

java.lang.Object
  extended by org.apache.uima.internal.util.rb_trees.IntRedBlackTree

public class IntRedBlackTree
extends java.lang.Object

See the RedBlackTree class. This is a specialized instance with ints as elements.


Nested Class Summary
static class IntRedBlackTree.IntRBTIterator
           
 
Constructor Summary
IntRedBlackTree()
          Default constructor, does nothing.
 
Method Summary
 void clear()
           
 boolean containsKey(int key)
           
 boolean containsValue(int o)
           
 int get(int key)
           
 int getFirst()
           
 boolean isEmpty()
           
 IntRedBlackTree.IntRBTIterator iterator()
           
 int[] keySet()
           
 void printKeys()
          Debugging aid.
 boolean put(int key, int el)
          Insert an object with a given key into the tree.
 int remove(int key)
          Delete the node with the given key from the tree, if it exists.
 int size()
           
 int[] toArray(int offset)
          Provides an array representation of the IntRedBlackTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntRedBlackTree

public IntRedBlackTree()
Default constructor, does nothing.

Method Detail

size

public final int size()

clear

public final void clear()

containsKey

public final boolean containsKey(int key)

containsValue

public final boolean containsValue(int o)

put

public final boolean put(int key,
                         int el)
Insert an object with a given key into the tree.

Parameters:
key - The key under which the int is to be inserted.
el - The int to be inserted.
Returns:
true, if the key was not in the tree; false, if an element with that key was already in the tree. The old element is overwritten with the new one.

remove

public final int remove(int key)
                 throws java.util.NoSuchElementException
Delete the node with the given key from the tree, if it exists.

Parameters:
key - The key to be deleted.
Throws:
java.util.NoSuchElementException

get

public final int get(int key)
              throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

isEmpty

public final boolean isEmpty()

keySet

public final int[] keySet()

getFirst

public final int getFirst()

iterator

public IntRedBlackTree.IntRBTIterator iterator()

printKeys

public void printKeys()
Debugging aid.


toArray

public int[] toArray(int offset)
Provides an array representation of the IntRedBlackTree. See IntRBTArray for the memory layout of the array. Note that the red-black information is lost in the translation. The resulting array is only meant to be read, not grown. The array is meant as input to construct an IntRBTArray object.

Parameters:
offset - An offset for internal addressing. If offset > 0, the addresses generated for right daughters in two-daughter nodes are shifted to the right. This is useful if the resulting array will be copied to a certain offset position in a different array.
Returns:
The resulting array representation.


Copyright © 2013. All Rights Reserved.