/** Append the provided int to this buffer. */ public void append(int i) { grow(ref.length + 1); ref.ints[ref.length++] = i; }
/** * Copies the given array into this instance. */ public void copyInts(int[] otherInts, int otherOffset, int otherLength) { grow(otherLength); System.arraycopy(otherInts, otherOffset, ref.ints, 0, otherLength); ref.length = otherLength; }
/** * Copy the given UTF-8 bytes into this builder. Works as if the bytes were * first converted from UTF-8 to UTF-32 and then copied into this builder. */ public void copyUTF8Bytes(BytesRef bytes) { grow(bytes.length); ref.length = UnicodeUtil.UTF8toUTF32(bytes, ref.ints); }
/** Just maps each UTF16 unit (char) to the ints in an * IntsRef. */ public static IntsRef toUTF16(CharSequence s, IntsRefBuilder scratch) { final int charLimit = s.length(); scratch.setLength(charLimit); scratch.grow(charLimit); for (int idx = 0; idx < charLimit; idx++) { scratch.setIntAt(idx, (int) s.charAt(idx)); } return scratch.get(); }
/** Decodes the Unicode codepoints from the provided * CharSequence and places them in the provided scratch * IntsRef, which must not be null, returning it. */ public static IntsRef toUTF32(CharSequence s, IntsRefBuilder scratch) { int charIdx = 0; int intIdx = 0; final int charLimit = s.length(); while(charIdx < charLimit) { scratch.grow(intIdx+1); final int utf32 = Character.codePointAt(s, charIdx); scratch.setIntAt(intIdx, utf32); charIdx += Character.charCount(utf32); intIdx++; } scratch.setLength(intIdx); return scratch.get(); }
/** Decodes the Unicode codepoints from the provided * char[] and places them in the provided scratch * IntsRef, which must not be null, returning it. */ public static IntsRef toUTF32(char[] s, int offset, int length, IntsRefBuilder scratch) { int charIdx = offset; int intIdx = 0; final int charLimit = offset + length; while(charIdx < charLimit) { scratch.grow(intIdx+1); final int utf32 = Character.codePointAt(s, charIdx, charLimit); scratch.setIntAt(intIdx, utf32); charIdx += Character.charCount(utf32); intIdx++; } scratch.setLength(intIdx); return scratch.get(); }
depth++; string.setLength(depth); string.grow(depth); } else if (endState == to || a.isAccept(to)) {
int state; int pos = 0; savedStates.grow(seekBytesRef.length()+1); savedStates.setIntAt(0, 0);
result.grow(1+upto);
/** Append the provided int to this buffer. */ public void append(int i) { grow(ref.length + 1); ref.ints[ref.length++] = i; }
/** Append the provided int to this buffer. */ public void append(int i) { grow(ref.length + 1); ref.ints[ref.length++] = i; }
/** * Copies the given array into this instance. */ public void copyInts(int[] otherInts, int otherOffset, int otherLength) { grow(otherLength); System.arraycopy(otherInts, otherOffset, ref.ints, 0, otherLength); ref.length = otherLength; }
/** * Copies the given array into this instance. */ public void copyInts(int[] otherInts, int otherOffset, int otherLength) { grow(otherLength); System.arraycopy(otherInts, otherOffset, ref.ints, 0, otherLength); ref.length = otherLength; }
/** * Copy the given UTF-8 bytes into this builder. Works as if the bytes were * first converted from UTF-8 to UTF-32 and then copied into this builder. */ public void copyUTF8Bytes(BytesRef bytes) { grow(bytes.length); ref.length = UnicodeUtil.UTF8toUTF32(bytes, ref.ints); }
/** * Copy the given UTF-8 bytes into this builder. Works as if the bytes were * first converted from UTF-8 to UTF-32 and then copied into this builder. */ public void copyUTF8Bytes(BytesRef bytes) { grow(bytes.length); ref.length = UnicodeUtil.UTF8toUTF32(bytes, ref.ints); }
/** * Copy the given UTF-8 bytes into this builder. Works as if the bytes were * first converted from UTF-8 to UTF-32 and then copied into this builder. */ public void copyUTF8Bytes(BytesRef bytes) { grow(bytes.length); ref.length = UnicodeUtil.UTF8toUTF32(bytes, ref.ints); }
/** Just maps each UTF16 unit (char) to the ints in an * IntsRef. */ public static IntsRef toUTF16(CharSequence s, IntsRefBuilder scratch) { final int charLimit = s.length(); scratch.setLength(charLimit); scratch.grow(charLimit); for (int idx = 0; idx < charLimit; idx++) { scratch.setIntAt(idx, (int) s.charAt(idx)); } return scratch.get(); }
/** Just maps each UTF16 unit (char) to the ints in an * IntsRef. */ public static IntsRef toUTF16(CharSequence s, IntsRefBuilder scratch) { final int charLimit = s.length(); scratch.setLength(charLimit); scratch.grow(charLimit); for (int idx = 0; idx < charLimit; idx++) { scratch.setIntAt(idx, (int) s.charAt(idx)); } return scratch.get(); }