当前位置: 首页>>代码示例>>Java>>正文


Java StringNode.length方法代码示例

本文整理汇总了Java中jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode.length方法的典型用法代码示例。如果您正苦于以下问题:Java StringNode.length方法的具体用法?Java StringNode.length怎么用?Java StringNode.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode的用法示例。


在下文中一共展示了StringNode.length方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileLengthStringNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p, prev;
    p = prev = sn.p;
    final int end = sn.end;
    final char[] chars = sn.chars;
    p++;

    int slen = 1;
    int rlen = 0;

    while (p < end) {
        slen++;
        p++;
    }
    final int r = addCompileStringlength(chars, prev, slen, ambig);
    rlen += r;
    return rlen;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ArrayCompiler.java

示例2: compileStringNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private void compileStringNode(final StringNode node) {
    final StringNode sn = node;
    if (sn.length() <= 0) {
        return;
    }

    final boolean ambig = sn.isAmbig();

    int p, prev;
    p = prev = sn.p;
    final int end = sn.end;
    final char[] chars = sn.chars;
    p++;
    int slen = 1;

    while (p < end) {
        slen++;
        p++;
    }
    addCompileString(chars, prev, slen, ambig);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Compiler.java

示例3: compileLengthStringNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private int compileLengthStringNode(Node node) {
    StringNode sn = (StringNode)node;
    if (sn.length() <= 0) return 0;
    boolean ambig = sn.isAmbig();

    int p, prev;
    p = prev = sn.p;
    int end = sn.end;
    char[] chars = sn.chars;
    p++;

    int slen = 1;
    int rlen = 0;

    while (p < end) {
        slen++;
        p++;
    }
    int r = addCompileStringlength(chars, prev, slen, ambig);
    rlen += r;
    return rlen;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:23,代码来源:ArrayCompiler.java

示例4: compileStringNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private void compileStringNode(StringNode node) {
    StringNode sn = node;
    if (sn.length() <= 0) return;

    boolean ambig = sn.isAmbig();

    int p, prev;
    p = prev = sn.p;
    int end = sn.end;
    char[] chars = sn.chars;
    p++;
    int slen = 1;

    while (p < end) {
        slen++;
        p++;
    }
    addCompileString(chars, prev, slen, ambig);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:20,代码来源:Compiler.java

示例5: updateStringNodeCaseFoldMultiByte

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private void updateStringNodeCaseFoldMultiByte(final StringNode sn) {
    final char[] ch = sn.chars;
    final int end = sn.end;
    value = sn.p;
    int sp = 0;
    char buf;

    while (value < end) {
        final int ovalue = value;
        buf = EncodingHelper.toLowerCase(ch[value++]);

        if (ch[ovalue] != buf) {

            char[] sbuf = new char[sn.length() << 1];
            System.arraycopy(ch, sn.p, sbuf, 0, ovalue - sn.p);
            value = ovalue;
            while (value < end) {
                buf = EncodingHelper.toLowerCase(ch[value++]);
                if (sp >= sbuf.length) {
                    final char[]tmp = new char[sbuf.length << 1];
                    System.arraycopy(sbuf, 0, tmp, 0, sbuf.length);
                    sbuf = tmp;
                }
                sbuf[sp++] = buf;
            }
            sn.set(sbuf, 0, sp);
            return;
        }
        sp++;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:Analyser.java

示例6: updateStringNodeCaseFoldMultiByte

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private void updateStringNodeCaseFoldMultiByte(StringNode sn) {
    char[] chars = sn.chars;
    int end = sn.end;
    value = sn.p;
    int sp = 0;
    char buf;

    while (value < end) {
        int ovalue = value;
        buf = Character.toLowerCase(chars[value++]);

        if (chars[ovalue] != buf) {

            char[] sbuf = new char[sn.length() << 1];
            System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p);
            value = ovalue;
            while (value < end) {
                buf = Character.toLowerCase(chars[value++]);
                if (sp >= sbuf.length) {
                    char[]tmp = new char[sbuf.length << 1];
                    System.arraycopy(sbuf, 0, tmp, 0, sbuf.length);
                    sbuf = tmp;
                }
                sbuf[sp++] = buf;
            }
            sn.set(sbuf, 0, sp);
            return;
        }
        sp++;
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:32,代码来源:Analyser.java

示例7: compileLengthStringRawNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private static int compileLengthStringRawNode(final StringNode sn) {
    if (sn.length() <= 0) {
        return 0;
    }
    return addCompileStringlength(sn.chars, sn.p, sn.length(), false);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:ArrayCompiler.java

示例8: compileStringRawNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private void compileStringRawNode(final StringNode sn) {
    if (sn.length() <= 0) {
        return;
    }
    addCompileString(sn.chars, sn.p, sn.length(), false);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:Compiler.java

示例9: expandCaseFoldString

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:74,代码来源:Analyser.java

示例10: compileLengthStringRawNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private int compileLengthStringRawNode(StringNode sn) {
    if (sn.length() <= 0) return 0;
    return addCompileStringlength(sn.chars, sn.p, sn.length(), false);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:5,代码来源:ArrayCompiler.java

示例11: compileStringRawNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的package包/类
private void compileStringRawNode(StringNode sn) {
    if (sn.length() <= 0) return;
    addCompileString(sn.chars, sn.p, sn.length(), false);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:5,代码来源:Compiler.java

示例12: expandCaseFoldString

import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; //导入方法依赖的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;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:65,代码来源:Analyser.java


注:本文中的jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode.length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。