Module: utils

Methods

(inner) doIntervalsOverlap()

Test if two intervals overlap
Source:

(inner) entryListToTree(entryList) → {Object}

Builds a balanced binary tree from an entry list for quickly finding things at certain times
Parameters:
Name Type Description
entryList Array can consist of intervals or points in time
Source:
Returns:
The root node of the tree. Each node has a left and right branch; nodes in the left branch occur in time before the start time in parent nodes nodes in the right branch occur in time after the stop time in parent nodes
Type
Object

(inner) findIntervalAtTime(time, rootNode) → {Array}

Returns the interval in an IntervalTier that contains the given time
Parameters:
Name Type Description
time number
rootNode Object a tree built from entryListToTree()
Source:
Returns:
The matched interval. Of the form [start, stop, label].
Type
Array

(inner) findPointAtTime(time, rootNode, findClosestopt) → {Array}

Returns the point in a PointTier that occurs at a specific time
Parameters:
Name Type Attributes Default Description
time number
rootNode Object a tree built from entryListToTree()
findClosest boolean <optional>
false If true, return the entryList point that is closest to this time, even if its not an exact match. If false, only return exact matches.
Source:
Returns:
The matched point. Of the form [time, label].
Type
Array

(inner) isClose()

Test for near equivalence in float values. From here http://realtimecollisiondetection.net/blog/?p=89
Source:

(inner) recEntryListToTree()

Helper function that recursively builds a balanced binary tree
Source:

(inner) sortCompareEntriesByTime()

Pass to sort, when sorting a list of entries to sort entries by start time
Source: