Global

Methods

(private) abuts(run1, run2) → {boolean}

Comparison operator that determines if given runs are consecutive with one another.

Both parameters are assumed to be ordered arrays.

Note: This operator is commutative.

Parameters:
Name Type Description
run1 Array.<number>

first run

run2 Array.<number>

second run

Returns:

true iff run1 is consecutive with run2

Type
boolean

(private) makeRun(start, stopopt)

Preps start and stop params into order array

Utility function called by both select() and deselect().

Parameters:
Name Type Attributes Default Description
start number | Array.<number>

Start of run. if array, start and stop are taken from first two elements.

stop number <optional>
start

End of run (inclusive).

(private) merge(run1, run2) → {Array.<number>}

Operator that merges given runs.

Both parameters are assumed to be ordered arrays.

The runs are assumed to be overlapping or adjacent to one another.

Note: This operator is commutative.

Parameters:
Name Type Description
run1 Array.<number>

a run to merge with run2

run2 Array.<number>

a run to merge with run1

Returns:

A single merged run.

Type
Array.<number>

(private) overlaps(run1, run2) → {boolean}

Comparison operator that determines if given runs overlap with one another.

Both parameters are assumed to be ordered arrays.

Overlap is defined to include the case where one run completely contains the other.

Note: This operator is commutative.

Parameters:
Name Type Description
run1 Array.<number>

first run

run2 Array.<number>

second run

Returns:

true iff run1 overlaps run2

Type
boolean

(private) subtract(minuend, subtrahend) → {Array.Array.number}

Operator that subtracts one run from another.

Both parameters are assumed to be ordered arrays.

This function does not assumes that overlap() has already been called with the same runs and has returned true.

Returned array contains 0, 1, or 2 runs which are the portion(s) of minuend that do not include subtrahend.

Caveat: This operator is not commutative.

Parameters:
Name Type Description
minuend Array.<number>

a run from which to "subtract" subtrahend

subtrahend Array.<number>

a run to "subtracted" from minuend

Returns:

The remaining pieces of minuend after removing subtrahend.

Type
Array.Array.number