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

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


    public void checkEqualExpressionWithNumericArgumentsShortAgainstDouble() {

        //HashMap map = new HashMap();

        propertySensor1=new ShortConstant((short) 500);
        propertySensor2=new DoubleConstant(500);
        propertySensor3=new DoubleConstant(499);
        propertySensor4=new DoubleConstant(501);
        propertySensor5=new DoubleConstant(-500);
        //SensorLookup lookup = new SensorLookupImpl(map);

        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(
View Full Code Here


    public void checkEqualExpressionWithNumericArgumentsIntegerAgainstDouble() {

        //HashMap map = new HashMap();

        propertySensor1=new IntegerConstant(500);
        propertySensor2=new DoubleConstant(500);
        propertySensor3=new DoubleConstant(499);
        propertySensor4=new DoubleConstant(501);
        propertySensor5=new DoubleConstant(-500);
        //SensorLookup lookup = new SensorLookupImpl(map);

        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(
View Full Code Here

    public void checkEqualExpressionWithNumericArgumentsLongAgainstDouble() {

        //HashMap map = new HashMap();

        propertySensor1=new LongConstant(500);
        propertySensor2=new DoubleConstant(500);
        propertySensor3=new DoubleConstant(499);
        propertySensor4=new DoubleConstant(501);
        propertySensor5=new DoubleConstant(-500);
        //SensorLookup lookup = new SensorLookupImpl(map);

        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 LongConstant(-100));
            v.add(new DoubleConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

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

    public void checkEqualExpressionWithNumericArgumentsFloatAgainstDouble() {

        //HashMap map = new HashMap();

        propertySensor1=new FloatConstant(500);
        propertySensor2=new DoubleConstant(500);
        propertySensor3=new DoubleConstant(499);
        propertySensor4=new DoubleConstant(501);
        propertySensor5=new DoubleConstant(-500);
        //SensorLookup lookup = new SensorLookupImpl(map);

        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 FloatConstant(-100));
            v.add(new DoubleConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

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

    public void checkEqualExpressionWithNumericArgumentsDoubleAgainstDouble() {

        //HashMap map = new HashMap();

        propertySensor1=new DoubleConstant(500);
        propertySensor2=new DoubleConstant(500);
        propertySensor3=new DoubleConstant(499);
        propertySensor4=new DoubleConstant(501);
        propertySensor5=new DoubleConstant(-500);
        //SensorLookup lookup = new SensorLookupImpl(map);

        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 DoubleConstant(-100));
            v.add(new DoubleConstant(100));
            Expression expressionIntegerConstant2 = new Equal(v,true);

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

    }

    public void checkGreaterExpressionWithNumericArgumentsShortAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        //SensorLookup lookup = new SensorLookupImpl(map);
        try {
            // Property1 > Property2 (20 > 5) = true   
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression expression1 = new Greater(v,true);

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

            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression3 = new Greater(v,true);

            v.clear();
            v.add(new ShortConstant((short) - 20));
            v.add(new DoubleConstant(20));
            Expression expression4 = new Greater(v,true);

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

    }

    public void checkGreaterExpressionWithNumericArgumentsIntegerAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new IntegerConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression3 = new Greater(v,true);

            v.clear();
            v.add(new IntegerConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression4 = new Greater(v,true);

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

    }

    public void checkGreaterExpressionWithNumericArgumentsLongAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new LongConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression3 = new Greater(v,true);

            v.clear();
            v.add(new LongConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression4 = new Greater(v,true);

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

    }

    public void checkGreaterExpressionWithNumericArgumentsFloatAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new FloatConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression3 = new Greater(v,true);

            v.clear();
            v.add(new FloatConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression4 = new Greater(v,true);

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

        }
    }

    public void checkGreaterExpressionWithNumericArgumentsDoubleAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new DoubleConstant(20);
        propertySensor2=new DoubleConstant(5);
        propertySensor3=new DoubleConstant(-20);
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression3 = new Greater(v,true);

            v.clear();
            v.add(new DoubleConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression4 = new Greater(v,true);

            assertTrue(((Boolean) expression1.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression2.evaluate()).booleanValue());
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.