# Spec SwiftFinder
Finder for SWIFT search, must be used together with SwiftPattern.

Extends | Finder
All Extended | Finder
All Subcl's | SwiftLocalFinder, SwiftSemiGlobalFinder
Defined in | <seqan/index.h>
Signature | `template <typename THaystack, typename TSpec> class Finder<THaystack, Swift<TSpec> >;`

## Template Parameters

`TSpec` | Specifies the type of Swift filter.
`THaystack` | A haystack type. Types: Index, String, StringSet.

## Member Function Overview

### Member Functions Inherited From Finder

- `Finder`

## Interface Function Overview

- `THitString getWindowFindHits(finder);`
  Returns the string of hits from the finder.
- `TPair positionRange(finder);`
  Returns a pair of the begin and end position in the haystack or needle for the last hit found.
- `TPair positionRangeNoClip(finder);`
  Returns a pair of the begin and end position in or beyond the haystack or needle for the last hit found.
- `bool windowFindBegin(finder, pattern, errorRate);`
  Initializes the pattern. Sets the finder on the begin position. Gets the first non-repeat range and sets it in the finder. Used together with windowFindEnd.
- `void windowFindEnd(finder, pattern);`
  Flushes the finder. Used together with windowFindBegin and windowFindNext.
- `bool windowFindNext(finder, pattern, finderWindowLength)`
  Searches over the next window with the finder. The found hits can be retrieved with getWindowFindHits. Used together with windowFindBegin and windowFindEnd.

### Interface Functions Inherited From Finder

- `begin`
- `beginPosition`
- `clear`
- `end`
- `endPosition`
- `find`
- `findBegin`
- `goBegin`
- `goEnd`
- `haystack`
- `infix`
- `length`
- `position`
- `setHaystack`
- `setPosition`

## Member Typedef Overview

- `typedef (...) SwiftFinder::THitString;`
  The type to use for the hit string returned in getWindowFindHits.

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Finder

- `Haystack`

## Detailed Description

See SwiftPattern for an overview of the SWIFT algorithm.

## See Also

- SwiftPattern

## Interface Functions Detail

### `THitString getWindowFindHits(finder);`

Returns the string of hits from the finder.

#### Parameters

`finder` | A finder with window interface.

#### Returns

`THitString` | String of hits, see THitString.

#### Data Races

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

#### See Also

- windowFindNext

### `TPair positionRange(finder);`

Returns a pair of the begin and end position in the haystack or needle for the last hit found.

#### Parameters

`finder` | A Finder object.

#### Returns

`TPair` | A Pair of the begin and end position in the haystack or needle for the last hit found. The return type is `Pair<typename SAValue<THost&g;::Type>` if `THost` is the type of haystack or needle.

#### Data Races

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

#### See Also

- beginPosition
- endPosition
- positionRangeNoClip

### `TPair positionRangeNoClip(finder);`

Returns a pair of the begin and end position in or beyond the haystack or needle for the last hit found.

#### Parameters

`finder` | A SwiftFinder object to query.

#### Returns

`TPair` | A pair of the begin and end position in the haystack or needle for the last hit found. These positions could be negative or beyond the end of `finder` or `pattern` when using filter algorithms. The return type is `Pair<typename SAValue<THost>::Type>` if `THost` is the type of haystack or needle.

#### Data Races

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

#### See Also

- positionRange
- positionRangeNoClip

### `bool windowFindBegin(finder, pattern, errorRate);`

Initializes the pattern. Sets the finder on the begin position. Gets the first non-repeat range and sets it in the finder. Used together with windowFindEnd.

#### Parameters

`finder` | A finder with window interface.
`pattern` | A pattern with window interface. Types: SwiftPattern.
`errorRate` | Error rate that is allowed between reads and reference. Should be the same in as in windowFindNext. Types: `double`

#### Returns

`bool` | `true` if there were bases to be scanned and `false` otherwise.

#### Data Races

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

#### See Also

- windowFindEnd
- windowFindNext

### `void windowFindEnd(finder, pattern);`

Flushes the finder. Used together with windowFindBegin and windowFindNext.

#### Parameters

`finder` | A finder with window interface.
`pattern` | A pattern with window interface. Types: SwiftPattern

#### Data Races

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

#### See Also

- windowFindBegin
- windowFindNext

### `bool windowFindNext(finder, pattern, finderWindowLength)`

Searches over the next window with the finder. The found hits can be retrieved with getWindowFindHits. Used together with windowFindBegin and windowFindEnd.

#### Parameters

`finder` | A SwiftFinder.
`pattern` | A SwiftPattern.
`finderWindowLength` | Number of bases that are scanned beginning from the position the finder is at. Including bases that are marked as repeats and that are skipped. Types: nolink:unsigned int

#### Returns

`bool` | `true`, if there are bases that can be scanned, `false` otherwise.

#### Data Races

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

#### See Also

- getWindowFindHits
- windowFindBegin
- windowFindEnd

## Member Typedef Detail

### `typedef (...) SwiftFinder::THitString;`

The type to use for the hit string returned in getWindowFindHits.

#### Dox Sources

    /*!
     * @class SwiftFinder
     *
     * @extends Finder
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Finder for SWIFT search, must be used together with @link SwiftPattern
     *        @endlink.
     *
     * @signature template <typename THaystack, typename TSpec> class
     *            Finder<THaystack, Swift<TSpec> >;
     *
     * @tparam TSpec Specifies the type of Swift filter.
     * @tparam THaystack A haystack type. Types: @link Index @endlink, @link String
     *                   @endlink, @link StringSet @endlink.
     *
     * See @link SwiftPattern @endlink for an overview of the SWIFT algorithm.
     *
     * @see SwiftPattern
     *
     * @typedef SwiftFinder::THitString
     *
     * @brief The type to use for the hit string returned in @link
     *        SwiftFinder#getWindowFindHits @endlink.
     *
     * @signature typedef (...) SwiftFinder::THitString;
     *
     * @fn SwiftFinder#positionRangeNoClip
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns a pair of the begin and end position in or beyond the haystack
     *        or needle for the last hit found.
     *
     * @signature TPair positionRangeNoClip(finder);
     *
     * @param[in] finder A SwiftFinder object to query.
     *
     * @return TPair A pair of the begin and end position in the haystack or needle
     *               for the last hit found. These positions could be negative or
     *               beyond the end of <tt>finder</tt> or <tt>pattern</tt> when
     *               using filter algorithms. The return type is
     *               <tt>Pair&lt;typename SAValue&lt;THost&gt;::Type&gt;</tt> if
     *               <tt>THost</tt> is the type of haystack or needle.
     *
     * @see SwiftFinder#positionRange
     * @see SwiftPattern#positionRangeNoClip
     *
     * @fn SwiftFinder#positionRange
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns a pair of the begin and end position in the haystack or needle
     *        for the last hit found.
     *
     * @signature TPair positionRange(finder);
     *
     * @param[in] finder A @link Finder @endlink object.
     *
     * @return TPair A @link Pair @endlink of the begin and end position in the
     *               haystack or needle for the last hit found. The return type is
     *               <tt>Pair&lt;typename SAValue&ltTHost&g;::Type&gt;</tt> if
     *               <tt>THost</tt> is the type of haystack or needle.
     *
     * @see Finder#beginPosition
     * @see Finder#endPosition
     * @see SwiftFinder#positionRangeNoClip
     *
     * @fn SwiftFinder#windowFindBegin
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Initializes the pattern. Sets the finder on the begin position. Gets
     *        the first non-repeat range and sets it in the finder. Used together
     *        with @link SwiftFinder#windowFindEnd @endlink.
     *
     * @signature bool windowFindBegin(finder, pattern, errorRate);
     *
     * @param[in,out] finder A finder with window interface.
     * @param[in,out] pattern A pattern with window interface. Types: @link
     *                        SwiftPattern @endlink.
     * @param[in] errorRate Error rate that is allowed between reads and reference.
     *                      Should be the same in as in @link
     *                      SwiftFinder#windowFindNext @endlink. Types:
     *                      <tt>double</tt>
     *
     * @return bool <tt>true</tt> if there were bases to be scanned and
     *              <tt>false</tt> otherwise.
     *
     * @see SwiftFinder#windowFindNext
     * @see SwiftFinder#windowFindEnd
     *
     * @fn SwiftFinder#windowFindNext
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Searches over the next window with the finder. The found hits can be
     *        retrieved with @link SwiftFinder#getWindowFindHits @endlink. Used
     *        together with @link SwiftFinder#windowFindBegin @endlink and @link
     *        SwiftFinder#windowFindEnd @endlink.
     *
     * @signature bool windowFindNext(finder, pattern, finderWindowLength)
     *
     * @param[in,out] finder A SwiftFinder.
     * @param[in,out] pattern A SwiftPattern.
     * @param[in] finderWindowLength Number of bases that are scanned beginning from
     *                               the position the finder is at. Including bases
     *                               that are marked as repeats and that are
     *                               skipped. Types: nolink:unsigned int
     *
     * @return bool <tt>true</tt>, if there are bases that can be scanned,
     *              <tt>false</tt> otherwise.
     *
     * @see SwiftFinder#windowFindBegin
     * @see SwiftFinder#windowFindEnd
     * @see SwiftFinder#getWindowFindHits
     *
     * @fn SwiftFinder#windowFindEnd
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Flushes the finder. Used together with @link
     *        SwiftFinder#windowFindBegin @endlink and @link
     *        SwiftFinder#windowFindNext @endlink.
     *
     * @signature void windowFindEnd(finder, pattern);
     *
     * @param[in,out] finder A finder with window interface.
     * @param[in,out] pattern A pattern with window interface. Types: @link
     *                        SwiftPattern @endlink
     *
     * @see SwiftFinder#windowFindBegin
     * @see SwiftFinder#windowFindNext
     *
     * @fn SwiftFinder#getWindowFindHits
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns the string of hits from the finder.
     *
     * @signature THitString getWindowFindHits(finder);
     *
     * @param[in] finder A finder with window interface.
     *
     * @return THitString @link String @endlink of hits, see @link
     *                    SwiftFinder::THitString @endlink.
     *
     * @see SwiftFinder#windowFindNext
     */