fromRawBlocks<T> static method

Fugue<T> fromRawBlocks<T>(
  1. Iterable<(Dot, Dot, Side, List<T>, List<int>)> blocks
)

Rebuild from rawBlocks-shaped data (codec use).

Implementation

static Fugue<T> fromRawBlocks<T>(
  Iterable<(Dot, Dot, Side, List<T>, List<int>)> blocks,
) {
  final f = Fugue<T>();
  for (final (start, parent, side, values, delRanges) in blocks) {
    final b = _Block<T>(start, parent, side, List<T>.of(values));
    for (var i = 0; i + 1 < delRanges.length; i += 2) {
      for (var k = 0; k < delRanges[i + 1]; k++) {
        b.deleted.add(delRanges[i] + k);
      }
    }
    f._index(b);
  }
  return f;
}