Lines Matching refs:pos

160      * Return the next position after {@code pos} that is not a space character.
163 * @param pos The starting position
167 private static int readWhiteSpace(CharSequence s, int pos) {
168 while (pos < s.length() && s.charAt(pos) == ' ') {
169 pos++;
172 return pos;
179 * @param pos The starting position
183 private static Pair<Integer, Integer> readNumber(CharSequence s, int pos) {
185 while (pos < s.length() && s.charAt(pos) >= '0' && s.charAt(pos) <= '9') {
187 if (result == 0 && s.charAt(pos) == '0') {
190 result = result * 10 + (s.charAt(pos) - '0');
195 pos++;
200 return new Pair<>(pos, null);
202 return new Pair<>(pos, result);
210 * @param pos The starting position
216 private static Pair<Integer, Character> readChar(CharSequence s, int pos, char expectedChar) {
217 if (pos < s.length() && s.charAt(pos) == expectedChar) {
218 return new Pair<>(pos + 1, expectedChar);
220 return new Pair<>(pos, null);
228 * @param pos The starting position
234 private static Pair<Integer, PageRange> readRange(CharSequence s, int pos, int maxPageNumber) {
239 if (pos == 0) {
243 retChar = readChar(s, pos, ',');
244 pos = retChar.first;
248 pos = readWhiteSpace(s, pos);
250 retInt = readNumber(s, pos);
251 pos = retInt.first;
254 pos = readWhiteSpace(s, pos);
256 retChar = readChar(s, pos, '-');
257 pos = retChar.first;
260 pos = readWhiteSpace(s, pos);
262 retInt = readNumber(s, pos);
263 pos = retInt.first;
266 pos = readWhiteSpace(s, pos);
286 return new Pair<>(pos, new PageRange(start - 1, end - 1));
290 return new Pair<>(pos, null);
304 int pos = 0;
305 while (pos < s.length()) {
306 Pair<Integer, PageRange> retRange = readRange(s, pos, maxPageNumber);
314 pos = retRange.first;