/** * Used to grow the reference array. */ public void grow(int newLength) { ref.chars = ArrayUtil.grow(ref.chars, newLength); }
private void growTransitions() { if (nextTransition+3 > transitions.length) { transitions = ArrayUtil.grow(transitions, nextTransition+3); } }
/** * Ensure that this builder can hold at least <code>capacity</code> bytes * without resizing. */ public void grow(int capacity) { ref.bytes = ArrayUtil.grow(ref.bytes, capacity); }
@Override public void writeByte(byte b) { if (length >= bytes.length) { bytes = ArrayUtil.grow(bytes); } bytes[length++] = b; }
private void addBlock(byte[] block) { blocks = ArrayUtil.grow(blocks, numBlocks + 1); blocks[numBlocks++] = block; }
@Override protected void grow() { current.bytes = ArrayUtil.grow(current.bytes, upto+1); }
@Override public int[] grow() { assert bytesStart != null; return bytesStart = ArrayUtil.grow(bytesStart, bytesStart.length + 1); }
/** * Used to grow the reference array. * * In general this should not be used as it does not take the offset into account. * @lucene.internal */ public void grow(int newLength) { ref.ints = ArrayUtil.grow(ref.ints, newLength); }
private void growStates() { if (nextState+2 > states.length) { states = ArrayUtil.grow(states, nextState+2); } }
/** Add a new transition with the specified source, dest, min, max. */ public void addTransition(int source, int dest, int min, int max) { if (transitions.length < nextTransition+4) { transitions = ArrayUtil.grow(transitions, nextTransition+4); } transitions[nextTransition++] = source; transitions[nextTransition++] = dest; transitions[nextTransition++] = min; transitions[nextTransition++] = max; }
private void addOneValue(long value) { if (currentUpto == currentValues.length) { currentValues = ArrayUtil.grow(currentValues, currentValues.length+1); } currentValues[currentUpto] = value; currentUpto++; }
public void add(Transition t) { if (transitions.length < next+3) { transitions = ArrayUtil.grow(transitions, next+3); } transitions[next] = t.dest; transitions[next+1] = t.min; transitions[next+2] = t.max; next += 3; } }
@Override protected void grow() { current.ints = ArrayUtil.grow(current.ints, upto+1); }
/** Returns a larger array, generally over-allocating exponentially */ public static float[] grow(float[] array) { return grow(array, 1 + array.length); }
/** Returns a larger array, generally over-allocating exponentially */ public static double[] grow(double[] array) { return grow(array, 1 + array.length); }
/** Returns a larger array, generally over-allocating exponentially */ public static int[] grow(int[] array) { return grow(array, 1 + array.length); }
private void copyTerm() { final int len = currentFrame.prefix + currentFrame.suffix; if (term.bytes.length < len) { term.bytes = ArrayUtil.grow(term.bytes, len); } System.arraycopy(currentFrame.suffixBytes, currentFrame.startBytePos, term.bytes, currentFrame.prefix, currentFrame.suffix); term.length = len; }
@Override public void writeBytes(byte[] b, int off, int len) { final int newLength = length + len; if (newLength > bytes.length) { bytes = ArrayUtil.grow(bytes, newLength); } System.arraycopy(b, off, bytes, length, len); length = newLength; }
@Override public int[] grow() { final int[] ord = super.grow(); boost = ArrayUtil.grow(boost, ord.length); if (termState.length < ord.length) { TermContext[] tmpTermState = new TermContext[ArrayUtil.oversize(ord.length, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(termState, 0, tmpTermState, 0, termState.length); termState = tmpTermState; } assert termState.length >= ord.length && boost.length >= ord.length; return ord; }
static BytesRef readFrom(DataInput in, BytesRef scratch) throws IOException { scratch.length = in.readVInt(); if (scratch.bytes.length < scratch.length) { scratch.bytes = ArrayUtil.grow(scratch.bytes, scratch.length); } in.readBytes(scratch.bytes, 0, scratch.length); return scratch; } }