Lines Matching refs:start
9 * specified by (start, end) can be added and removed at will. It is used to
25 * Deletes all ranges intersecting with (start ... end) and returns the
27 * @param {int} start The start of the range to remove.
31 * @return {Object} The start and end of the newly cleared range.
33 clearRange: function(start, end, sloppiness) {
35 var result = {start: start, end: end};
39 // A range intersects another if its start lies within the other range
41 if ((rangeStart >= start && rangeStart <= (end + sloppiness)) ||
42 (start >= rangeStart && start <= (rangeEnd + sloppiness))) {
44 result.start = Math.min(result.start, rangeStart);
55 * @param {int} start The beginning of the range to add, inclusive.
58 add: function(start, end) {
59 if (end < start)
63 result = this.clearRange(start, end, 1);
65 this.ranges_[Math.min(start, result.start)] = Math.max(end, result.end);
75 other.forEach(function(start, end) { ranges.add(start, end); });
81 * @param {int} start The beginning of the range to remove, inclusive.
84 remove: function(start, end) {
85 if (end < start)
89 result = this.clearRange(start, end, 0);
92 if (result.start < start)
93 this.ranges_[result.start] = start - 1;
100 * function for each (start, end).
104 for (var start in this.ranges_)
105 iterator(start, this.ranges_[start]);
110 * start and end of each contiguous range, sorted by start.
116 for (var start in this.ranges_)
117 starts.push(parseInt(start));
136 for (var start in this.ranges_)
137 max = Math.max(max, this.ranges_[start]);