## SwamiLoopFinder SwamiLoopFinder |

## Synopsis

                        SwamiLoopFinder;
    SwamiLoopFinder *   swami_loop_finder_new               (void);
    void                swami_loop_finder_full_search       (SwamiLoopFinder *finder);
    gboolean            swami_loop_finder_verify_params     (SwamiLoopFinder *finder,
                                                             gboolean nudge,
                                                             GError **err);
    gboolean            swami_loop_finder_find              (SwamiLoopFinder *finder,
                                                             GError **err);
    SwamiLoopResults *  swami_loop_finder_get_results       (SwamiLoopFinder *finder);

## Object Hierarchy

      GObject
       +----SwamiLock
             +----SwamiLoopFinder

## Properties

      "active"                   gboolean              : Read
      "analysis-window"          gint                  : Read / Write
      "cancel"                   gboolean              : Read / Write
      "exec-time"                guint                 : Read
      "group-pos-diff"           gint                  : Read / Write
      "group-size-diff"          gint                  : Read / Write
      "max-results"              gint                  : Read / Write
      "min-loop-size"            gint                  : Read / Write
      "progress"                 gfloat                : Read / Write
      "results"                  SwamiLoopResults*     : Read
      "sample"                   IpatchSample*         : Read / Write
      "window1-end"              gint                  : Read / Write
      "window1-start"            gint                  : Read / Write
      "window2-end"              gint                  : Read / Write
      "window2-start"            gint                  : Read / Write

## Description

## Details

### SwamiLoopFinder

    typedef struct _SwamiLoopFinder SwamiLoopFinder;

### swami_loop_finder_new ()

    SwamiLoopFinder *   swami_loop_finder_new               (void);

Create a new sample loop finder object.

Returns : | New object of type SwamiLoopFinder

### swami_loop_finder_full_search ()

    void                swami_loop_finder_full_search       (SwamiLoopFinder *finder);

Configures a loop finder to do a full loop search of the assigned sample. Note that a sample must have already been assigned and the "analysis-window" and "min-loop-size" parameters should be valid for it. This means: (finder->analysis_window <= finder->sample_size) && (finder->sample_size - finder->analysis_window) >= finder->min_loop_size.

`finder` : | Loop finder object

### swami_loop_finder_verify_params ()

    gboolean            swami_loop_finder_verify_params     (SwamiLoopFinder *finder,
                                                             gboolean nudge,
                                                             GError **err);

Verify a loop finder's parameters. If the `nudge` parameter is `TRUE` then corrections will be made to start and end loop search windows if necessary (changed to fit within sample and analysis window and swapped if windows are backwards).

Note that the other parameters will not be corrected and will still cause errors if wacked. Nudged values are only changed if `TRUE` is returned.

`finder` : | Loop finder object
`nudge` : | `TRUE` to nudge start and end loop search windows into compliance
`err` : | Location to store error message or `NULL` to ignore
Returns : | `TRUE` on success, `FALSE` if there is a problem with the loop finder parameters (error may be stored in `err`).

### swami_loop_finder_find ()

    gboolean            swami_loop_finder_find              (SwamiLoopFinder *finder,
                                                             GError **err);

Execute the loop find operation. This function blocks until operation is finished or the "cancel" property is assigned `TRUE`. The "progress" parameter is updated periodically with the current progress value (between 0.0 and 1.0).

Note: Not thread safe. Properties should be assigned, this function called and the results retrieved with `swami_loop_finder_get_results()` in a serialized fashion. As long as this is ensured, creating a separate thread to call this function will be OK. The results can only be accessed up until the next call to this function.

`finder` : | Loop finder object
`err` : | Location to store error info or `NULL` to ignore
Returns : | TRUE on success, FALSE if the find parameter values are invalid or operation was cancelled (in which case `err` may be set).

### swami_loop_finder_get_results ()

    SwamiLoopResults *  swami_loop_finder_get_results       (SwamiLoopFinder *finder);

Get the loop results object from a loop finder.

`finder` : | Loop finder object
Returns : | Loop results object or `NULL` if none (if `swami_loop_finder_find()` has not yet been called or was canceled). The caller owns a reference to the returned object and should unref it when completed.

## Property Details

### The `"active"` property

      "active"                   gboolean              : Read

Active.

Default value: FALSE

### The `"analysis-window"` property

      "analysis-window"          gint                  : Read / Write

Size of analysis window.

Allowed values: >= 1

Default value: 17

### The `"cancel"` property

      "cancel"                   gboolean              : Read / Write

Cancel.

Default value: FALSE

### The `"exec-time"` property

      "exec-time"                guint                 : Read

Execution time in milliseconds.

Default value: 0

### The `"group-pos-diff"` property

      "group-pos-diff"           gint                  : Read / Write

Min difference of loop position of separate groups.

Allowed values: >= 0

Default value: 20

### The `"group-size-diff"` property

      "group-size-diff"          gint                  : Read / Write

Min difference of loop size of separate groups.

Allowed values: >= 0

Default value: 0

### The `"max-results"` property

      "max-results"              gint                  : Read / Write

Max results.

Allowed values: [1,4000]

Default value: 200

### The `"min-loop-size"` property

      "min-loop-size"            gint                  : Read / Write

Minimum size of matching loops.

Allowed values: >= 1

Default value: 10

### The `"progress"` property

      "progress"                 gfloat                : Read / Write

Progress.

Allowed values: [0,1]

Default value: 0

### The `"results"` property

      "results"                  SwamiLoopResults*     : Read

Loop results object.

### The `"sample"` property

      "sample"                   IpatchSample*         : Read / Write

Sample data object.

### The `"window1-end"` property

      "window1-end"              gint                  : Read / Write

First window end position.

Allowed values: >= 0

Default value: 0

### The `"window1-start"` property

      "window1-start"            gint                  : Read / Write

First window start position.

Allowed values: >= 0

Default value: 0

### The `"window2-end"` property

      "window2-end"              gint                  : Read / Write

Second window end position.

Allowed values: >= 0

Default value: 0

### The `"window2-start"` property

      "window2-start"            gint                  : Read / Write

Second window start position.

Allowed values: >= 0

Default value: 0