Package org.apache.imperius.spl.parser.expressions.impl

Examples of org.apache.imperius.spl.parser.expressions.impl.DoubleConstant


    }

    public void checkLessOrEqualExpressionWithNumericArgumentsShortAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        propertySensor4=new DoubleConstant(20);

        //SensorLookup lookup = new SensorLookupImpl(map);

        // Property1 < Property2 (20 < 5) = false   
        try {
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression1 = new LessOrEqual(v,true);

            // Property3 < Property1 (-20 < 20) = true   
            v.clear();
            v.add(propertySensor3);
            v.add(propertySensor1);
            Expression expression2 = new LessOrEqual(v,true);

            // Property1 == Property4 (20 == 20) = true   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression3 = new LessOrEqual(v,true);

            // Property1 < 5 (false)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

            //Property1 == 20 (true)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(20));
            Expression expression5 = new LessOrEqual(v,true);

            //-20 < 20 (true)
            v.clear();
            v.add(new ShortConstant((short) - 20));
            v.add(new DoubleConstant(20));
            Expression expression6 = new LessOrEqual(v,true);

            assertFalse(
                ((Boolean) expression1.evaluate()).booleanValue());
            assertTrue(((Boolean) expression2.evaluate()).booleanValue());
View Full Code Here


    }

    public void checkLessOrEqualExpressionWithNumericArgumentsIntegerAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new IntegerConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        propertySensor4=new DoubleConstant(20);

        //SensorLookup lookup = new SensorLookupImpl(map);

        // Property1 < Property2 (20 < 5) = false   
        try {
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression1 = new LessOrEqual(v,true);

            // Property3 < Property1 (-20 < 20) = true   
            v.clear();
            v.add(propertySensor3);
            v.add(propertySensor1);
            Expression expression2 = new LessOrEqual(v,true);

            // Property1 == Property4 (20 == 20) = true   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression3 = new LessOrEqual(v,true);

            // Property1 < 5 (false)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

            //Property1 == 20 (true)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(20));
            Expression expression5 = new LessOrEqual(v,true);

            //-20 < 20 (true)
            v.clear();
            v.add(new IntegerConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression6 = new LessOrEqual(v,true);

            assertFalse(
                ((Boolean) expression1.evaluate()).booleanValue());
            assertTrue(((Boolean) expression2.evaluate()).booleanValue());
View Full Code Here

    }

    public void checkLessOrEqualExpressionWithNumericArgumentsLongAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new LongConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        propertySensor4=new DoubleConstant(20);

        //SensorLookup lookup = new SensorLookupImpl(map);

        // Property1 < Property2 (20 < 5) = false   
        try {
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression1 = new LessOrEqual(v,true);

            // Property3 < Property1 (-20 < 20) = true   
            v.clear();
            v.add(propertySensor3);
            v.add(propertySensor1);
            Expression expression2 = new LessOrEqual(v,true);

            // Property1 == Property4 (20 == 20) = true   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression3 = new LessOrEqual(v,true);

            // Property1 < 5 (false)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

            //Property1 == 20 (true)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(20));
            Expression expression5 = new LessOrEqual(v,true);

            //-20 < 20 (true)
            v.clear();
            v.add(new LongConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression6 = new LessOrEqual(v,true);

            assertFalse(
                ((Boolean) expression1.evaluate()).booleanValue());
            assertTrue(((Boolean) expression2.evaluate()).booleanValue());
View Full Code Here

    }

    public void checkLessOrEqualExpressionWithNumericArgumentsFloatAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new FloatConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        propertySensor4=new DoubleConstant(20);

        //SensorLookup lookup = new SensorLookupImpl(map);

        // Property1 < Property2 (20 < 5) = false   
        try {
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression1 = new LessOrEqual(v,true);

            // Property3 < Property1 (-20 < 20) = true   
            v.clear();
            v.add(propertySensor3);
            v.add(propertySensor1);
            Expression expression2 = new LessOrEqual(v,true);

            // Property1 == Property4 (20 == 20) = true   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression3 = new LessOrEqual(v,true);

            // Property1 < 5 (false)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

            //Property1 == 20 (true)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(20));
            Expression expression5 = new LessOrEqual(v,true);

            //-20 < 20 (true)
            v.clear();
            v.add(new FloatConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression6 = new LessOrEqual(v,true);

            assertFalse(
                ((Boolean) expression1.evaluate()).booleanValue());
            assertTrue(((Boolean) expression2.evaluate()).booleanValue());
View Full Code Here

        }
    }

    public void checkLessOrEqualExpressionWithNumericArgumentsDoubleAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new DoubleConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        propertySensor4=new DoubleConstant(20);

        //SensorLookup lookup = new SensorLookupImpl(map);

        // Property1 < Property2 (20 < 5) = false   
        try {
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression1 = new LessOrEqual(v,true);

            // Property3 < Property1 (-20 < 20) = true   
            v.clear();
            v.add(propertySensor3);
            v.add(propertySensor1);
            Expression expression2 = new LessOrEqual(v,true);

            // Property1 == Property4 (20 == 20) = true   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression3 = new LessOrEqual(v,true);

            // Property1 < 5 (false)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

            //Property1 == 20 (true)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(20));
            Expression expression5 = new LessOrEqual(v,true);

            //-20 < 20 (true)
            v.clear();
            v.add(new DoubleConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression6 = new LessOrEqual(v,true);

            assertFalse(
                ((Boolean) expression1.evaluate()).booleanValue());
            assertTrue(((Boolean) expression2.evaluate()).booleanValue());
View Full Code Here

 
  public void testDoubleConstant() {
    Double s1 = new Double(65000.65);
   
    //HashMap map = new HashMap();
    propertySensor1=new DoubleConstant(s1.doubleValue());
   
   
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
View Full Code Here

      char[] cArr = val.toCharArray();
      returnExpr = new CharConstant(cArr[0]);
      break;

    case TypeConstants.doubleType:
      returnExpr = new DoubleConstant(Double.valueOf(val).doubleValue());
      break;

    case TypeConstants.floatType:
      returnExpr = new FloatConstant(Float.valueOf(val).floatValue());
      break;
View Full Code Here

        String s2 = "\""+dn2.toString()+"\"";

        //HashMap map = new HashMap();
        propertySensor1=new StringConstant(s1.toString());
        propertySensor2=new StringConstant(s2.toString());
        propertySensor3=new DoubleConstant(dn1.doubleValue());
        propertySensor4=new DoubleConstant(dn2.doubleValue());
        //SensorLookup lookup = new SensorLookupImpl(map);

        try {
            Vector v = new Vector();
            v.add(new StringConstant(s1));
            Expression es1 = new ToREAL64(v,true);

            v.clear();
            v.add(new StringConstant(s2));
            Expression es2 = new ToREAL64(v,true);

            v.clear();
            v.add(new DoubleConstant(dn1.doubleValue()));
            Expression edn1 = new ToREAL64(v,true);

            v.clear();
            v.add(new DoubleConstant(dn2.doubleValue()));
            Expression edn2 = new ToREAL64(v,true);

            v.clear();
            v.add(propertySensor1);
            Expression eps1 = new ToREAL64(v,true);
View Full Code Here

    propertySensor4=new IntegerConstant(in2);
    propertySensor5=new LongConstant(ln1);
    propertySensor6=new LongConstant(ln2);
    propertySensor7=new FloatConstant(fn1);
    propertySensor8=new FloatConstant(fn2);
    propertySensor9=new DoubleConstant(dn1);
    propertySensor10=new DoubleConstant(dn2);


        //SensorLookup lookup = new SensorLookupImpl(map);

        try {
            Vector v = new Vector();
            v.add(new ShortConstant(sn1));
            v.add(new ShortConstant(sn2));
           
            Expression es = new Addition(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new IntegerConstant(in2));
           
            Expression ei = new Addition(v,true);

            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new LongConstant(ln2));
          
            Expression el = new Addition(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new FloatConstant(fn2));
           
            Expression ef = new Addition(v,true);

            v.clear();
            v.add(new DoubleConstant(dn1));
            v.add(new DoubleConstant(dn2));
          
            Expression ed = new Addition(v,true);

            v.clear();
            v.add(new ShortConstant(sn1));
            v.add(new IntegerConstant(in1));
           
            Expression emix1 = new Addition(v,true);
           
            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new FloatConstant(fn1));
            Expression emix2 = new Addition(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new DoubleConstant(dn1));
            Expression emix3 = new Addition(v,true);


            v.clear();
          
            v.add(propertySensor2);
            v.add(new ShortConstant(sn3));
            Expression eps1 = new Addition(v,true);

            v.clear();
            v.add(propertySensor4);
            v.add(new IntegerConstant(in3));
            Expression eps2 = new Addition(v,true);

            v.clear();
           
            v.add(propertySensor6);
            v.add(new LongConstant(ln3));
            Expression eps3 = new Addition(v,true);

            v.clear();
           
            v.add(propertySensor8);
            v.add(new FloatConstant(fn3));
            Expression eps4 = new Addition(v,true);

            v.clear();
          
            v.add(propertySensor10);
            v.add(new DoubleConstant(dn3));
            Expression eps5 = new Addition(v,true);

            assertTrue(
                ((sn1 + sn2)
                    - ((Number) es.evaluate()).shortValue())
View Full Code Here

    propertySensor4=new IntegerConstant(in2);
    propertySensor5=new LongConstant(ln1);
    propertySensor6=new LongConstant(ln2);
    propertySensor7=new FloatConstant(fn1);
    propertySensor8=new FloatConstant(fn2);
    propertySensor9=new DoubleConstant(dn1);
    propertySensor10=new DoubleConstant(dn2);

        //SensorLookup lookup = new SensorLookupImpl(map);

        try {
            Vector v = new Vector();
            v.add(new ShortConstant(sn1));
            v.add(new ShortConstant(sn2));
            Expression es = new Subtraction(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new IntegerConstant(in2));
            Expression ei = new Subtraction(v,true);

            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new LongConstant(ln2));
            Expression el = new Subtraction(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new FloatConstant(fn2));
            Expression ef = new Subtraction(v,true);

            v.clear();
            v.add(new DoubleConstant(dn1));
            v.add(new DoubleConstant(dn2));
            Expression ed = new Subtraction(v,true);

            v.clear();
            v.add(new ShortConstant(sn1));
            v.add(new IntegerConstant(in1));
            Expression emix1 = new Subtraction(v,true);

            v.clear();
            v.add(new ShortConstant(sn1));
            v.add(new LongConstant(ln1));
            Expression emix2 = new Subtraction(v,true);

            v.clear();
            v.add(new ShortConstant(sn1));
            v.add(new FloatConstant(fn1));
            Expression emix3 = new Subtraction(v,true);

            v.clear();
            v.add(new ShortConstant(sn1));
            v.add(new DoubleConstant(dn1));
            Expression emix4 = new Subtraction(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new LongConstant(ln1));
            Expression emix5 = new Subtraction(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new FloatConstant(fn1));
            Expression emix6 = new Subtraction(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new DoubleConstant(dn1));
            Expression emix7 = new Subtraction(v,true);

            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new FloatConstant(fn1));
            Expression emix8 = new Subtraction(v,true);

            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new DoubleConstant(dn1));
            Expression emix9 = new Subtraction(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new DoubleConstant(dn1));
            Expression emix10 = new Subtraction(v,true);

      v.clear();
      v.add(propertySensor1);
      v.add(propertySensor2);
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.parser.expressions.impl.DoubleConstant

Copyright © 2018 www.massapicom. 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.