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

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


 
  public void testShortConstant() {
    Short s1 = new Short((short)23);
   
    //HashMap map = new HashMap();
    propertySensor1=new ShortConstant(s1.shortValue());
   
   
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
View Full Code Here


    }

    public void checkEqualExpressionWithNumericArgumentsShortAgainstShort() {

        ////HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 500);
        propertySensor2=new ShortConstant((short) 500);
        propertySensor3=new ShortConstant((short) 499);
        propertySensor4=new ShortConstant((short) 501);
        propertySensor5=new ShortConstant((short) - 500);
        //propertySensor1=new Short((short) 500));
        //propertySensor2=new Short((short) 500));
        //propertySensor3=new Short((short) 499));
        //propertySensor4=new Short((short) 501));
        //propertySensor5=new Short((short) - 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 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(
View Full Code Here

    }

    public void checkEqualExpressionWithNumericArgumentsShortAgainstInteger() {

        ////HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 500);
        propertySensor2=new IntegerConstant(500);
        propertySensor3=new IntegerConstant(499);
        propertySensor4=new IntegerConstant(501);
        propertySensor5=new IntegerConstant(501);
        //propertySensor1=new Short((short) 500));
        //propertySensor2=new IntegerConstant(500));
        //propertySensor3=new IntegerConstant(499));
        //propertySensor4=new IntegerConstant(501));
        //propertySensor5=new IntegerConstant(501));
        //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 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());
View Full Code Here

    public void checkEqualExpressionWithNumericArgumentsShortAgainstLong() {

        //HashMap map = new HashMap();

        propertySensor1=new ShortConstant((short) 500);
        propertySensor2=new LongConstant(500);
        propertySensor3=new LongConstant(499);
        propertySensor4=new LongConstant(501);
        propertySensor5=new LongConstant(-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 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());
View Full Code Here

    public void checkEqualExpressionWithNumericArgumentsShortAgainstFloat() {

        //HashMap map = new HashMap();

        propertySensor1=new ShortConstant((short) 500);
        propertySensor2=new FloatConstant(500);
        propertySensor3=new FloatConstant(499);
        propertySensor4=new FloatConstant(501);
        propertySensor5=new FloatConstant(-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 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());
View Full Code Here

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

        checkGreaterExpressionWithNumericArgumentsDoubleAgainstDouble();
    }

    public void checkGreaterExpressionWithNumericArgumentsShortAgainstShort() {
        //HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 20);
        propertySensor2=new ShortConstant((short) 5);
        propertySensor3=new ShortConstant((short) - 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 ShortConstant((short) 5));
            Expression expression3 = new Greater(v,true);

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

            //TODO at least one comparison for each of the numeric types against another numeric type
            assertTrue(((Boolean) expression1.evaluate()).booleanValue());
            assertFalse(
View Full Code Here

        }
    }

    public void checkGreaterExpressionWithNumericArgumentsShortAgainstInteger() {
        //HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 20);
        propertySensor2=new IntegerConstant(5);
        propertySensor3=new IntegerConstant(-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 IntegerConstant(5));
            Expression expression3 = new Greater(v,true);

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

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

        }
    }

    public void checkGreaterExpressionWithNumericArgumentsShortAgainstLong() {
        //HashMap map = new HashMap();
        propertySensor1=new ShortConstant((short) 20);
        propertySensor2=new LongConstant(5);
        propertySensor3=new LongConstant(-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 LongConstant(5));
            Expression expression3 = new Greater(v,true);

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

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

        }
    }

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

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

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

TOP

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

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.