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


Java Type.Node方法代码示例

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


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

示例1: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
 * Check that we either have no parameters or one parameter that is
 * either a node or a node-set.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {

    // Check the argument type (if any)
    switch(argumentCount()) {
    case 0:
        _paramType = Type.Node;
        break;
    case 1:
        _paramType = _param.typeCheck(stable);
        break;
    default:
        throw new TypeCheckError(this);
    }

    // The argument has to be a node, a node-set or a node reference
    if ((_paramType != Type.NodeSet) &&
        (_paramType != Type.Node) &&
        (_paramType != Type.Reference)) {
        throw new TypeCheckError(this);
    }

    return (_type = Type.String);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:NameBase.java

示例2: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的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:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:NumberCall.java

示例3: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
 * Type checking a cast expression amounts to verifying that the
 * type conversion is legal. Cast expressions are created during
 * type checking, but typeCheck() is usually not called on them.
 * As a result, this method is called from the constructor.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    Type tleft = _left.getType();
    if (tleft == null) {
        tleft = _left.typeCheck(stable);
    }
    if (tleft instanceof NodeType) {
        tleft = Type.Node;  // multiple instances
    }
    else if (tleft instanceof ResultTreeType) {
        tleft = Type.ResultTree; // multiple instances
    }
    if (InternalTypeMap.maps(tleft, _type) != null) {
        return _type;
    }
    // throw new TypeCheckError(this);
    throw new TypeCheckError(new ErrorMsg(
        ErrorMsg.DATA_CONVERSION_ERR, tleft.toString(), _type.toString()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:CastExpr.java

示例4: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    Type type = _select.typeCheck(stable);

    // Prefer to handle the value as a node; fall back to String, otherwise
    if (type != null && !type.identicalTo(Type.Node)) {
        /***
         *** %HZ% Would like to treat result-tree fragments in the same
         *** %HZ% way as node sets for value-of, but that's running into
         *** %HZ% some snags.  Instead, they'll be converted to String
        if (type.identicalTo(Type.ResultTree)) {
            _select = new CastExpr(new CastExpr(_select, Type.NodeSet),
                                   Type.Node);
        } else
        ***/
        if (type.identicalTo(Type.NodeSet)) {
            _select = new CastExpr(_select, Type.Node);
        } else {
            _isString = true;
            if (!type.identicalTo(Type.String)) {
                _select = new CastExpr(_select, Type.String);
            }
            _isString = true;
        }
    }
    return Type.Void;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:ValueOf.java

示例5: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的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:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:StringCall.java

示例6: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的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

示例7: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
 * Type check this step. The abbreviated steps '.' and '@attr' are
 * assigned type node if they have no predicates. All other steps
 * have type node-set.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {

    // Save this value for later - important for testing for special
    // combinations of steps and patterns than can be optimised
    _hadPredicates = hasPredicates();

    // Special case for '.'
    //   in the case where '.' has a context such as book/.
    //   or .[false()] we can not optimize the nodeset to a single node.
    if (isAbbreviatedDot()) {
        _type = (hasParentPattern() || hasPredicates() || hasParentLocationPath()) ?
            Type.NodeSet : Type.Node;
    }
    else {
        _type = Type.NodeSet;
    }

    // Type check all predicates (expressions applied to the step)
    if (_predicates != null) {
        final int n = _predicates.size();
        for (int i = 0; i < n; i++) {
            final Expression pred = (Expression)_predicates.elementAt(i);
            pred.typeCheck(stable);
        }
    }

    // Return either Type.Node or Type.NodeSet
    return _type;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:Step.java


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