MCPcopy Create free account
hub / github.com/google/re2j / appendNegatedTable

Method appendNegatedTable

java/com/google/re2j/CharClass.java:218–240  ·  view source on GitHub ↗
(int[][] table)

Source from the content-addressed store, hash-verified

216 // appendNegatedTable() returns the result of appending the negation of range
217 // table |table| to this CharClass. Does not mutate |table|.
218 CharClass appendNegatedTable(int[][] table) {
219 int nextLo = 0; // lo end of next class to add
220 for (int[] triple : table) {
221 int lo = triple[0], hi = triple[1], stride = triple[2];
222 if (stride == 1) {
223 if (nextLo <= lo - 1) {
224 appendRange(nextLo, lo - 1);
225 }
226 nextLo = hi + 1;
227 continue;
228 }
229 for (int c = lo; c <= hi; c += stride) {
230 if (nextLo <= c - 1) {
231 appendRange(nextLo, c - 1);
232 }
233 nextLo = c + 1;
234 }
235 }
236 if (nextLo <= Unicode.MAX_RUNE) {
237 appendRange(nextLo, Unicode.MAX_RUNE);
238 }
239 return this;
240 }
241
242 // appendTableWithSign() calls append{,Negated}Table depending on sign.
243 // Does not mutate |table|.

Callers 2

appendTableWithSignMethod · 0.95
testAppendTableMethod · 0.80

Calls 1

appendRangeMethod · 0.95

Tested by 1

testAppendTableMethod · 0.64