RightArrayBinaryTree - SeqAn API Documentation

# Class RightArrayBinaryTree
A special format to encode the structure of a wavelet tree. The structure is very space efficient because only one position is stored which encodes where the left and right subtree of a given node exist.

Defined in | <seqan/index.h>
Signature | `template <typename TChar, typename TSpec> class RightArrayBinaryTree;`

## Template Parameters

`TValue` | The type of the stored characters.
`TSpec` | The wavelet tree structure specialisation. Default: void.

## Interface Function Overview

- `TIterator begin(rightArrayBinaryTree, iterSpec);`
  The begin (root) of a RightArrayBinaryTree.
- `void clear(rightArrayBinaryTree);`
  Resets a right-array-binary tree.
- `void createRightArrayBinaryTree(rightArrayBinaryTree, text);`
  Computes the right-array-binary tree of a text.
- `bool empty(rightArrayBinaryTree);`
  Checks whether or not a right-array-binary tree contains any elements.
- `TIterator end(rightArrayBinaryTree, iterSpec);`
  The end (rigthmost leaf) of a RightArrayBinaryTree.
- `TFibre getFibre(rightArrayBinaryTree, fibreTag);`
  Returns a specific fibre of a right-array-binary tree.
- `TSize length(rightArrayBinaryTree);`
  Returns the number of nodes in the right-array-binary-tree.
- `bool open(rightArrayBinaryTree, fileName [, openMode])`
  This functions loads a RightArrayBinaryTree from disk.
- `bool save(rightArrayBinaryTree, fileName [, openMode])`
  This functions saves a RightArrayBinaryTree to disk.

## Interface Functions Detail

### `TIterator begin(rightArrayBinaryTree, iterSpec);`

The begin (root) of a RightArrayBinaryTree.

#### Parameters

`rightArrayBinaryTree` | The right-array-binary tree.
`iterSpec` | A specialisation tag. Types: TopDown<>, TopDown<ParentLinks<> >.

#### Returns

`TIterator` | An iterator to the first item in `object`. Metafunctions: Metafunction.Iterator

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void clear(rightArrayBinaryTree);`

Resets a right-array-binary tree.

#### Parameters

`rightArrayBinaryTree` | The RightArrayBinaryTree to be cleared.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void createRightArrayBinaryTree(rightArrayBinaryTree, text);`

Computes the right-array-binary tree of a text.

#### Parameters

`rightArrayBinaryTree` | A wavelet tree structure.
`text` | A text.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool empty(rightArrayBinaryTree);`

Checks whether or not a right-array-binary tree contains any elements.

#### Parameters

`rightArrayBinaryTree` | The right-array-binary tree to be queried.

#### Returns

`bool` | Returns `true` if the rank-support-bit string is empty and `false` otherwise.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TIterator end(rightArrayBinaryTree, iterSpec);`

The end (rigthmost leaf) of a RightArrayBinaryTree.

#### Parameters

`rightArrayBinaryTree` | The right-array-binary tree.
`iterSpec` | A specialisation tag. Types: TopDown<>, TopDown<ParentLinks<> >.

#### Returns

`TIterator` | An iterator to the first item in `object`. Metafunctions: Metafunction.Iterator

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TFibre getFibre(rightArrayBinaryTree, fibreTag);`

Returns a specific fibre of a right-array-binary tree.

#### Parameters

`rightArrayBinaryTree` | The container holding the fibre.
`fibreTag` | A tag that identifies the Fibre. Types: RightArrayBinaryTree Fibres.

#### Returns

`TFibre` | A reference to the Fibre object.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TSize length(rightArrayBinaryTree);`

Returns the number of nodes in the right-array-binary-tree.

#### Parameters

`tree` | The right-array-binary-tree to query for its size.

#### Returns

`TSize` | The number of nodes in the right-array-binary-tree.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool open(rightArrayBinaryTree, fileName [, openMode])`

This functions loads a RightArrayBinaryTree from disk.

#### Parameters

`rightArrayBinaryTree` | The RightArrayBinaryTree.
`fileName` | C-style character string containing the file name.
`openMode` | The combination of flags defining how the file should be opened. To open a file read-only, write-only or to read and write use `OPEN_RDONLY`, `OPEN_WRONLY`, or `OPEN_RDWR`. To create or overwrite a file add `OPEN_CREATE`. To append a file if existing add `OPEN_APPEND`. To circumvent problems, files are always opened in binary mode. Default: `OPEN_RDWR | OPEN_CREATE | OPEN_APPEND`.

#### Returns

`bool` | A `bool` which is `true` on success.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool save(rightArrayBinaryTree, fileName [, openMode])`

This functions saves a RightArrayBinaryTree to disk.

#### Parameters

`rightArrayBinaryTree` | The RightArrayBinaryTree.
`fileName` | C-style character string containing the file name.
`openMode` | The combination of flags defining how the file should be opened. To open a file read-only, write-only or to read and write use `OPEN_RDONLY`, `OPEN_WRONLY`, or `OPEN_RDWR`. To create or overwrite a file add `OPEN_CREATE`. To append a file if existing add `OPEN_APPEND`. To circumvent problems, files are always opened in binary mode. Default: `OPEN_RDWR | OPEN_CREATE | OPEN_APPEND`.

#### Returns

`bool` | A `bool` which is `true` on success.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

#### Dox Sources

    /*!
     * @class RightArrayBinaryTree
     *
     * @headerfile <seqan/index.h>
     *
     * @brief A special format to encode the structure of a wavelet tree. The
     *        structure is very space efficient because only one position is stored
     *        which encodes where the left and right subtree of a given node exist.
     *
     * @signature template <typename TChar, typename TSpec> class
     *            RightArrayBinaryTree;
     *
     * @tparam TValue The type of the stored characters.
     * @tparam TSpec The wavelet tree structure specialisation. Default: void.
     *
     * @fn RightArrayBinaryTree#clear
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Resets a right-array-binary tree.
     *
     * @signature void clear(rightArrayBinaryTree);
     *
     * @param[in,out] rightArrayBinaryTree The RightArrayBinaryTree to be cleared.
     *
     * @fn RightArrayBinaryTree#createRightArrayBinaryTree
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Computes the right-array-binary tree of a text.
     *
     * @signature void createRightArrayBinaryTree(rightArrayBinaryTree, text);
     *
     * @param[in] rightArrayBinaryTree A wavelet tree structure.
     * @param[in] text A @link TextConcept text @endlink.
     *
     * @fn RightArrayBinaryTree#empty
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Checks whether or not a right-array-binary tree contains any elements.
     *
     * @signature bool empty(rightArrayBinaryTree);
     *
     * @param[in] rightArrayBinaryTree The right-array-binary tree to be queried.
     *
     * @return bool Returns <tt>true</tt> if the rank-support-bit string is empty
     *              and <tt>false</tt> otherwise.
     *
     * @fn RightArrayBinaryTree#getFibre
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns a specific fibre of a right-array-binary tree.
     *
     * @signature TFibre getFibre(rightArrayBinaryTree, fibreTag);
     *
     * @param[in] rightArrayBinaryTree  The container holding the fibre.
     * @param[in] fibreTag A tag that identifies the @link Fibre @endlink. Types:
     *                     @link RightArrayBinaryTreeFibres RightArrayBinaryTree
     *                     Fibres @endlink.
     *
     * @return TFibre A reference to the @link Fibre @endlink object.
     *
     * @fn RightArrayBinaryTree#length
     *
     * @brief Returns the number of nodes in the right-array-binary-tree.
     *
     * @signature TSize length(rightArrayBinaryTree);
     *
     * @param[in] tree The right-array-binary-tree to query for its size.
     *
     * @return TSize The number of nodes in the right-array-binary-tree.
     *
     * @fn RightArrayBinaryTree#open
     *
     * @headerfile <seqan/index.h>
     *
     * @brief This functions loads a @link RightArrayBinaryTree @endlink from disk.
     *
     * @signature bool open(rightArrayBinaryTree, fileName [, openMode])
     *
     * @param[in,out] rightArrayBinaryTree  The RightArrayBinaryTree.
     * @param[in] fileName C-style character string containing the file name.
     * @param[in] openMode The combination of flags defining how the file should be
     *                     opened. To open a file read-only, write-only or to read
     *                     and write use <tt>OPEN_RDONLY</tt>, <tt>OPEN_WRONLY</tt>,
     *                     or <tt>OPEN_RDWR</tt>. To create or overwrite a file add
     *                     <tt>OPEN_CREATE</tt>. To append a file if existing add
     *                     <tt>OPEN_APPEND</tt>. To circumvent problems, files are
     *                     always opened in binary mode. Default: <tt>OPEN_RDWR |
     *                     OPEN_CREATE | OPEN_APPEND</tt>.
     *
     * @return bool A <tt>bool</tt> which is <tt>true</tt> on success.
     *
     * @fn RightArrayBinaryTree#save
     *
     * @headerfile <seqan/index.h>
     *
     * @brief This functions saves a @link RightArrayBinaryTree @endlink to disk.
     *
     * @signature bool save(rightArrayBinaryTree, fileName [, openMode])
     *
     * @param[in,out] rightArrayBinaryTree  The RightArrayBinaryTree.
     * @param[in] fileName C-style character string containing the file name.
     * @param[in] openMode The combination of flags defining how the file should be
     *                     opened. To open a file read-only, write-only or to read
     *                     and write use <tt>OPEN_RDONLY</tt>, <tt>OPEN_WRONLY</tt>,
     *                     or <tt>OPEN_RDWR</tt>. To create or overwrite a file add
     *                     <tt>OPEN_CREATE</tt>. To append a file if existing add
     *                     <tt>OPEN_APPEND</tt>. To circumvent problems, files are
     *                     always opened in binary mode. Default: <tt>OPEN_RDWR |
     *                     OPEN_CREATE | OPEN_APPEND</tt>.
     *
     * @return bool A <tt>bool</tt> which is <tt>true</tt> on success.
     *
     * @fn RightArrayBinaryTree#begin
     *
     * @headerfile <seqan/index.h>
     *
     * @brief The begin (root) of a @link RightArrayBinaryTree @endlink.
     *
     * @signature TIterator begin(rightArrayBinaryTree, iterSpec);
     *
     * @param[in] rightArrayBinaryTree The right-array-binary tree.
     * @param[in] iterSpec A specialisation tag. Types: TopDown&lt;&gt;,
     *                     TopDown&lt;ParentLinks&lt;&gt; &gt;.
     *
     * @return TIterator An iterator to the first item in <tt>object</tt>.
     *                   Metafunctions: Metafunction.Iterator
     *
     * @fn RightArrayBinaryTree#end
     *
     * @headerfile <seqan/index.h>
     *
     * @brief The end (rigthmost leaf) of a @link RightArrayBinaryTree @endlink.
     *
     * @signature TIterator end(rightArrayBinaryTree, iterSpec);
     *
     * @param[in] rightArrayBinaryTree The right-array-binary tree.
     * @param[in] iterSpec A specialisation tag. Types: TopDown&lt;&gt;,
     *                     TopDown&lt;ParentLinks&lt;&gt; &gt;.
     *
     * @return TIterator An iterator to the first item in <tt>object</tt>.
     *                   Metafunctions: Metafunction.Iterator
     */