Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.TypeExpr.sameType()


            Double unRoundedVal = new Double(getDisplayField().getText());
            Byte byteVal = new Byte((byte) Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(byteVal, getValueNode().getTypeExpr());
           
        } else if (typeExpr.sameType(typeConstants.getShortType())) {

            Double unRoundedVal = new Double(getDisplayField().getText());
            Short shortVal = new Short((short) Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(shortVal, getValueNode().getTypeExpr());
View Full Code Here


            Double unRoundedVal = new Double(getDisplayField().getText());
            Short shortVal = new Short((short) Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(shortVal, getValueNode().getTypeExpr());
           
        } else if (typeExpr.sameType(typeConstants.getIntType())) {

            Double unRoundedVal = new Double(getDisplayField().getText());
            Integer integerVal = new Integer((int) Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(integerVal, getValueNode().getTypeExpr());                              
View Full Code Here

            Double unRoundedVal = new Double(getDisplayField().getText());
            Integer integerVal = new Integer((int) Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(integerVal, getValueNode().getTypeExpr());                              
           
        } else if (typeExpr.sameType(typeConstants.getIntegerType())) {

            BigDecimal unRoundedVal = new BigDecimal(getDisplayField().getText());
           
            // Ridiculously, BigDecimal has 8 rounding modes, not one of which is equivalent
            // to the mode used by Math.round!  ROUND_HALF_CEILING is what such a mode would
View Full Code Here

                bigIntegerVal = unRoundedVal.setScale(0, BigDecimal.ROUND_HALF_DOWN).toBigInteger();
            }

            returnVN = new LiteralValueNode(bigIntegerVal, getValueNode().getTypeExpr());                              
       
        } else if (typeExpr.sameType(typeConstants.getDecimalType())) {

            BigDecimal decimalVal = new BigDecimal(getDisplayField().getText());
            returnVN = new LiteralValueNode(decimalVal, getValueNode().getTypeExpr());

        } else if (typeExpr.sameType(typeConstants.getLongType())) {
View Full Code Here

        } else if (typeExpr.sameType(typeConstants.getDecimalType())) {

            BigDecimal decimalVal = new BigDecimal(getDisplayField().getText());
            returnVN = new LiteralValueNode(decimalVal, getValueNode().getTypeExpr());

        } else if (typeExpr.sameType(typeConstants.getLongType())) {

            Double unRoundedVal = new Double(getDisplayField().getText());
            Long longVal = new Long(Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(longVal, getValueNode().getTypeExpr());
View Full Code Here

            Double unRoundedVal = new Double(getDisplayField().getText());
            Long longVal = new Long(Math.round(unRoundedVal.doubleValue()));

            returnVN = new LiteralValueNode(longVal, getValueNode().getTypeExpr());
           
        } else if (typeExpr.sameType(typeConstants.getFloatType())) {

            Float floatVal = new Float(getDisplayField().getText());
            returnVN = new LiteralValueNode(floatVal, getValueNode().getTypeExpr());

        } else if (typeExpr.sameType(typeConstants.getDoubleType())) {
View Full Code Here

        } else if (typeExpr.sameType(typeConstants.getFloatType())) {

            Float floatVal = new Float(getDisplayField().getText());
            returnVN = new LiteralValueNode(floatVal, getValueNode().getTypeExpr());

        } else if (typeExpr.sameType(typeConstants.getDoubleType())) {

            Double doubleVal = new Double(getDisplayField().getText());
            returnVN = new LiteralValueNode(doubleVal, getValueNode().getTypeExpr());
                       
        } else {
View Full Code Here

            PreludeTypeConstants typeConstants = getValueEditorManager().getValueNodeBuilderHelper().getPreludeTypeConstants();
           
            // Integer and Decimal are not built-in types, so we cannot compare them to static
            // constants the way we can for the other types.
            return valueNode instanceof LiteralValueNode &&
                        (typeExpr.sameType(typeConstants.getByteType()) ||
                         typeExpr.sameType(typeConstants.getShortType()) ||
                         typeExpr.sameType(typeConstants.getIntType()) ||
                         typeExpr.sameType(typeConstants.getIntegerType()) ||
                         typeExpr.sameType(typeConstants.getDecimalType()) ||
                         typeExpr.sameType(typeConstants.getLongType()) ||
View Full Code Here

           
            // Integer and Decimal are not built-in types, so we cannot compare them to static
            // constants the way we can for the other types.
            return valueNode instanceof LiteralValueNode &&
                        (typeExpr.sameType(typeConstants.getByteType()) ||
                         typeExpr.sameType(typeConstants.getShortType()) ||
                         typeExpr.sameType(typeConstants.getIntType()) ||
                         typeExpr.sameType(typeConstants.getIntegerType()) ||
                         typeExpr.sameType(typeConstants.getDecimalType()) ||
                         typeExpr.sameType(typeConstants.getLongType()) ||
                         typeExpr.sameType(typeConstants.getFloatType()) ||
View Full Code Here

            // Integer and Decimal are not built-in types, so we cannot compare them to static
            // constants the way we can for the other types.
            return valueNode instanceof LiteralValueNode &&
                        (typeExpr.sameType(typeConstants.getByteType()) ||
                         typeExpr.sameType(typeConstants.getShortType()) ||
                         typeExpr.sameType(typeConstants.getIntType()) ||
                         typeExpr.sameType(typeConstants.getIntegerType()) ||
                         typeExpr.sameType(typeConstants.getDecimalType()) ||
                         typeExpr.sameType(typeConstants.getLongType()) ||
                         typeExpr.sameType(typeConstants.getFloatType()) ||
                         typeExpr.sameType(typeConstants.getDoubleType()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.