private synchronized int addInternal(int doc, long hasValueMask) { if (finished) { throw new IllegalStateException("already finished"); } assert doc < maxDoc; // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation if (size == Integer.MAX_VALUE) { throw new IllegalStateException("cannot support more than Integer.MAX_VALUE doc/value entries"); } // grow the structures to have room for more elements if (docs.size() == size) { grow(size+1); } docs.set(size, (((long)doc) << SHIFT) | hasValueMask); ++size; return size-1; }
private synchronized int addInternal(int doc, long hasValueMask) { if (finished) { throw new IllegalStateException("already finished"); } assert doc < maxDoc; // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation if (size == Integer.MAX_VALUE) { throw new IllegalStateException("cannot support more than Integer.MAX_VALUE doc/value entries"); } // grow the structures to have room for more elements if (docs.size() == size) { grow(size+1); } docs.set(size, (((long)doc) << SHIFT) | hasValueMask); ++size; return size-1; }
@Override public void add(int doc, Object value) { // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation if (size == Integer.MAX_VALUE) { throw new IllegalStateException("cannot support more than Integer.MAX_VALUE doc/value entries"); } Long val = (Long) value; // grow the structures to have room for more elements if (docs.size() == size) { docs = docs.grow(size + 1); values = values.grow(size + 1); } docs.set(size, doc); values.set(size, val.longValue()); ++size; }
@Override public void add(int doc, Object value) { // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation if (size == Integer.MAX_VALUE) { throw new IllegalStateException("cannot support more than Integer.MAX_VALUE doc/value entries"); } Long val = (Long) value; // grow the structures to have room for more elements if (docs.size() == size) { docs = docs.grow(size + 1); values = values.grow(size + 1); } docs.set(size, doc); values.set(size, val.longValue()); ++size; }
@Override public void merge(DocValuesFieldUpdates other) { assert other instanceof NumericDocValuesFieldUpdates; NumericDocValuesFieldUpdates otherUpdates = (NumericDocValuesFieldUpdates) other; if (otherUpdates.size > Integer.MAX_VALUE - size) { throw new IllegalStateException( "cannot support more than Integer.MAX_VALUE doc/value entries; size=" + size + " other.size=" + otherUpdates.size); } docs = docs.grow(size + otherUpdates.size); values = values.grow(size + otherUpdates.size); for (int i = 0; i < otherUpdates.size; i++) { int doc = (int) otherUpdates.docs.get(i); docs.set(size, doc); values.set(size, otherUpdates.values.get(i)); ++size; } }
@Override public void merge(DocValuesFieldUpdates other) { assert other instanceof NumericDocValuesFieldUpdates; NumericDocValuesFieldUpdates otherUpdates = (NumericDocValuesFieldUpdates) other; if (otherUpdates.size > Integer.MAX_VALUE - size) { throw new IllegalStateException( "cannot support more than Integer.MAX_VALUE doc/value entries; size=" + size + " other.size=" + otherUpdates.size); } docs = docs.grow(size + otherUpdates.size); values = values.grow(size + otherUpdates.size); for (int i = 0; i < otherUpdates.size; i++) { int doc = (int) otherUpdates.docs.get(i); docs.set(size, doc); values.set(size, otherUpdates.values.get(i)); ++size; } }
@Override protected void swap(int i, int j) { long tmpDoc = docs.get(j); docs.set(j, docs.get(i)); docs.set(i, tmpDoc); long tmpOffset = offsets.get(j); offsets.set(j, offsets.get(i)); offsets.set(i, tmpOffset); long tmpLength = lengths.get(j); lengths.set(j, lengths.get(i)); lengths.set(i, tmpLength); }
@Override protected void swap(int i, int j) { long tmpDoc = docs.get(j); docs.set(j, docs.get(i)); docs.set(i, tmpDoc); long tmpOffset = offsets.get(j); offsets.set(j, offsets.get(i)); offsets.set(i, tmpOffset); long tmpLength = lengths.get(j); lengths.set(j, lengths.get(i)); lengths.set(i, tmpLength); }
@Override public void add(int doc, Object value) { // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation if (size == Integer.MAX_VALUE) { throw new IllegalStateException("cannot support more than Integer.MAX_VALUE doc/value entries"); } BytesRef val = (BytesRef) value; // grow the structures to have room for more elements if (docs.size() == size) { docs = docs.grow(size + 1); offsets = offsets.grow(size + 1); lengths = lengths.grow(size + 1); } docs.set(size, doc); offsets.set(size, values.length()); lengths.set(size, val.length); values.append(val); ++size; }
@Override public void add(int doc, Object value) { // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation if (size == Integer.MAX_VALUE) { throw new IllegalStateException("cannot support more than Integer.MAX_VALUE doc/value entries"); } BytesRef val = (BytesRef) value; // grow the structures to have room for more elements if (docs.size() == size) { docs = docs.grow(size + 1); offsets = offsets.grow(size + 1); lengths = lengths.grow(size + 1); } docs.set(size, doc); offsets.set(size, values.length()); lengths.set(size, val.length); values.append(val); ++size; }
@Override public void merge(DocValuesFieldUpdates other) { BinaryDocValuesFieldUpdates otherUpdates = (BinaryDocValuesFieldUpdates) other; if (otherUpdates.size > Integer.MAX_VALUE - size) { throw new IllegalStateException( "cannot support more than Integer.MAX_VALUE doc/value entries; size=" + size + " other.size=" + otherUpdates.size); } final int newSize = size + otherUpdates.size; docs = docs.grow(newSize); offsets = offsets.grow(newSize); lengths = lengths.grow(newSize); for (int i = 0; i < otherUpdates.size; i++) { int doc = (int) otherUpdates.docs.get(i); docs.set(size, doc); offsets.set(size, values.length() + otherUpdates.offsets.get(i)); // correct relative offset lengths.set(size, otherUpdates.lengths.get(i)); ++size; } values.append(otherUpdates.values); }
@Override public void merge(DocValuesFieldUpdates other) { BinaryDocValuesFieldUpdates otherUpdates = (BinaryDocValuesFieldUpdates) other; if (otherUpdates.size > Integer.MAX_VALUE - size) { throw new IllegalStateException( "cannot support more than Integer.MAX_VALUE doc/value entries; size=" + size + " other.size=" + otherUpdates.size); } final int newSize = size + otherUpdates.size; docs = docs.grow(newSize); offsets = offsets.grow(newSize); lengths = lengths.grow(newSize); for (int i = 0; i < otherUpdates.size; i++) { int doc = (int) otherUpdates.docs.get(i); docs.set(size, doc); offsets.set(size, values.length() + otherUpdates.offsets.get(i)); // correct relative offset lengths.set(size, otherUpdates.lengths.get(i)); ++size; } values.append(otherUpdates.values); }