• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClassGenerator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator的典型用法代码示例。如果您正苦于以下问题:Java ClassGenerator类的具体用法?Java ClassGenerator怎么用?Java ClassGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClassGenerator类属于com.sun.org.apache.xalan.internal.xsltc.compiler.util包,在下文中一共展示了ClassGenerator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: compileDefaultRecursion

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Compiles the default handling for DOM elements: traverse all children
 */
private InstructionList compileDefaultRecursion(ClassGenerator classGen,
                                                MethodGenerator methodGen,
                                                InstructionHandle next) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();
    final String applyTemplatesSig = classGen.getApplyTemplatesSig();
    final int git = cpg.addInterfaceMethodref(DOM_INTF,
                                              GET_CHILDREN,
                                              GET_CHILDREN_SIG);
    final int applyTemplates = cpg.addMethodref(getClassName(),
                                                functionName(),
                                                applyTemplatesSig);
    il.append(classGen.loadTranslet());
    il.append(methodGen.loadDOM());

    il.append(methodGen.loadDOM());
    il.append(new ILOAD(_currentIndex));
    il.append(new INVOKEINTERFACE(git, 2));
    il.append(methodGen.loadHandler());
    il.append(new INVOKEVIRTUAL(applyTemplates));
    il.append(new GOTO_W(next));
    return il;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:Mode.java


示例2: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the name of a node in the DOM
    final int getNodeName = cpg.addInterfaceMethodref(DOM_INTF,
                                                      "getNodeName",
                                                      "(I)"+STRING_SIG);

    final int getLocalName = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                              "getLocalName",
                                              "(Ljava/lang/String;)"+
                                              "Ljava/lang/String;");
    super.translate(classGen, methodGen);
    il.append(new INVOKEINTERFACE(getNodeName, 2));
    il.append(new INVOKESTATIC(getLocalName));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:LocalNameCall.java


示例3: translateContents

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Call translate() on all child syntax tree nodes.
 * @param classGen BCEL Java class generator
 * @param methodGen BCEL Java method generator
 */
protected void translateContents(ClassGenerator classGen,
                                 MethodGenerator methodGen) {
    // Call translate() on all child nodes
    final int n = elementCount();

    for (int i = 0; i < n; i++) {
        methodGen.markChunkStart();
        final SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i);
        item.translate(classGen, methodGen);
        methodGen.markChunkEnd();
    }

    // After translation, unmap any registers for any variables/parameters
    // that were declared in this scope. Performing this unmapping in the
    // same AST scope as the declaration deals with the problems of
    // references falling out-of-scope inside the for-each element.
    // (the cause of which being 'lazy' register allocation for references)
    for (int i = 0; i < n; i++) {
        if( _contents.elementAt(i) instanceof VariableBase) {
            final VariableBase var = (VariableBase)_contents.elementAt(i);
            var.unmapRegister(methodGen);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SyntaxTreeNode.java


示例4: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    Type targ;

    if (argumentCount() == 0) {
        il.append(methodGen.loadContextNode());
        targ = Type.Node;
    }
    else {
        final Expression arg = argument();
        arg.translate(classGen, methodGen);
        arg.startIterator(classGen, methodGen);
        targ = arg.getType();
    }

    if (!targ.identicalTo(Type.Real)) {
        targ.translateTo(classGen, methodGen, Type.Real);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:NumberCall.java


示例5: loadAsArrayOffsetLength

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Generates code that loads the array that will contain the character
 * data represented by this Text node, followed by the offset of the
 * data from the start of the array, and then the length of the data.
 *
 * The pre-condition to calling this method is that
 * canLoadAsArrayOffsetLength() returns true.
 * @see #canLoadArrayOffsetLength()
 */
public void loadAsArrayOffsetLength(ClassGenerator classGen,
                                    MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // The XSLTC object keeps track of character data
    // that is to be stored in char arrays.
    final int offset = xsltc.addCharacterData(_text);
    final int length = _text.length();
    String charDataFieldName =
        STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1);

    il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(),
                                   charDataFieldName,
                                   STATIC_CHAR_DATA_FIELD_SIG)));
    il.append(new PUSH(cpg, offset));
    il.append(new PUSH(cpg, _text.length()));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:Text.java


示例6: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();

    if (methodGen instanceof CompareGenerator) {
        il.append(((CompareGenerator)methodGen).loadLastNode());
    }
    else if (methodGen instanceof TestGenerator) {
        il.append(new ILOAD(LAST_INDEX));
    }
    else {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final int getLast = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                                      "getLast",
                                                      "()I");
        il.append(methodGen.loadIterator());
        il.append(new INVOKEINTERFACE(getLast, 1));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:LastCall.java


示例7: translateLiteral

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * This method is called when the name of the element is known at compile time.
 * In this case, there is no need to inspect the element name at runtime to
 * determine if a prefix exists, needs to be generated, etc.
 */
public void translateLiteral(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (!_ignore) {
        il.append(methodGen.loadHandler());
        _name.translate(classGen, methodGen);
        il.append(DUP2);
        il.append(methodGen.startElement());

        if (_namespace != null) {
            il.append(methodGen.loadHandler());
            il.append(new PUSH(cpg, _prefix));
            _namespace.translate(classGen,methodGen);
            il.append(methodGen.namespace());
        }
    }

    translateContents(classGen, methodGen);

    if (!_ignore) {
        il.append(methodGen.endElement());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:XslElement.java


示例8: compileTemplateCalls

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
private void compileTemplateCalls(ClassGenerator classGen,
                                  MethodGenerator methodGen,
                                  InstructionHandle next, int min, int max){
    _neededTemplates.keySet().stream().forEach((template) -> {
        final int prec = template.getImportPrecedence();
        if ((prec >= min) && (prec < max)) {
            if (template.hasContents()) {
                InstructionList til = template.compile(classGen, methodGen);
                til.append(new GOTO_W(next));
                _templateILs.put(template, til);
                _templateIHs.put(template, til.getStart());
            }
            else {
                // empty template
                _templateIHs.put(template, next);
            }
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:Mode.java


示例9: translateContents

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Call translate() on all child syntax tree nodes.
 * @param classGen BCEL Java class generator
 * @param methodGen BCEL Java method generator
 */
protected void translateContents(ClassGenerator classGen,
                                 MethodGenerator methodGen) {
    // Call translate() on all child nodes
    final int n = elementCount();

    for (SyntaxTreeNode item : _contents) {
        methodGen.markChunkStart();
        item.translate(classGen, methodGen);
        methodGen.markChunkEnd();
    }

    // After translation, unmap any registers for any variables/parameters
    // that were declared in this scope. Performing this unmapping in the
    // same AST scope as the declaration deals with the problems of
    // references falling out-of-scope inside the for-each element.
    // (the cause of which being 'lazy' register allocation for references)
    for (int i = 0; i < n; i++) {
        if ( _contents.get(i) instanceof VariableBase) {
            final VariableBase var = (VariableBase)_contents.get(i);
            var.unmapRegister(classGen, methodGen);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:SyntaxTreeNode.java


示例10: compileDefaultText

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Compiles the default action for DOM text nodes and attribute nodes:
 * output the node's text value
 */
private InstructionList compileDefaultText(ClassGenerator classGen,
                                           MethodGenerator methodGen,
                                           InstructionHandle next) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();

    final int chars = cpg.addInterfaceMethodref(DOM_INTF,
                                                CHARACTERS,
                                                CHARACTERS_SIG);
    il.append(methodGen.loadDOM());
    il.append(new ILOAD(_currentIndex));
    il.append(methodGen.loadHandler());
    il.append(new INVOKEINTERFACE(chars, 3));
    il.append(new GOTO_W(next));
    return il;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Mode.java


示例11: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Translate the fallback element (if any).
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    if (_fallbacks != null) {
        int count = _fallbacks.size();
        for (int i = 0; i < count; i++) {
            Fallback fallback = (Fallback)_fallbacks.elementAt(i);
            fallback.translate(classGen, methodGen);
        }
    }
    // We only go into the else block in forward-compatibility mode, when
    // the unsupported element has no fallback.
    else {
        // If the unsupported element does not have any fallback child, then
        // at runtime, a runtime error should be raised when the unsupported
        // element is instantiated. Otherwise, no error is thrown.
        ConstantPoolGen cpg = classGen.getConstantPool();
        InstructionList il = methodGen.getInstructionList();

        final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF",
                                                     "(" + STRING_SIG + "Z)V");
        il.append(new PUSH(cpg, getQName().toString()));
        il.append(new PUSH(cpg, _isExtension));
        il.append(new INVOKESTATIC(unsupportedElem));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:UnsupportedElement.java


示例12: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    Type targ;

    if (argumentCount() == 0) {
        il.append(methodGen.loadContextNode());
        targ = Type.Node;
    }
    else {
        final Expression arg = argument();
        arg.translate(classGen, methodGen);
        arg.startIterator(classGen, methodGen);
        targ = arg.getType();
    }

    if (!targ.identicalTo(Type.String)) {
        targ.translateTo(classGen, methodGen, Type.String);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:StringCall.java


示例13: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    _value.translate(classGen, methodGen);
    _format.translate(classGen, methodGen);

    final int fn3arg = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                        "formatNumber",
                                        "(DLjava/lang/String;"+
                                        "Ljava/text/DecimalFormat;)"+
                                        "Ljava/lang/String;");
    final int get = cpg.addMethodref(TRANSLET_CLASS,
                                     "getDecimalFormat",
                                     "(Ljava/lang/String;)"+
                                     "Ljava/text/DecimalFormat;");

    il.append(classGen.loadTranslet());
    if (_name == null) {
        il.append(new PUSH(cpg, EMPTYSTRING));
    }
    else if (_resolvedQName != null) {
        il.append(new PUSH(cpg, _resolvedQName.toString()));
    }
    else {
        _name.translate(classGen, methodGen);
    }
    il.append(new INVOKEVIRTUAL(get));
    il.append(new INVOKESTATIC(fn3arg));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:FormatNumberCall.java


示例14: compileGetChildren

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
public static void compileGetChildren(ClassGenerator classGen,
                                      MethodGenerator methodGen,
                                      int node) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final int git = cpg.addInterfaceMethodref(DOM_INTF,
                                              GET_CHILDREN,
                                              GET_CHILDREN_SIG);
    il.append(methodGen.loadDOM());
    il.append(new ILOAD(node));
    il.append(new INVOKEINTERFACE(git, 2));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:Mode.java


示例15: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Translate contents only if this fallback element is put in place of
 * some unsupported element or non-XSLTC extension element
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_active) translateContents(classGen, methodGen);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Fallback.java


示例16: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Translate the "test" expression and contents of this element.
 * The contents will be ignored if we know the test will always fail.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    _test.translateDesynthesized(classGen, methodGen);
    // remember end of condition
    final InstructionHandle truec = il.getEnd();
    if (!_ignore) {
        translateContents(classGen, methodGen);
    }
    _test.backPatchFalseList(il.append(NOP));
    _test.backPatchTrueList(truec.getNext());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:If.java


示例17: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Translate the code required for getting the node for which the
 * QName, local-name or namespace URI should be extracted.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    il.append(methodGen.loadDOM());

    // Function was called with no parameters
    if (argumentCount() == 0) {
        il.append(methodGen.loadContextNode());
    }
    // Function was called with node parameter
    else if (_paramType == Type.Node) {
        _param.translate(classGen, methodGen);
    }
    else if (_paramType == Type.Reference) {
        _param.translate(classGen, methodGen);
        il.append(new INVOKESTATIC(cpg.addMethodref
                                   (BASIS_LIBRARY_CLASS,
                                    "referenceToNodeSet",
                                    "("
                                    + OBJECT_SIG
                                    + ")"
                                    + NODE_ITERATOR_SIG)));
        il.append(methodGen.nextNode());
    }
    // Function was called with node-set parameter
    else {
        _param.translate(classGen, methodGen);
        _param.startIterator(classGen, methodGen);
        il.append(methodGen.nextNode());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:NameBase.java


示例18: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    argument().translate(classGen, methodGen);
    methodGen.getInstructionList()
        .append(new INVOKESTATIC(classGen.getConstantPool()
                                 .addMethodref(MATH_CLASS,
                                               "floor", "(D)D")));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:FloorCall.java


示例19: initialize

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * This method is part of a little trick that is needed to use local
 * variables inside nested for-each loops. See the initializeVariables()
 * method in the ForEach class for an explanation
 */
public void initialize(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // This is only done for local variables that are actually used
    if (isLocal() && !_refs.isEmpty()) {
        // Create a variable slot if none is allocated
        if (_local == null) {
            _local = methodGen.addLocalVariable2(getEscapedName(),
                                                 _type.toJCType(),
                                                 null);
        }
        // Push the default value on the JVM's stack
        if ((_type instanceof IntType) ||
            (_type instanceof NodeType) ||
            (_type instanceof BooleanType))
            il.append(new ICONST(0)); // 0 for node-id, integer and boolean
        else if (_type instanceof RealType)
            il.append(new DCONST(0)); // 0.0 for floating point numbers
        else
            il.append(new ACONST_NULL()); // and 'null' for anything else

        // Mark the store as the start of the live range of the variable
        _local.setStart(il.append(_type.STORE(_local.getIndex())));

    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:Variable.java


示例20: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; //导入依赖的package包/类
/**
 * Compile the expression - leave boolean expression on stack
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    _base.translate(classGen, methodGen);
    _token.translate(classGen, methodGen);
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
                                                 "startsWith",
                                                 "("+STRING_SIG+")Z")));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:StartsWithCall.java



注:本文中的com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UIDL类代码示例发布时间:2022-05-23
下一篇:
Java MutableInteger类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap