@Override public final CharTermAttribute setLength(int length) { FutureObjects.checkFromIndexSize(0, length, termBuffer.length); termLength = length; return this; }
@Override public final char charAt(int index) { FutureObjects.checkIndex(index, termLength); return termBuffer[index]; }
@Override public final CharSequence subSequence(final int start, final int end) { FutureObjects.checkFromToIndex(start, end, termLength); return new String(termBuffer, start, end - start); }
@Override public char charAt(int index) { // NOTE: must do a real check here to meet the specs of CharSequence FutureObjects.checkIndex(index, length); return chars[offset + index]; }
@Override public BytesReference slice(int from, int length) { FutureObjects.checkFromIndexSize(from, length, this.length); if (length == 0) { return BytesArray.EMPTY; } // for slices we only need to find the start and the end reference // adjust them and pass on the references in between as they are fully contained final int to = from + length; final int limit = getOffsetIndex(to - 1); final int start = getOffsetIndex(from); final BytesReference[] inSlice = new BytesReference[1 + (limit - start)]; for (int i = 0, j = start; i < inSlice.length; i++) { inSlice[i] = references[j++]; } int inSliceOffset = from - offsets[start]; if (inSlice.length == 1) { return inSlice[0].slice(inSliceOffset, length); } // now adjust slices in front and at the end inSlice[0] = inSlice[0].slice(inSliceOffset, inSlice[0].length() - inSliceOffset); inSlice[inSlice.length-1] = inSlice[inSlice.length-1].slice(0, to - offsets[limit]); return new CompositeBytesReference(inSlice); }
@Override public CharSequence subSequence(int start, int end) { // NOTE: must do a real check here to meet the specs of CharSequence FutureObjects.checkFromToIndex(start, end, length); return new CharsRef(chars, offset + start, end - start); }
@Override public boolean get(int doc) { FutureObjects.checkIndex(doc, length); return parent.get(doc+start); }
@Override public final CharTermAttribute setLength(int length) { FutureObjects.checkFromIndexSize(0, length, termBuffer.length); termLength = length; return this; }
csq = "null"; FutureObjects.checkFromToIndex(start, end, csq.length()); final int len = end - start; if (len == 0)
/** Set or clear this state as an accept state. */ public void setAccept(int state, boolean accept) { FutureObjects.checkIndex(state, getNumStates()); this.isAccept.set(state, accept); }
@Override public final CharSequence subSequence(final int start, final int end) { FutureObjects.checkFromToIndex(start, end, termLength); return new String(termBuffer, start, end - start); }
/** Set or clear this state as an accept state. */ public void setAccept(int state, boolean accept) { FutureObjects.checkIndex(state, getNumStates()); isAccept.set(state, accept); }
@Override public CharSequence subSequence(int start, int end) { // NOTE: must do a real check here to meet the specs of CharSequence FutureObjects.checkFromToIndex(start, end, length); return new CharsRef(chars, offset + start, end - start); }
/** Used only by sort below, to set a {@link BytesRef} with the specified slice, avoiding copying bytes in the common case when the slice * is contained in a single block in the byte block pool. */ private void setBytesRef(BytesRefBuilder spare, BytesRef result, int index) { FutureObjects.checkIndex(index, lastElement); int offset = offsets[index]; int length; if (index == lastElement - 1) { length = currentOffset - offset; } else { length = offsets[index + 1] - offset; } pool.setBytesRef(spare, result, offset, length); }
csq = "null"; FutureObjects.checkFromToIndex(start, end, csq.length()); final int len = end - start; if (len == 0)
private void checkBounds(int docID) { FutureObjects.checkIndex(docID, maxDoc()); }
private void checkBounds(int docID) { FutureObjects.checkIndex(docID, maxDoc()); }
/** Add a new transition with the specified source, dest, min, max. */ public void addTransition(int source, int dest, int min, int max) { assert nextTransition%3 == 0; int bounds = nextState/2; FutureObjects.checkIndex(source, bounds); FutureObjects.checkIndex(dest, bounds); growTransitions(); if (curState != source) { if (curState != -1) { finishCurrentState(); } // Move to next source: curState = source; if (states[2*curState] != -1) { throw new IllegalStateException("from state (" + source + ") already had transitions added"); } assert states[2*curState+1] == 0; states[2*curState] = nextTransition; } transitions[nextTransition++] = dest; transitions[nextTransition++] = min; transitions[nextTransition++] = max; // Increment transition count for this state states[2*curState+1]++; }
/** * Get the min value for the given dimension * @param dimension the dimension, always positive * @return the decoded min value */ public double getMin(int dimension) { FutureObjects.checkIndex(dimension, type.pointDataDimensionCount()/2); return decodeMin(((BytesRef)fieldsData).bytes, dimension); }
/** * Get the min value for the given dimension * @param dimension the dimension, always positive * @return the decoded min value */ public long getMin(int dimension) { FutureObjects.checkIndex(dimension, type.pointDataDimensionCount()/2); return decodeMin(((BytesRef)fieldsData).bytes, dimension); }