Add a new position and change the length.
void addPosition(Position position, int length) { positions.add(position); this.length = length; }