# Spec IndexWotd
An index based on a lazy suffix tree (see Giegerich et al., "Efficient implementation of lazy suffix trees").

Extends | Index
Implements | StringTreeConcept
All Extended | Index
All Subcl's | IndexDfi
All Impl'd | StringTreeConcept
Defined in | <seqan/index.h>
Signature | `template <typename TText, typename TSpec> class Index<TText, IndexWotd<TSpec> >;`

## Template Parameters

`TText` | The TextConcept text type.
`TSpec` | The type for further specialization of the Index type.

## Member Function Overview

- `Index::Index();, Index::Index(index);, Index::Index(text);`
  Constructor

## Interface Function Overview

- `void createWotdIndex(sa, dir, text);`
  Builds a the WOTD index.
- `TFibre dirAt(position, index);`
  Shortcut for `value(indexDir(index), position)`.
- `TFibre indexDir(index);`
  Shortcut for `getFibre(.., WotdDir())`.
- `TSa indexSA(index);`
  Shortcut for `getFibre(.., WotdSA)`.
- `TValue saAt(position, index);`
  Shortcut for `value(indexSA(..), ..)`.

### Interface Functions Inherited From Index

- `clear`
- `countSequences`
- `getFibre`
- `indexCreate`
- `indexRawText`
- `indexRequire`
- `indexSupplied`
- `indexText`
- `length`
- `open`
- `rawtextAt`
- `save`

### Interface Functions Inherited From StringTreeConcept

- `resizeVertexMap`
- `begin`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Index

- `DefaultIndexCreator`
- `DefaultIndexSpec`
- `DefaultIndexStringSpec`
- `GetVSTreeIteratorTraits`
- `Size`

### Interface Metafunctions Inherited From StringTreeConcept

- `Iterator`
- `VertexDescriptor`

## Detailed Description

The fibres (see Index and Fibre) of this index are a partially sorted suffix array (see WotdSA) and the wotd tree (see WotdDir).

Demo: Demo.Constraint Iterator

## See Also

- WOTDIndexFibres

## Member Functions Detail

### `Index::Index(); Index::Index(index); Index::Index(text);`

Constructor

#### Parameters

`index` | Other Index object to copy from.
`text` | The text to be indexed.

#### Data Races

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

## Interface Functions Detail

### `void createWotdIndex(sa, dir, text);`

Builds a the WOTD index.

#### Parameters

`sa` | The resulting list in which all q-grams are sorted alphabetically.
`dir` | The resulting array that indicates at which position in index the corresponding q-grams can be found.
`text` | The sequence. Types: ContainerConcept

The resulting `index` contains the sorted list of qgrams. For each possible q-gram pos contains the first position in index that corresponds to this q-gram.

#### Data Races

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

### `TFibre dirAt(position, index);`

Shortcut for `value(indexDir(index), position)`.

#### Parameters

`index` | The IndexWotd object holding the fibre.
`position` | A position in the array on which the value should be accessed.

#### Returns

`TFibre` | A reference to the WotdDir fibre.

#### Data Races

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

### `TFibre indexDir(index);`

Shortcut for `getFibre(.., WotdDir())`.

#### Parameters

`index` | The IndexWotd object holding the fibre.

#### Returns

`TFibre` | A reference to the WotdDir fibre (tree structure).

#### Data Races

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

### `TSa indexSA(index);`

Shortcut for `getFibre(.., WotdSA)`.

#### Parameters

`index` | The IndexWotd object holding the fibre.

#### Returns

`TSa` | A reference to the WotdSA fibre (partially sorted suffix array).

#### Data Races

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

### `TValue saAt(position, index);`

Note.

Advanced functionality, not commonly used.

Shortcut for `value(indexSA(..), ..)`.

#### Parameters

`index` | The IndexWotd object holding the fibre.
`position` | A position in the array on which the value should be accessed.

#### Returns

`TValue` | A reference or proxy to the value in the WotdSA fibre. To be more precise, a reference to a position containing a value of type SAValue is returned (or a proxy).

#### Data Races

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

#### Dox Sources

    /*!
     * @class IndexWotd
     *
     * @implements StringTreeConcept
     *
     * @extends Index
     *
     * @headerfile <seqan/index.h>
     *
     * @brief An index based on a lazy suffix tree (see Giegerich et al., "Efficient
     *        implementation of lazy suffix trees").
     *
     * @signature template <typename TText, typename TSpec> class Index<TText,
     *            IndexWotd<TSpec> >;
     *
     * @tparam TText The @link TextConcept @endlink text type.
     * @tparam TSpec The type for further specialization of the Index type.
     *
     * The fibres (see @link Index @endlink and @link Fibre @endlink) of this index
     * are a partially sorted suffix array (see @link WOTDIndexFibres#WotdSA
     * @endlink) and the wotd tree (see @link WOTDIndexFibres#WotdDir @endlink).
     *
     * Demo: Demo.Constraint Iterator
     *
     * @see WOTDIndexFibres
     *
     * @fn IndexWotd::Index
     *
     * @brief Constructor
     *
     * @signature Index::Index();
     * @signature Index::Index(index);
     * @signature Index::Index(text);
     *
     * @param[in] index Other Index object to copy from.
     * @param[in] text The text to be indexed.
     *
     * @fn IndexWotd#indexSA
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Shortcut for <tt>getFibre(.., WotdSA)</tt>.
     *
     * @signature TSa indexSA(index);
     *
     * @param[in] index The @link IndexWotd @endlink object holding the fibre.
     *
     * @return TSa A reference to the @link WOTDIndexFibres#WotdSA @endlink fibre
     *             (partially sorted suffix array).
     *
     * @fn IndexWotd#indexDir
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Shortcut for <tt>getFibre(.., WotdDir())</tt>.
     *
     * @signature TFibre indexDir(index);
     *
     * @param[in] index The @link IndexWotd @endlink object holding the fibre.
     *
     * @return TFibre A reference to the @link WOTDIndexFibres#WotdDir @endlink
     *                fibre (tree structure).
     *
     * @fn IndexWotd#saAt
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Shortcut for <tt>value(indexSA(..), ..)</tt>.
     *
     * @note Advanced functionality, not commonly used.
     *
     * @signature TValue saAt(position, index);
     *
     * @param[in] index The @link IndexWotd @endlink object holding the fibre.
     * @param[in] position A position in the array on which the value should be
     *                     accessed.
     *
     * @return TValue A reference or proxy to the value in the @link
     *                WOTDIndexFibres#WotdSA @endlink fibre. To be more precise, a
     *                reference to a position containing a value of type @link
     *                SAValue @endlink is returned (or a proxy).
     *
     * @fn IndexWotd#dirAt
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Shortcut for <tt>value(indexDir(index), position)</tt>.
     *
     * @signature TFibre dirAt(position, index);
     *
     * @param[in] index The @link IndexWotd @endlink object holding the fibre.
     * @param[in] position A position in the array on which the value should be
     *                     accessed.
     *
     * @return TFibre A reference to the @link WOTDIndexFibres#WotdDir @endlink
     *                fibre.
     *
     * @fn IndexWotd#createWotdIndex
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Builds a the WOTD index.
     *
     * @signature void createWotdIndex(sa, dir, text);
     *
     * @param[out] sa The resulting list in which all <i>q</i>-grams are sorted
     *                alphabetically.
     * @param[out] dir The resulting array that indicates at which position in index
     *                 the corresponding <i>q</i>-grams can be found.
     * @param[in] text The sequence. Types: @link ContainerConcept @endlink
     *
     * The resulting <tt>index</tt> contains the sorted list of qgrams. For each
     * possible <i>q</i>-gram pos contains the first position in index that
     * corresponds to this <i>q</i>-gram.
     */