in java/bench/core/src/java/org/apache/orc/bench/core/RandomGenerator.java [273:348]
private StringPattern(String pattern) {
buffer = pattern.getBytes(StandardCharsets.UTF_8);
int locs = 0;
for(int i=0; i < buffer.length; ++i) {
switch (buffer[i]) {
case 'C':
case 'c':
case 'E':
case 'V':
case 'v':
case 'F':
case 'l':
case 'L':
case 'D':
case 'x':
case 'X':
locs += 1;
break;
default:
break;
}
}
locations = new int[locs];
choices = new byte[locs][];
locs = 0;
for(int i=0; i < buffer.length; ++i) {
switch (buffer[i]) {
case 'C':
locations[locs] = i;
choices[locs++] = UPPER_CONSONANTS;
break;
case 'c':
locations[locs] = i;
choices[locs++] = LOWER_CONSONANTS;
break;
case 'E':
locations[locs] = i;
choices[locs++] = CONSONANTS;
break;
case 'V':
locations[locs] = i;
choices[locs++] = UPPER_VOWELS;
break;
case 'v':
locations[locs] = i;
choices[locs++] = LOWER_VOWELS;
break;
case 'F':
locations[locs] = i;
choices[locs++] = VOWELS;
break;
case 'l':
locations[locs] = i;
choices[locs++] = LOWER_LETTERS;
break;
case 'L':
locations[locs] = i;
choices[locs++] = UPPER_LETTERS;
break;
case 'D':
locations[locs] = i;
choices[locs++] = LETTERS;
break;
case 'x':
locations[locs] = i;
choices[locs++] = NATURAL_DIGITS;
break;
case 'X':
locations[locs] = i;
choices[locs++] = DIGITS;
break;
default:
break;
}
}
}