本文整理汇总了Java中jdk.nashorn.internal.runtime.regexp.joni.encoding.ObjPtr类的典型用法代码示例。如果您正苦于以下问题:Java ObjPtr类的具体用法?Java ObjPtr怎么用?Java ObjPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjPtr类属于jdk.nashorn.internal.runtime.regexp.joni.encoding包,在下文中一共展示了ObjPtr类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandCaseFoldString
import jdk.nashorn.internal.runtime.regexp.joni.encoding.ObjPtr; //导入依赖的package包/类
private Node expandCaseFoldString(final Node node) {
final StringNode sn = (StringNode)node;
if (sn.isAmbig() || sn.length() <= 0) {
return node;
}
final char[] chars1 = sn.chars;
int pt = sn.p;
final int end = sn.end;
int altNum = 1;
ConsAltNode topRoot = null, r = null;
@SuppressWarnings("unused")
final ObjPtr<Node> prevNode = new ObjPtr<Node>();
StringNode stringNode = null;
while (pt < end) {
final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]);
if (items.length == 0) {
if (stringNode == null) {
if (r == null && prevNode.p != null) {
topRoot = r = ConsAltNode.listAdd(null, prevNode.p);
}
prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL);
if (r != null) {
ConsAltNode.listAdd(r, stringNode);
}
}
stringNode.cat(chars1, pt, pt + 1);
} else {
altNum *= (items.length + 1);
if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) {
break;
}
if (r == null && prevNode.p != null) {
topRoot = r = ConsAltNode.listAdd(null, prevNode.p);
}
expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode);
if (r != null) {
ConsAltNode.listAdd(r, prevNode.p);
}
stringNode = null;
}
pt++;
}
if (pt < end) {
final Node srem = expandCaseFoldMakeRemString(chars1, pt, end);
if (prevNode.p != null && r == null) {
topRoot = r = ConsAltNode.listAdd(null, prevNode.p);
}
if (r == null) {
prevNode.p = srem;
} else {
ConsAltNode.listAdd(r, srem);
}
}
/* ending */
final Node xnode = topRoot != null ? topRoot : prevNode.p;
swap(node, xnode);
return xnode;
}
示例2: expandCaseFoldString
import jdk.nashorn.internal.runtime.regexp.joni.encoding.ObjPtr; //导入依赖的package包/类
private Node expandCaseFoldString(Node node) {
StringNode sn = (StringNode)node;
if (sn.isAmbig() || sn.length() <= 0) return node;
char[] chars = sn.chars;
int p = sn.p;
int end = sn.end;
int altNum = 1;
ConsAltNode topRoot = null, root = null;
ObjPtr<Node> prevNode = new ObjPtr<Node>();
StringNode stringNode = null;
while (p < end) {
char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars[p]);
if (items.length == 0) {
if (stringNode == null) {
if (root == null && prevNode.p != null) {
topRoot = root = ConsAltNode.listAdd(null, prevNode.p);
}
prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL);
if (root != null) ConsAltNode.listAdd(root, stringNode);
}
stringNode.cat(chars, p, p + 1);
} else {
altNum *= (items.length + 1);
if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) break;
if (root == null && prevNode.p != null) {
topRoot = root = ConsAltNode.listAdd(null, prevNode.p);
}
expandCaseFoldStringAlt(items.length, items, chars, p, 1, end, prevNode);
if (root != null) ConsAltNode.listAdd(root, prevNode.p);
stringNode = null;
}
p++;
}
if (p < end) {
Node srem = expandCaseFoldMakeRemString(chars, p, end);
if (prevNode.p != null && root == null) {
topRoot = root = ConsAltNode.listAdd(null, prevNode.p);
}
if (root == null) {
prevNode.p = srem;
} else {
ConsAltNode.listAdd(root, srem);
}
}
/* ending */
Node xnode = topRoot != null ? topRoot : prevNode.p;
swap(node, xnode);
return xnode;
}