copy method

void copy (VectorList<T> src, { int srcOffset: 0, int offset: 0, int count: 0 })

Copy a range of count vectors beginning at srcOffset from src into this list starting at offset.

Implementation

void copy(VectorList<T> src,
    {int srcOffset: 0, int offset: 0, int count: 0}) {
  if (count == 0) {
    count = math.min(length - offset, src.length - srcOffset);
  }
  final int minVectorLength = math.min(_vectorLength, src._vectorLength);
  for (int i = 0; i < count; i++) {
    int index = _vectorIndexToBufferIndex(i + offset);
    int srcIndex = src._vectorIndexToBufferIndex(i + srcOffset);
    for (int j = 0; j < minVectorLength; j++) {
      _buffer[index++] = src._buffer[srcIndex++];
    }
  }
}