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


Java RealType类代码示例

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


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

示例1: initialize

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

示例2: typeCheck

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

        // Inform stylesheet to instantiate a DecimalFormat object
        getStylesheet().numberFormattingUsed();

        final Type tvalue = _value.typeCheck(stable);
        if (tvalue instanceof RealType == false) {
            _value = new CastExpr(_value, Type.Real);
        }
        final Type tformat = _format.typeCheck(stable);
        if (tformat instanceof StringType == false) {
            _format = new CastExpr(_format, Type.String);
        }
        if (argumentCount() == 3) {
            final Type tname = _name.typeCheck(stable);

            if (_name instanceof LiteralExpr) {
                final LiteralExpr literal = (LiteralExpr) _name;
                _resolvedQName =
                    getParser().getQNameIgnoreDefaultNs(literal.getValue());
            }
            else if (tname instanceof StringType == false) {
                _name = new CastExpr(_name, Type.String);
            }
        }
        return _type = Type.String;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:FormatNumberCall.java

示例3: translateDesynthesized

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

    if (tleft instanceof BooleanType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);
    _falseList.add(il.append(_op == Operators.EQ ?
                                 (BranchInstruction)new IF_ICMPNE(null) :
                                 (BranchInstruction)new IF_ICMPEQ(null)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:EqualityExpr.java

示例4: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.RealType; //导入依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_value != null) {
        Type tvalue = _value.typeCheck(stable);
        if (tvalue instanceof RealType == false) {
            _value = new CastExpr(_value, Type.Real);
        }
    }
    if (_count != null) {
        _count.typeCheck(stable);
    }
    if (_from != null) {
        _from.typeCheck(stable);
    }
    if (_format != null) {
        _format.typeCheck(stable);
    }
    if (_lang != null) {
        _lang.typeCheck(stable);
    }
    if (_letterValue != null) {
        _letterValue.typeCheck(stable);
    }
    if (_groupingSeparator != null) {
        _groupingSeparator.typeCheck(stable);
    }
    if (_groupingSize != null) {
        _groupingSize.typeCheck(stable);
    }
    return Type.Void;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:Number.java

示例5: translateDesynthesized

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.RealType; //导入依赖的package包/类
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    if (hasNodeSetArgs() || hasReferenceArgs()) {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
    else {
        BranchInstruction bi = null;
        final InstructionList il = methodGen.getInstructionList();

        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        // TODO: optimize if one of the args is 0

        boolean tozero = false;
        Type tleft = _left.getType();

        if (tleft instanceof RealType) {
    il.append(tleft.CMP(_op == Operators.LT || _op == Operators.LE));
            tleft = Type.Int;
            tozero = true;
        }

        switch (_op) {
    case Operators.LT:
            bi = tleft.GE(tozero);
            break;

    case Operators.GT:
            bi = tleft.LE(tozero);
            break;

    case Operators.LE:
            bi = tleft.GT(tozero);
            break;

    case Operators.GE:
            bi = tleft.LT(tozero);
            break;

        default:
            ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_RELAT_OP_ERR,this);
            getParser().reportError(Constants.FATAL, msg);
        }

        _falseList.add(il.append(bi));              // must be backpatched
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:RelationalExpr.java


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