Lines Matching refs:buffer

24  * Implements a circular (ring) buffer of characters with specialized
34 * the buffer. Changing the API would mean changing the test
40 * <li> The buffer size is fixed. There is currently no need to
47 * Size of the ring buffer used to lookup the last token in the javascript
50 * an empty ring buffer slot.
54 /** Storage implementing the circular buffer. */
55 private final char[] buffer;
57 /** Index of the first item in our circular buffer. */
60 /** Index of the last item in our circular buffer. */
64 * Constructs an empty javascript token buffer. The size is fixed,
68 buffer = new char[BUFFER_SIZE];
74 * Constructs a javascript token buffer that is identical to
80 buffer = Arrays.copyOf(aJavascriptTokenBuffer.buffer,
81 aJavascriptTokenBuffer.buffer.length);
88 * to the buffer. Sequences of whitespace and newlines
105 * Appends a character to the buffer. We fold sequences of whitespace and
115 buffer[endIndex] = input;
116 endIndex = (endIndex + 1) % buffer.length;
118 startIndex = (endIndex + 1) % buffer.length;
123 * Returns the last character in the buffer and removes it from the buffer
124 * or the NUL character '\0' if the buffer is empty.
126 * @return last character in the buffer or '\0' if the buffer is empty
134 endIndex += buffer.length;
136 return buffer[endIndex];
140 * Returns the character at a given index in the buffer or nul ('\0')
141 * if the index is outside the range of the buffer. Such could happen
142 * if the buffer is not filled enough or the index is larger than the
143 * size of the buffer.
146 * character in the buffer.
148 * @param position The index into the buffer
160 return buffer[absolutePosition];
164 * Sets the given {@code input} at the given {@code position} of the buffer.
166 * failed (i.e. the write was beyond the buffer boundary).
169 * last character in the buffer.
172 * @param input The character to set in the buffer
183 buffer[absolutePosition] = input;
189 * Returns the last javascript identifier/keyword in the buffer.
210 * Returns a slice of the buffer delimited by the given indices.
214 * of the buffer, the slice will only contain characters
215 * starting from the beginning of the buffer.
239 * Returns the position relative to the start of the buffer or -1
240 * if the position is past the size of the buffer.
243 * @return the position relative to the start of the buffer
247 if (position <= -buffer.length) {
252 len += buffer.length;
257 int absolutePosition = (position + endIndex) % buffer.length;
259 absolutePosition += buffer.length;