public ScalarDataBuffer(ScalarReader reader, ScalarAccessor accessor, BufferFactory bufferFactory, int numRows) { this.reader = reader; this.accessor = accessor; this.buffer = bufferFactory.newBuffer(1 + numRows); // Start with position 1 that the coordinate N cooresponds to row id N. this.position = 1; }
public VecDataBuffer(VecReader reader, int coordsPerElem, BufferFactory bufferFactory, int numRows, int elementsPerRow) { int bufferLength = Math.Max(1, elementsPerRow); BufferWrapper buffer = bufferFactory.newBuffer((1 + numRows) * coordsPerElem * bufferLength); this.reader = reader; this.buffer = new VecBufferSequence(new VecBuffer(coordsPerElem, buffer), 1 + numRows); // Insert an empty coordinate so that the coordinate N cooresponds to row id N. this.buffer.append(VecBuffer.emptyVecBuffer(coordsPerElem)); }