Add replace and updateSpans to SpanIndex.

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-02-15 15:18:52 -07:00
parent 9324c5a7ee
commit f30f028868
2 changed files with 17 additions and 0 deletions

View File

@@ -8,9 +8,16 @@ class SpanIndex
insert: (index, spans, values) ->
@entries[index..index] = @buildIndexEntries(spans, values)
replace: (index, span, value) ->
@splice(index, index, span, [value])
splice: (start, end, spans, values) ->
@entries[start..end] = @buildIndexEntries(spans, values)
updateSpans: (start, end, span) ->
for i in [start..end]
@entries[i].span = span
at: (index) ->
@entries[index].value