StringRedBlackTree (ORC Core 1.6.5 API)
Date: 2020-10-01

org.apache.orc.impl

## Class StringRedBlackTree

- java.lang.Object
- - org.apache.orc.impl.StringRedBlackTree

-     public class StringRedBlackTree
      extends Object

  A red-black tree that stores strings. The strings are stored as UTF-8 bytes and an offset for each entry.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `StringRedBlackTree.Visitor` The interface for visitors.
    `static interface` | `StringRedBlackTree.VisitorContext` The information about each node.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `lastAdd`
    `static int` | `NULL`
    `protected int` | `root`
    `protected int` | `size`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringRedBlackTree(int initialCapacity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.
    `void` | `getText(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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NULL

          public static final int NULL

      See Also:
        Constant Field Values

    - #### size

          protected int size

    - #### root

          protected int root

    - #### lastAdd

          protected int lastAdd

  - ### Constructor Detail

    - #### StringRedBlackTree

          public StringRedBlackTree(int initialCapacity)

  - ### Method Detail

    - #### add

          public int add(String value)

    - #### add

          public int add(Text value)

    - #### add

          public int add(byte[] bytes,
                         int offset,
                         int length)

    - #### compareValue

          protected int compareValue(int position)

      Compare the value at the given position to the new value.
      Returns:
        0 if the values are the same, -1 if the new value is smaller and 1 if the new value is larger.

    - #### visit

          public void visit(StringRedBlackTree.Visitor visitor)
                     throws IOException

      Visit all of the nodes in the tree in sorted order.
      Parameters:
        `visitor` - the action to be applied to each node
      Throws:
        `IOException`

    - #### clear

          public void clear()

      Reset the table to empty.

    - #### getText

          public void getText(Text result,
                              int originalPosition)

    - #### getCharacterSize

          public int getCharacterSize()

      Get the size of the character data in the table.
      Returns:
        the bytes used by the table

    - #### getSizeInBytes

          public long getSizeInBytes()

      Calculate the approximate size in memory.
      Returns:
        the number of bytes used in storing the tree.

    - #### isRed

          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.

    - #### getLeft

          protected int getLeft(int position)

      Get the left field of the given position.

    - #### getRight

          protected int getRight(int position)

      Get the right field of the given position.

    - #### add

          protected boolean add()

      Add the new key to the tree.
      Returns:
        true if the element is a new one.

    - #### size

          public int size()

      Get the number of elements in the set.

Copyright © 2013–2020 The Apache Software Foundation. All rights reserved.