copy method

void copy(
  1. VectorList<T> src,
  2. {int srcOffset = 0,
  3. int offset = 0,
  4. 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 minVectorLength = math.min(_vectorLength, src._vectorLength);
  for (var i = 0; i < count; i++) {
    var index = _vectorIndexToBufferIndex(i + offset);
    var srcIndex = src._vectorIndexToBufferIndex(i + srcOffset);
    for (var j = 0; j < minVectorLength; j++) {
      _buffer[index++] = src._buffer[srcIndex++];
    }
  }
}