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

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


        try {
            // Property1 == Property2 (true == false) = false   
            List v = new ArrayList();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression firstExpression = new Equal(v,true);

            // Property1 == Property3 (true == true) = true   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression secondExpression = new Equal(v,true);

            // Property1 == ConstantTrue (true==true) = true

            v.clear();
            v.add(propertySensor1);
            v.add(new BooleanConstant(true));
            Expression thirdExpression = new Equal(v,true);

            // ConstantFalse == ConstantTrue (false==true) = false
            v.clear();
            v.add(new BooleanConstant(false));
            v.add(new BooleanConstant(true));
            Expression fourthExpression = new Equal(v,true);
           //System.out.println("((Boolean) firstExpression.evaluate()).booleanValue())"+ firstExpression.evaluate());
            assertFalse(
                ((Boolean) firstExpression.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) secondExpression.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) thirdExpression.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) fourthExpression.evaluate()).booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
            fail("Received evaluation exception " + e.getMessage());
        } catch (Exception e) {
          logger.severe("Received evaluation exception " + e.getMessage());
View Full Code Here


        try {

            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new ShortConstant((short) 500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constants (not equal)
            v.clear();
            v.add(new ShortConstant((short) - 100));
            v.add(new ShortConstant((short) 100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        try {

            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new IntegerConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Constant (not equal)
            v.clear();
            v.add(new ShortConstant((short) - 100));
            v.add(new IntegerConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        Vector v = new Vector();
        try {
            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new LongConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constants (not equal)
            v.clear();
            v.add(new ShortConstant((short) - 100));
            v.add(new LongConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        try {

            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new FloatConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Constant (not equal)
            v.clear();
            v.add(new ShortConstant((short) - 100));
            v.add(new FloatConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        Vector v = new Vector();
        try {
            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constants (not equal)
            v.clear();
            v.add(new ShortConstant((short) - 100));
            v.add(new DoubleConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        Vector v = new Vector();
        try {
            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new IntegerConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constant (not equal)
            v.clear();
            v.add(new IntegerConstant(-100));
            v.add(new IntegerConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        Vector v = new Vector();
        try {
            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new LongConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constants (not equal)
            v.clear();
            v.add(new IntegerConstant(-100));
            v.add(new LongConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        Vector v = new Vector();
        try {
            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new FloatConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constants (not equal)
            v.clear();
            v.add(new IntegerConstant(-100));
            v.add(new FloatConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

        Vector v = new Vector();
        try {
            //propertySensor1 == propertySensor2
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression12 = new Equal(v,true);

            //propertySensor1 != propertySensor3
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression13 = new Equal(v,true);

            //propertySensor1 != propertySensor4
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor4);
            Expression expression14 = new Equal(v,true);

            //propertySensor1 != propertySensor5
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor5);
            Expression expression15 = new Equal(v,true);

            //One sensor w/ one Constant (equal)
            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(500));
            Expression expressionIntegerConstant1 = new Equal(v,true);

            //Two Constants (not equal)
            v.clear();
            v.add(new IntegerConstant(-100));
            v.add(new DoubleConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression13.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression14.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression15.evaluate()).booleanValue());
            assertTrue(
                ((Boolean) expressionIntegerConstant1.evaluate())
                    .booleanValue());
            assertFalse(
                ((Boolean) expressionIntegerConstant2.evaluate())
                    .booleanValue());
        } catch (SPLException e) {
          logger.severe("Received evaluation exception " + e.getMessage());
           
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

TOP

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

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.