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

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


    }

    public void checkLessOrEqualExpressionWithNumericArgumentsShortAgainstFloat() {
        //HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 20);
        propertySensor2=new FloatConstant(5);
        propertySensor3=new FloatConstant(-20);
        propertySensor4=new FloatConstant(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 FloatConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

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

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

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


    }

    public void checkLessOrEqualExpressionWithNumericArgumentsIntegerAgainstFloat() {
        //HashMap map = new HashMap();
        propertySensor1=new IntegerConstant(20);
        propertySensor2=new FloatConstant(5);
        propertySensor3=new FloatConstant(-20);
        propertySensor4=new FloatConstant(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 FloatConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

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

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

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

    }

    public void checkLessOrEqualExpressionWithNumericArgumentsLongAgainstFloat() {
        //HashMap map = new HashMap();
        propertySensor1=new LongConstant(20);
        propertySensor2=new FloatConstant(5);
        propertySensor3=new FloatConstant(-20);
        propertySensor4=new FloatConstant(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 FloatConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

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

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

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

        }
    }

    public void checkLessOrEqualExpressionWithNumericArgumentsFloatAgainstFloat() {
        //HashMap map = new HashMap();
        propertySensor1=new FloatConstant(20);
        propertySensor2=new FloatConstant(5);
        propertySensor3=new FloatConstant(-20);
        propertySensor4=new FloatConstant(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 FloatConstant(5));
            Expression expression4 = new LessOrEqual(v,true);

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

            //-20 < 20 (true)
            v.clear();
            v.add(new FloatConstant(-20));
            v.add(new FloatConstant(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());
View Full Code Here

        Integer o3 = new Integer((int)8.22);
        Long o4 = new Long((long)8.22);
        Double o5 = new Double((double)8.22);
        Number[] num={o1,o2,o3,o4,o5};
        ByteConstant n1=new ByteConstant(o1.byteValue());
        FloatConstant n2=new FloatConstant(o2.floatValue());
        IntegerConstant n3=new IntegerConstant(o3.intValue());
        LongConstant n4=new LongConstant(o4.longValue());
        ArrayList passedParams=new ArrayList();
        passedParams.add(n1);
        passedParams.add(n2);
View Full Code Here

            fail("Received expression exception " + e.getMessage());
        }
    }
   
    public void testAvrgInCollection() {
      propertySensor1 = new FloatConstant((float)1.11);
      propertySensor2 = new FloatConstant((float)2.22);
      propertySensor3 = new FloatConstant((float)3.33);
      propertySensor4 = new FloatConstant((float)4.44);
      propertySensor5 = new FloatConstant((float)-5.55);
      propertySensor6 = new FloatConstant((float)-6.66);
      propertySensor7 = new FloatConstant((float)-7.77);
      propertySensor8 = new FloatConstant((float)88.44);
     
     
     
        try {
            Vector v = new Vector();
View Full Code Here

            fail("Received expression exception " + e.getMessage());
        }
    }
   
    public void testEqCollection() {
      propertySensor1 = new FloatConstant((float)1.11);
      propertySensor2 = new FloatConstant((float)2.22);
      propertySensor3 = new FloatConstant((float)3.33);
      propertySensor4 = new FloatConstant((float)4.44);
      propertySensor5 = new FloatConstant((float)-5.55);
      propertySensor6 = new FloatConstant((float)-6.66);
      propertySensor7 = new FloatConstant((float)-7.77);
      propertySensor8 = new FloatConstant((float)88.44);
     
     
     
        try {
            Vector v = new Vector();
View Full Code Here

            fail("Received expression exception " + e.getMessage());
        }
    }
   
    public void testMaxInCollection() {
      propertySensor1 = new FloatConstant((float)1.11);
      propertySensor2 = new FloatConstant((float)2.22);
      propertySensor3 = new FloatConstant((float)3.33);
      propertySensor4 = new FloatConstant((float)4.44);
      propertySensor5 = new FloatConstant((float)-5.55);
      propertySensor6 = new FloatConstant((float)-6.66);
      propertySensor7 = new FloatConstant((float)-7.77);
      propertySensor8 = new FloatConstant((float)88.44);
     
     
     
        try {
            Vector v = new Vector();
View Full Code Here

            fail("Received expression exception " + e.getMessage());
        }
    }
   
    public void testMinInCollection() {
      propertySensor1 = new FloatConstant((float)1.11);
      propertySensor2 = new FloatConstant((float)2.22);
      propertySensor3 = new FloatConstant((float)3.33);
      propertySensor4 = new FloatConstant((float)4.44);
      propertySensor5 = new FloatConstant((float)-5.55);
      propertySensor6 = new FloatConstant((float)-6.66);
      propertySensor7 = new FloatConstant((float)-7.77);
      propertySensor8 = new FloatConstant((float)88.44);
     
     
     
        try {
            Vector v = new Vector();
View Full Code Here

TOP

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

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.