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

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


        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);
        passedParams.add(n3);
        passedParams.add(n4);
View Full Code Here


 
  public void testLongConstant() {
    Long s1 = new Long(65000);
   
    //HashMap map = new HashMap();
    propertySensor1=new LongConstant(s1.longValue());
   
   
    //SensorLookup lookup = new SensorLookupImpl(map);

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

    public void checkEqualExpressionWithNumericArgumentsIntegerAgainstLong() {

        //HashMap map = new HashMap();

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

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

    public void checkEqualExpressionWithNumericArgumentsLongAgainstLong() {

        //HashMap map = new HashMap();

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

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

    public void checkEqualExpressionWithNumericArgumentsLongAgainstFloat() {

        //HashMap map = new HashMap();

        propertySensor1=new LongConstant(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);

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

            assertTrue(
                ((Boolean) expression12.evaluate()).booleanValue());
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());
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(
                ((Boolean) expression2.evaluate()).booleanValue());
View Full Code Here

    }

    public void checkGreaterExpressionWithNumericArgumentsIntegerAgainstLong() {
        ////HashMap map = new HashMap();
        propertySensor1=new IntegerConstant(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 IntegerConstant(-20));
            v.add(new LongConstant(20));
            Expression expression4 = new Greater(v,true);

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

        }
    }

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

            v.clear();
            v.add(new LongConstant(-20));
            v.add(new LongConstant(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.LongConstant

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.