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

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


        }
    }

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

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

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

            v.clear();
            v.add(propertySensor1);
            v.add(new FloatConstant(5));
            Expression expression3 = new Less(v,true);

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

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


        }
    }

    public void checkLessExpressionWithNumericArgumentsLongAgainstDouble() {
        //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(propertySensor2);
            v.add(propertySensor1);
            Expression expression1 = new Less(v,true);

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

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

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

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

    }

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

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

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

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

    }

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

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

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

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

        }
    }

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

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

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

        }
    }

    public void checkLessOrEqualExpressionWithNumericArgumentsLongAgainstDouble() {
        //HashMap map = new HashMap();
        propertySensor1=new LongConstant(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 LongConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression6 = new LessOrEqual(v,true);

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

    case TypeConstants.longType:
      if (val.endsWith("L") || val.endsWith("l"))
      {
        val = val.substring(0, val.length() - 2);
      }
      returnExpr = new LongConstant(Long.valueOf(val).longValue());
      break;

    case TypeConstants.stringType:
      String dateStr = (String) val;
      if (DateTime.isDateTimeString(dateStr))
View Full Code Here

        String s2 = "\""+ln2.toString()+"\"";

        //HashMap map = new HashMap();
        propertySensor1=new StringConstant(s1.toString());
        propertySensor2=new StringConstant(s2.toString());
        propertySensor3=new LongConstant(ln1.longValue());
        propertySensor4=new LongConstant(ln2.longValue());
        //SensorLookup lookup = new SensorLookupImpl(map);

        try {
            Vector v = new Vector();
            v.add(new StringConstant(s1));
            Expression es1 = new ToSINT64(v,true);

            v.clear();
            v.add(new StringConstant(s2));
            Expression es2 = new ToSINT64(v,true);

            v.clear();
            v.add(new LongConstant(ln1.longValue()));
            Expression eln1 = new ToSINT64(v,true);

            v.clear();
            v.add(new LongConstant(ln2.longValue()));
            Expression eln2 = new ToSINT64(v,true);

            v.clear();
            v.add(propertySensor1);
            Expression eps1 = new ToSINT64(v,true);
View Full Code Here

        //HashMap map = new HashMap();
    propertySensor1=new ShortConstant(sn1);
    propertySensor2=new ShortConstant(sn2);
    propertySensor3=new IntegerConstant(in1);
    propertySensor4=new IntegerConstant(in2);
    propertySensor5=new LongConstant(ln1);
    propertySensor6=new LongConstant(ln2);
    propertySensor7=new FloatConstant(fn1);
    propertySensor8=new FloatConstant(fn2);
    propertySensor9=new DoubleConstant(dn1);
    propertySensor10=new DoubleConstant(dn2);


        //SensorLookup lookup = new SensorLookupImpl(map);

        try {
            Vector v = new Vector();
            v.add(new ShortConstant(sn1));
            v.add(new ShortConstant(sn2));
           
            Expression es = new Addition(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new IntegerConstant(in2));
           
            Expression ei = new Addition(v,true);

            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new LongConstant(ln2));
          
            Expression el = new Addition(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new FloatConstant(fn2));
           
            Expression ef = new Addition(v,true);

            v.clear();
            v.add(new DoubleConstant(dn1));
            v.add(new DoubleConstant(dn2));
          
            Expression ed = new Addition(v,true);

            v.clear();
            v.add(new ShortConstant(sn1));
            v.add(new IntegerConstant(in1));
           
            Expression emix1 = new Addition(v,true);
           
            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new FloatConstant(fn1));
            Expression emix2 = new Addition(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new DoubleConstant(dn1));
            Expression emix3 = new Addition(v,true);


            v.clear();
          
            v.add(propertySensor2);
            v.add(new ShortConstant(sn3));
            Expression eps1 = new Addition(v,true);

            v.clear();
            v.add(propertySensor4);
            v.add(new IntegerConstant(in3));
            Expression eps2 = new Addition(v,true);

            v.clear();
           
            v.add(propertySensor6);
            v.add(new LongConstant(ln3));
            Expression eps3 = new Addition(v,true);

            v.clear();
           
            v.add(propertySensor8);
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.