# Class Pattern
Holds the needle and preprocessing data (depends on algorithm).

All Subcl's | AbndmAlgoPattern, AhoCorasickPattern, BfamPattern, BndmAlgoPattern, DPSearchPattern, HammingSimplePattern, HierarchicalPexPattern, HorspoolPattern, MultiBfamPattern, MultipleShiftAndPattern, MyersPattern, NonHierarchicalPexPattern, OracleBfamPattern, OracleMultiBfamPattern, PexPattern, PigeonholePattern, SetHorspoolPattern, ShiftAndPattern, ShiftOrPattern, SimplePattern, SwiftLocalPattern, SwiftPattern, SwiftSemiGlobalPattern, TrieBfamPattern, WildShiftAndPattern, WuManberPattern
Defined in | <seqan/find.h>
Signature | `template <typename TNeedle[, typename TSpec]> class Pattern;`

## Template Parameters

`TNeedle` | The needle type. Types: TextConcept.
`TSpec` | A tag that specifies the online algorithm to use for the search. Defaults to the result of DefaultPattern.

## Interface Function Overview

- `TScoreValue getBeginScore(pattern);`
  Score of the last match found by findBegin during approximate searching.
- `THost host(pattern);`
  Query a Pattern for its host.
- `TNeedle needle(pattern);`
  Returns the needle of a Pattern object (not implemented for some online-algorithms).
- `TPosition position(pattern);`
  Return the position of the last match in the pattern.
- `TScoringScheme scoringScheme(pattern);`
  The scoring scheme used for finding or aligning.
- `void setNeedle(pattern, needle);`
  Sets the needle of a Pattern object and optionall induces preprocessing.
- `void setScoringScheme(pattern, score);`
  Sets the scoring scheme used for finding or aligning.

## Interface Metafunction Overview

- `Container<TPattern>::Type;`
  Returns the needle type of the pattern.
- `Difference<TPattern>::Type;`
  Returns the difference type of the underlying pattern.
- `Host<TPattern>::Type;`
  Returns the host type of the pattern.
- `Needle<TPattern>::Type;`
  Returns the needle type of a Pattern type.
- `PexMultiFinder<Pattern<TNeedle,Pex<TVerification, TMultiFinder> > >::Type;`
  Determines the multiple exact string matching algorithm used by the Pex algorithm.
- `Position<TPattern>::Type;`
  Returns the position type of the underlying pattern.
- `ScoringScheme<TPattern>::Type;`
  Returns the scoring scheme type of an approximate search algorithm.
- `Size<TPattern>::Type;`
  Returns the size type of the underlying pattern.
- `Value<TPattern>::Type;`
  Returns the value type of the underlying pattern.

## Detailed Description

If `Needle` is a StringSet then `position(pattern)` returns a Pair with the index of the currently matching needle and the position in the needle.

## Interface Functions Detail

### `TScoreValue getBeginScore(pattern);`

Score of the last match found by findBegin during approximate searching.

#### Parameters

`pattern` | A Pattern that can be used for approximate searching.

#### Returns

`TScoreValue` | The score of the lst match found using `pattern`. The value is set after successfully call of findBegin. If no match was found, the value is undefined.

#### Data Races

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

### `THost host(pattern);`

Query a Pattern for its host.

#### Parameters

`pattern` | The Pattern to query for its host.

#### Returns

`THost` | Reference to the host.

#### Data Races

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

### `TNeedle needle(pattern);`

Returns the needle of a Pattern object (not implemented for some online-algorithms).

#### Parameters

`pattern` | The Pattern to query for its needle.

#### Returns

`TNeedle` | Reference of the needle object.

TNeedle is the result of the Needle metafunction of TPattern. This is an alias to the function host.

#### Data Races

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

### `TPosition position(pattern);`

Return the position of the last match in the pattern.

#### Parameters

`pattern` | The Pattern to query for its position.

#### Returns

`TPosition` | The position of the last match in the pattern.

#### Data Races

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

### `TScoringScheme scoringScheme(pattern);`

The scoring scheme used for finding or aligning.

#### Parameters

`pattern` | The Pattern to query for its scoring scheme.

#### Returns

`TScoringScheme` | The scoring scheme of the pattern.

#### Data Races

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

### `void setNeedle(pattern, needle);`

Sets the needle of a Pattern object and optionall induces preprocessing.

#### Parameters

`pattern` | The pattern to set the needle for.
`needle` | The needle to set.

#### Data Races

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

### `void setScoringScheme(pattern, score);`

Sets the scoring scheme used for finding or aligning.

#### Parameters

`pattern` | The pattern to set the scoring scheme for.
`score` | The scoring scheme to set.

#### Data Races

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

## Interface Metafunctions Detail

### `Container<TPattern>::Type;`

Returns the needle type of the pattern.

#### Template Parameters

`TPattern` | The pattern to query for its needle type.

#### Returns

`Type` | The needle type.

### `Difference<TPattern>::Type;`

Returns the difference type of the underlying pattern.

#### Template Parameters

`TPattern` | The Pattern to query.

#### Returns

`Type` | The difference type.

### `Host<TPattern>::Type;`

Returns the host type of the pattern.

#### Template Parameters

`TPattern` | The pattern to query for its host type.

#### Returns

`Type` | The host type.

### `Needle<TPattern>::Type;`

Returns the needle type of a Pattern type.

#### Template Parameters

`TPattern` | The pattern type to query.

#### Returns

`Type` | The needle type of `TPattern</tt., i.e. `TNeedle` for `Pattern<TNeedle, TSpec>`.`

### `PexMultiFinder<Pattern<TNeedle,Pex<TVerification, TMultiFinder> > >::Type;`

Determines the multiple exact string matching algorithm used by the Pex algorithm.

#### Template Parameters

`TMultiFinder` | The specification for the multiple exact string matching algorithm that should be used with the Pex algorithm.

#### Returns

`Type` | Pattern type of the multiple exact string matching algorithm for the specified Pattern.

For a description of Pattern usage, see Pattern.

Overload this metafunction if you want to use something else for verification then `Pattern<String<Segment&l;tNeedle> >, TMultiFinder>`.

### `Position<TPattern>::Type;`

Returns the position type of the underlying pattern.

#### Template Parameters

`TPattern` | The Pattern to query.

#### Returns

`Type` | The position type.

### `ScoringScheme<TPattern>::Type;`

Returns the scoring scheme type of an approximate search algorithm.

#### Template Parameters

`TPattern` | The Pattern to query for its scoring scheme type. Default: EditDistanceScore.

### `Size<TPattern>::Type;`

Returns the size type of the underlying pattern.

#### Template Parameters

`TPattern` | The Pattern to query.

#### Returns

`Type` | The size type.

### `Value<TPattern>::Type;`

Returns the value type of the underlying pattern.

#### Template Parameters

`TPattern` | The Pattern to query.

#### Returns

`Type` | The value type.

#### Dox Sources

    /*!
     * @class Pattern
     *
     * @headerfile <seqan/find.h>
     *
     * @brief Holds the needle and preprocessing data (depends on algorithm).
     *
     * @signature template <typename TNeedle[, typename TSpec]> class Pattern;
     *
     * @tparam TNeedle The needle type. Types: @link TextConcept @endlink.
     * @tparam TSpec A tag that specifies the online algorithm to use for the
     *               search. Defaults to the result of @link DefaultPattern
     *               @endlink.
     *
     * If <tt>Needle</tt> is a StringSet then <tt>position(pattern)</tt> returns a
     * @link Pair @endlink with the index of the currently matching needle and the
     * position in the needle.
     *
     * @mfn Pattern#Needle
     *
     * @headerfile <seqan/find.h>
     *
     * @brief Returns the needle type of a @link Pattern @endlink type.
     *
     * @signature Needle<TPattern>::Type;
     *
     * @tparam TPattern The pattern type to query.
     *
     * @return Type The needle type of <tt>TPattern</tt., i.e. <tt>TNeedle</tt> for
     *              <tt>Pattern&lt;TNeedle, TSpec&gt;</tt>.
     *
     * @mfn Pattern#PexMultiFinder
     *
     * @headerfile <seqan/find.h>
     *
     * @brief Determines the multiple exact string matching algorithm used by the
     *        Pex algorithm.
     *
     * @signature PexMultiFinder<Pattern<TNeedle,Pex<TVerification, TMultiFinder> >
     *            >::Type;
     *
     * @tparam TMultiFinder The specification for the multiple exact string matching
     *                      algorithm that should be used with the Pex algorithm.
     *
     * @return Type Pattern type of the multiple exact string matching algorithm for
     *              the specified Pattern.
     *
     * For a description of Pattern usage, see @link Pattern @endlink.
     *
     * Overload this metafunction if you want to use something else for verification
     * then <tt>Pattern&lt;String&lt;Segment&l;tNeedle&gt; &gt;,
     * TMultiFinder&gt;</tt>.
     *
     * @mfn Pattern#Container
     *
     * @brief Returns the needle type of the pattern.
     *
     * @signature Container<TPattern>::Type;
     *
     * @tparam TPattern The pattern to query for its needle type.
     *
     * @return Type The needle type.
     *
     * @mfn Pattern#Host
     *
     * @brief Returns the host type of the pattern.
     *
     * @signature Host<TPattern>::Type;
     *
     * @tparam TPattern The pattern to query for its host type.
     *
     * @return Type The host type.
     *
     * @mfn Pattern#Value
     *
     * @brief Returns the value type of the underlying pattern.
     *
     * @signature Value<TPattern>::Type;
     *
     * @tparam TPattern The Pattern to query.
     *
     * @return Type The value type.
     *
     * @mfn Pattern#Position
     *
     * @brief Returns the position type of the underlying pattern.
     *
     * @signature Position<TPattern>::Type;
     *
     * @tparam TPattern The Pattern to query.
     *
     * @return Type The position type.
     *
     * @mfn Pattern#Difference
     *
     * @brief Returns the difference type of the underlying pattern.
     *
     * @signature Difference<TPattern>::Type;
     *
     * @tparam TPattern The Pattern to query.
     *
     * @return Type The difference type.
     *
     * @mfn Pattern#Size
     *
     * @brief Returns the size type of the underlying pattern.
     *
     * @signature Size<TPattern>::Type;
     *
     * @tparam TPattern The Pattern to query.
     *
     * @return Type The size type.
     *
     * @mfn Pattern#ScoringScheme
     *
     * @brief Returns the scoring scheme type of an approximate search algorithm.
     *
     * @signature ScoringScheme<TPattern>::Type;
     *
     * @tparam TPattern The Pattern to query for its scoring scheme type. Default:
     *                  EditDistanceScore.
     *
     * @fn Pattern#getBeginScore
     *
     * @headerfile <seqan/find.h>
     *
     * @brief Score of the last match found by @link Finder#findBegin @endlink
     *        during approximate searching.
     *
     * @signature TScoreValue getBeginScore(pattern);
     *
     * @param[in] pattern A Pattern that can be used for approximate searching.
     *
     * @return TScoreValue The score of the lst match found using <tt>pattern</tt>.
     *                     The value is set after successfully call of @link
     *                     Finder#findBegin @endlink. If no match was found, the
     *                     value is undefined.
     *
     * @fn Pattern#host
     *
     * @brief Query a Pattern for its host.
     *
     * @signature THost host(pattern);
     *
     * @param[in] pattern The Pattern to query for its host.
     *
     * @return THost Reference to the host.
     *
     * @fn Pattern#needle
     *
     * @brief Returns the needle of a @link Pattern @endlink object (not implemented
     *        for some online-algorithms).
     *
     * @signature TNeedle needle(pattern);
     *
     * @param[in] pattern The Pattern to query for its needle.
     *
     * @return TNeedle Reference of the needle object.
     *
     * TNeedle is the result of the Needle metafunction of TPattern. This is an
     * alias to the function @link Pattern#host @endlink.
     *
     * @fn Pattern#position
     *
     * @brief Return the position of the last match in the pattern.
     *
     * @signature TPosition position(pattern);
     *
     * @param[in] pattern The Pattern to query for its position.
     *
     * @return TPosition The position of the last match in the pattern.
     *
     * @fn Pattern#setNeedle
     *
     * @brief Sets the needle of a Pattern object and optionall induces
     *        preprocessing.
     *
     * @signature void setNeedle(pattern, needle);
     *
     * @param[in,out] pattern The pattern to set the needle for.
     * @param[in] needle The needle to set.
     *
     * @fn Pattern#scoringScheme
     *
     * @brief The scoring scheme used for finding or aligning.
     *
     * @signature TScoringScheme scoringScheme(pattern);
     *
     * @param[in] pattern The Pattern to query for its scoring scheme.
     *
     * @return TScoringScheme The scoring scheme of the pattern.
     *
     * @fn Pattern#setScoringScheme
     *
     * @brief Sets the scoring scheme used for finding or aligning.
     *
     * @signature void setScoringScheme(pattern, score);
     *
     * @param[in,out] pattern The pattern to set the scoring scheme for.
     * @param[in] score The scoring scheme to set.
     */