text: public void freeBefore(int pos) {final int toFree = count - (nextPos - pos);assert toFree >= 0;assert toFree <= count;int index = nextWrite - count;if (index < 0) {index += positions.length;}for(int i=0;i<toFree;i++) {if (index == positions.length) {index = 0;}positions[index].reset();index++;}count -= toFree;}