本文整理汇总了Java中jdk.nashorn.internal.runtime.regexp.joni.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于jdk.nashorn.internal.runtime.regexp.joni包,在下文中一共展示了Config类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
public void toString(Appendable buf) {
try {
buf.append('{');
int size = vector.getDimension();
for (int i = 0; i < size; i++) {
buf.append(Double.toString(vector.getEntry(i)));
if (i < size - 1) {
buf.append(",");
}
}
buf.append('}');
} catch (IOException e) {
if (Config.DEBUG) {
e.printStackTrace();
}
}
}
示例2: hashCode
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
@Override
public int hashCode() {
if (Config.USE_SHARED_CCLASS_TABLE) {
int hash = 0;
hash += ctype;
if (isNot()) {
hash++;
}
return hash + (hash >> 5);
}
return super.hashCode();
}
示例3: isInvalidQuantifier
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
public final boolean isInvalidQuantifier() {
if (!Config.VANILLA) return false;
ConsAltNode node;
switch(getType()) {
case ANCHOR:
return true;
case ENCLOSE:
/* allow enclosed elements */
/* return is_invalid_quantifier_target(NENCLOSE(node)->target); */
break;
case LIST:
node = (ConsAltNode)this;
do {
if (!node.car.isInvalidQuantifier()) return false;
} while ((node = node.cdr) != null);
return false;
case ALT:
node = (ConsAltNode)this;
do {
if (node.car.isInvalidQuantifier()) return true;
} while ((node = node.cdr) != null);
break;
default:
break;
}
return false;
}
示例4: toString
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
public void toString(Appendable buf, boolean isEmpty) {
try {
if (!isEmpty) {
buf.append('\n');
}
buf.append('{');
int rows = matrix.getRowDimension();
int cols = matrix.getColumnDimension();
for (int i = 0; i < rows; i++) {
if (i != 0) {
buf.append(" ");
}
buf.append("{");
for (int j = 0; j < cols; j++) {
buf.append(Double.toString(matrix.getEntry(i, j)));
if (j < cols - 1) {
buf.append(",");
}
}
buf.append('}');
if (i < rows - 1) {
buf.append(",");
buf.append('\n');
}
}
buf.append('}');
} catch (IOException e) {
if (Config.DEBUG) {
e.printStackTrace();
}
}
}
示例5: addCTypeByRange
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
public void addCTypeByRange(final int ct, final boolean not, final int sbOut, final int mbr[]) {
final int n = mbr[0];
if (!not) {
for (int i=0; i<n; i++) {
for (int j=mbr[i * 2 + 1]; j<=mbr[i * 2 + 2]; j++) {
if (j >= sbOut) {
if (Config.VANILLA) {
if (j == mbr[i * 2 + 2]) {
i++;
} else if (j > mbr[i * 2 + 1]) {
addCodeRangeToBuf(j, mbr[i * 2 + 2]);
i++;
}
} else {
if (j >= mbr[i * 2 + 1]) {
addCodeRangeToBuf(j, mbr[i * 2 + 2]);
i++;
}
}
// !goto sb_end!, remove duplication!
for (; i<n; i++) {
addCodeRangeToBuf(mbr[2 * i + 1], mbr[2 * i + 2]);
}
return;
}
bs.set(j);
}
}
// !sb_end:!
for (int i=0; i<n; i++) {
addCodeRangeToBuf(mbr[2 * i + 1], mbr[2 * i + 2]);
}
} else {
int prev = 0;
for (int i=0; i<n; i++) {
for (int j=prev; j < mbr[2 * i + 1]; j++) {
if (j >= sbOut) {
// !goto sb_end2!, remove duplication
prev = sbOut;
for (i=0; i<n; i++) {
if (prev < mbr[2 * i + 1]) {
addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1);
}
prev = mbr[i * 2 + 2] + 1;
}
if (prev < 0x7fffffff/*!!!*/) {
addCodeRangeToBuf(prev, 0x7fffffff);
}
return;
}
bs.set(j);
}
prev = mbr[2 * i + 2] + 1;
}
for (int j=prev; j<sbOut; j++) {
bs.set(j);
}
// !sb_end2:!
prev = sbOut;
for (int i=0; i<n; i++) {
if (prev < mbr[2 * i + 1]) {
addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1);
}
prev = mbr[i * 2 + 2] + 1;
}
if (prev < 0x7fffffff/*!!!*/) {
addCodeRangeToBuf(prev, 0x7fffffff);
}
}
}
示例6: setQuantifier
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
@SuppressWarnings("fallthrough")
public int setQuantifier(final Node tgt, final boolean group, final ScanEnvironment env, final char[] chars, final int p, final int end) {
if (lower == 1 && upper == 1) {
return 1;
}
switch(tgt.getType()) {
case STR:
if (!group) {
final StringNode sn = (StringNode)tgt;
if (sn.canBeSplit()) {
final StringNode n = sn.splitLastChar();
if (n != null) {
setTarget(n);
return 2;
}
}
}
break;
case QTFR:
/* check redundant double repeat. */
/* verbose warn (?:.?)? etc... but not warn (.?)? etc... */
final QuantifierNode qnt = (QuantifierNode)tgt;
final int nestQNum = popularNum();
final int targetQNum = qnt.popularNum();
if (Config.USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR) {
if (!isByNumber() && !qnt.isByNumber() && env.syntax.warnReduntantNestedRepeat()) {
switch(REDUCE_TABLE[targetQNum][nestQNum]) {
case ASIS:
break;
case DEL:
env.reg.getWarnings().warn(new String(chars, p, end) +
" redundant nested repeat operator");
break;
default:
env.reg.getWarnings().warn(new String(chars, p, end) +
" nested repeat operator " + PopularQStr[targetQNum] +
" and " + PopularQStr[nestQNum] + " was replaced with '" +
ReduceQStr[REDUCE_TABLE[targetQNum][nestQNum].ordinal()] + "'");
}
}
} // USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
if (targetQNum >= 0) {
if (nestQNum >= 0) {
reduceNestedQuantifier(qnt);
return 0;
} else if (targetQNum == 1 || targetQNum == 2) { /* * or + */
/* (?:a*){n,m}, (?:a+){n,m} => (?:a*){n,n}, (?:a+){n,n} */
if (!isRepeatInfinite(upper) && upper > 1 && greedy) {
upper = lower == 0 ? 1 : lower;
}
}
}
default:
break;
}
setTarget(tgt);
return 0;
}
示例7: isInvalidQuantifier
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
public final boolean isInvalidQuantifier() {
if (!Config.VANILLA) {
return false;
}
ConsAltNode node;
switch(getType()) {
case ANCHOR:
return true;
case ENCLOSE:
/* allow enclosed elements */
/* return is_invalid_quantifier_target(NENCLOSE(node)->target); */
break;
case LIST:
node = (ConsAltNode)this;
do {
if (!node.car.isInvalidQuantifier()) {
return false;
}
} while ((node = node.cdr) != null);
return false;
case ALT:
node = (ConsAltNode)this;
do {
if (node.car.isInvalidQuantifier()) {
return true;
}
} while ((node = node.cdr) != null);
break;
default:
break;
}
return false;
}
示例8: setQuantifier
import jdk.nashorn.internal.runtime.regexp.joni.Config; //导入依赖的package包/类
@SuppressWarnings("fallthrough")
public int setQuantifier(Node tgt, boolean group, ScanEnvironment env, char[] chars, int p, int end) {
if (lower == 1 && upper == 1) return 1;
switch(tgt.getType()) {
case STR:
if (!group) {
StringNode sn = (StringNode)tgt;
if (sn.canBeSplit()) {
StringNode n = sn.splitLastChar();
if (n != null) {
setTarget(n);
return 2;
}
}
}
break;
case QTFR:
/* check redundant double repeat. */
/* verbose warn (?:.?)? etc... but not warn (.?)? etc... */
QuantifierNode qnt = (QuantifierNode)tgt;
int nestQNum = popularNum();
int targetQNum = qnt.popularNum();
if (Config.USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR) {
if (!isByNumber() && !qnt.isByNumber() && env.syntax.warnReduntantNestedRepeat()) {
switch(REDUCE_TABLE[targetQNum][nestQNum]) {
case ASIS:
break;
case DEL:
env.reg.getWarnings().warn(new String(chars, p, end) +
" redundant nested repeat operator");
break;
default:
env.reg.getWarnings().warn(new String(chars, p, end) +
" nested repeat operator " + PopularQStr[targetQNum] +
" and " + PopularQStr[nestQNum] + " was replaced with '" +
ReduceQStr[REDUCE_TABLE[targetQNum][nestQNum].ordinal()] + "'");
}
}
} // USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
if (targetQNum >= 0) {
if (nestQNum >= 0) {
reduceNestedQuantifier(qnt);
return 0;
} else if (targetQNum == 1 || targetQNum == 2) { /* * or + */
/* (?:a*){n,m}, (?:a+){n,m} => (?:a*){n,n}, (?:a+){n,n} */
if (!isRepeatInfinite(upper) && upper > 1 && greedy) {
upper = lower == 0 ? 1 : lower;
}
}
}
default:
break;
}
setTarget(tgt);
return 0;
}