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


Java Type.isInteger方法代码示例

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


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

示例1: convertOptimisticReturnValue

import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
void convertOptimisticReturnValue() {
    if (isOptimistic) {
        final Type optimisticType = getOptimisticCoercedType();
        if(!optimisticType.isObject()) {
            method.load(optimistic.getProgramPoint());
            if(optimisticType.isInteger()) {
                method.invoke(ENSURE_INT);
            } else if(optimisticType.isLong()) {
                method.invoke(ENSURE_LONG);
            } else if(optimisticType.isNumber()) {
                method.invoke(ENSURE_NUMBER);
            } else {
                throw new AssertionError(optimisticType);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:CodeGenerator.java

示例2: getArrayType

import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
private static ArrayType getArrayType(final Type elementType) {
    if (elementType.isInteger()) {
        return Type.INT_ARRAY;
    } else if (elementType.isLong()) {
        return Type.LONG_ARRAY;
    } else if (elementType.isNumeric()) {
        return Type.NUMBER_ARRAY;
    } else {
        return Type.OBJECT_ARRAY;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:LiteralNode.java

示例3: getArrayType

import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
private static ArrayType getArrayType(final Type elementType) {
    if (elementType.isInteger()) {
        return Type.INT_ARRAY;
    } else if (elementType.isNumeric()) {
        return Type.NUMBER_ARRAY;
    } else {
        return Type.OBJECT_ARRAY;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:LiteralNode.java

示例4: convertOptimisticReturnValue

import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
void convertOptimisticReturnValue() {
    if (isOptimistic) {
        final Type optimisticType = getOptimisticCoercedType();
        if(!optimisticType.isObject()) {
            method.load(optimistic.getProgramPoint());
            if(optimisticType.isInteger()) {
                method.invoke(ENSURE_INT);
            } else if(optimisticType.isNumber()) {
                method.invoke(ENSURE_NUMBER);
            } else {
                throw new AssertionError(optimisticType);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:CodeGenerator.java

示例5: eval

import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
@Override
protected LiteralNode<?> eval() {
    final Node rhsNode = parent.getExpression();

    if (!(rhsNode instanceof LiteralNode)) {
        return null;
    }

    if (rhsNode instanceof ArrayLiteralNode) {
        return null;
    }

    final LiteralNode<?> rhs = (LiteralNode<?>)rhsNode;
    final Type rhsType = rhs.getType();
    final boolean rhsInteger = rhsType.isInteger() || rhsType.isBoolean();

    LiteralNode<?> literalNode;

    switch (parent.tokenType()) {
    case ADD:
        if (rhsInteger) {
            literalNode = LiteralNode.newInstance(token, finish, rhs.getInt32());
        } else {
            literalNode = LiteralNode.newInstance(token, finish, rhs.getNumber());
        }
        break;
    case SUB:
        if (rhsInteger && rhs.getInt32() != 0) { // @see test/script/basic/minuszero.js
            literalNode = LiteralNode.newInstance(token, finish, -rhs.getInt32());
        } else {
            literalNode = LiteralNode.newInstance(token, finish, -rhs.getNumber());
        }
        break;
    case NOT:
        literalNode = LiteralNode.newInstance(token, finish, !rhs.getBoolean());
        break;
    case BIT_NOT:
        literalNode = LiteralNode.newInstance(token, finish, ~rhs.getInt32());
        break;
    default:
        return null;
    }

    return literalNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:FoldConstants.java

示例6: eval

import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
@Override
protected LiteralNode<?> eval() {
    final Node rhsNode = parent.getExpression();

    if (!(rhsNode instanceof LiteralNode)) {
        return null;
    }

    if (rhsNode instanceof ArrayLiteralNode) {
        return null;
    }

    final LiteralNode<?> rhs = (LiteralNode<?>)rhsNode;
    final Type rhsType = rhs.getType();
    final boolean rhsInteger = rhsType.isInteger() || rhsType.isBoolean();

    LiteralNode<?> literalNode;

    switch (parent.tokenType()) {
    case POS:
        if (rhsInteger) {
            literalNode = LiteralNode.newInstance(token, finish, rhs.getInt32());
        } else if (rhsType.isLong()) {
            literalNode = LiteralNode.newInstance(token, finish, rhs.getLong());
        } else {
            literalNode = LiteralNode.newInstance(token, finish, rhs.getNumber());
        }
        break;
    case NEG:
        if (rhsInteger && rhs.getInt32() != 0) { // @see test/script/basic/minuszero.js
            literalNode = LiteralNode.newInstance(token, finish, -rhs.getInt32());
        } else if (rhsType.isLong() && rhs.getLong() != 0L) {
            literalNode = LiteralNode.newInstance(token, finish, -rhs.getLong());
        } else {
            literalNode = LiteralNode.newInstance(token, finish, -rhs.getNumber());
        }
        break;
    case NOT:
        literalNode = LiteralNode.newInstance(token, finish, !rhs.getBoolean());
        break;
    case BIT_NOT:
        literalNode = LiteralNode.newInstance(token, finish, ~rhs.getInt32());
        break;
    default:
        return null;
    }

    return literalNode;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:50,代码来源:FoldConstants.java


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