Free Touch Pricker
    Preparing search index...

    Class PatternGroup

    Group of patterns for concise reporting.

    It's useful to group related patterns together when analysing music. For example, we could check for all so-called CRUs in one pass:

    const group = new PatternGroup('CRUs', [
    new Pattern('4578'),
    new Pattern('4678'),
    // ...
    new Pattern('6578'),
    ]);
    group.match('43126578'); // true (matches)
    group.match('43125676'); // true
    group.match('43128765'); // false (doesn't match)
    group.matchCount; // 2
    group.print('text'); // '2 CRUs (1 5678, 1 6578)'

    It's also possible to match a single pattern while highlighting particular special cases. For example, we could check for reverse rollups but highlight back rounds:

    const group = new PatternGroup(
    '8765s',
    [new Pattern('87654321', 'Backrounds', MatchType.Row)],
    new Pattern('8765', null, MatchType.Front),
    );
    group.match('87654312'); // true
    group.match('87654321'); // true
    group.matchCount; // 2
    group.submatchCount; // 1
    group.print('text'); // '2 8765s (Backrounds)'

    Here the matchCount is overridden by the supplied parent pattern. The submatchCount is the sum of child pattern matches.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _name: string

    Name to use when printing results.

    _parentPattern?: Pattern

    Optional top-level pattern to override count.

    _patterns: Pattern[]

    Patterns in this group.

    print: Print

    Accessors

    Methods