Index: trunk/parsers/wikidom/lib/synth/bases/es.AggregateArray.js |
— | — | @@ -51,6 +51,22 @@ |
52 | 52 | return Math.max( 0, sum + this.length - 1 ); |
53 | 53 | }; |
54 | 54 | |
| 55 | +es.AggregateArray.prototype.getCoverage = function( start, end ) { |
| 56 | + var result = { 'on': [], 'off': [] }, |
| 57 | + sum = 0, |
| 58 | + len; |
| 59 | + for ( var i = 0, length = this.length; i < length; i++ ) { |
| 60 | + len = this[i].getLength(); |
| 61 | + if ( sum >= start && sum + len < end ) { |
| 62 | + result.on.push( this[i] ); |
| 63 | + } else { |
| 64 | + result.off.push( this[i] ); |
| 65 | + } |
| 66 | + sum += len |
| 67 | + } |
| 68 | + return result; |
| 69 | +}; |
| 70 | + |
55 | 71 | es.AggregateArray.prototype.select = function( start, end ) { |
56 | 72 | // Support es.Range object as first argument |
57 | 73 | if ( typeof start.from === 'number' && typeof start.to === 'number') { |