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

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


    public void testEqualExpressionWithBooleanArguments() {
        /* When one is true and one is false.  They should not be
         * equal.
         */
        ////HashMap map = new HashMap();
        propertySensor1=new BooleanConstant(true);
        propertySensor2=new BooleanConstant(false);
        propertySensor3=new BooleanConstant(true);
        //propertySensor2=new BooleanConstant(false));
        //propertySensor3=new BooleanConstant(true));
       // //SensorLookup lookup = new SensorLookupImpl(map);
        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(
View Full Code Here


    public void testOrExpressionWithBooleanArguments() throws SPLException {
        /* When one is true and one is false.  They should not be
         * equal.
         */
        //HashMap map = new HashMap();
        propertySensor1=new BooleanConstant(true);
        propertySensor2=new BooleanConstant(true);
        propertySensor3=new BooleanConstant(true);
        propertySensor4=new BooleanConstant(true);
        propertySensor5=new BooleanConstant(true);
        propertySensor6=new BooleanConstant(false);
        propertySensor7=new BooleanConstant(false);
        propertySensor8=new BooleanConstant(false);
        propertySensor9=new BooleanConstant(false);
        propertySensor10=new BooleanConstant(false);

        //SensorLookup lookup = new SensorLookupImpl(map);

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

            //false
            v.clear();
            v.add(propertySensor6);
            v.add(propertySensor7);
           
            Expression expression2 = new LogicalOr(v,true);

            //true
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor6);
          
            Expression expression3 = new LogicalOr(v,true);

            //true
            v.clear();
            v.add(propertySensor1);
            v.add(new BooleanConstant(false));
          
            Expression expression4 = new LogicalOr(v,true);

            //false
            v.clear();
            v.add(new BooleanConstant(false));
            v.add(new BooleanConstant(false));
            Expression expression5 = new LogicalOr(v,true);

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

    public void testAndExpressionWithBooleanArguments() {
        /* When one is true and one is false.  They should not be
         * equal.
         */
        //HashMap map = new HashMap();
        propertySensor1=new BooleanConstant(true);
        propertySensor2=new BooleanConstant(true);
        propertySensor3=new BooleanConstant(true);
        propertySensor4=new BooleanConstant(true);
        propertySensor5=new BooleanConstant(true);
        propertySensor6=new BooleanConstant(false);
        propertySensor7=new BooleanConstant(false);
        propertySensor8=new BooleanConstant(false);
        propertySensor9=new BooleanConstant(false);
        propertySensor10=new BooleanConstant(false);

        //SensorLookup lookup = new SensorLookupImpl(map);
        try {
            //true
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
           
            Expression expression1 = new LogicalAnd(v,true);

            //false
            v.clear();
            v.add(propertySensor6);
            v.add(propertySensor7);
           
            Expression expression2 = new LogicalAnd(v,true);

            //false
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor6);
           
            Expression expression3 = new LogicalAnd(v,true);

            //false
            v.clear();
            v.add(propertySensor1);
            v.add(new BooleanConstant(false));
          
            Expression expression4 = new LogicalAnd(v,true);

            //false
            v.clear();
            v.add(new BooleanConstant(true));
            v.add(new BooleanConstant(false));
            Expression expression5 = new LogicalAnd(v,true);

            //true
            v.clear();
            v.add(new BooleanConstant(true));
            v.add(new BooleanConstant(true));
            Expression expression6 = new LogicalAnd(v,true);

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

    public void testNotExpressionWithBooleanArguments() {
        /* When one is true and one is false.  They should not be
         * equal.
         */
        //HashMap map = new HashMap();
        propertySensor1=new BooleanConstant(true);
        propertySensor2=new BooleanConstant(false);
       

        //SensorLookup lookup = new SensorLookupImpl(map);
        try {
            //true
View Full Code Here

    public void testXorExpressionWithBooleanArguments() {
        /* When one is true and one is false.  They should not be
         * equal.
         */
        //HashMap map = new HashMap();
        propertySensor1=new BooleanConstant(true);
        propertySensor2=new BooleanConstant(false);
       

        //SensorLookup lookup = new SensorLookupImpl(map);
        try {
            //true
View Full Code Here

        Calendar c2 = Calendar.getInstance();
        c2.setTime(Calendar.getInstance().getTime());
        c2.set(1990, 10, 12);
        
           try {
             propertySensor1=new BooleanConstant(true);
             propertySensor2=new BooleanConstant(false);
             propertySensor3=new BooleanConstant(true);
             propertySensor4=new DateTimeConstant(c1);
             propertySensor5=new DateTimeConstant(c2);
              // Property1 == Property2 (true == false) = false   
              List v = new ArrayList();
              v.add(propertySensor1);
View Full Code Here

          }
      }
    
     public void testToString() {
        propertySensor1=new IntegerConstant(845);
          propertySensor2=new BooleanConstant(true);
         
          try {
              Vector v = new Vector();
              v.add(propertySensor1);
              Expression es1 = new ToString(v,true);
View Full Code Here

            assertTrue(((Boolean)es3.evaluate()).booleanValue());
            assertTrue(((Boolean)es4.evaluate()).booleanValue());
           
           
           
            propertySensor1 = new BooleanConstant(true);
          propertySensor2 = new BooleanConstant(true);
          propertySensor3 = new BooleanConstant(true);
          propertySensor4 = new BooleanConstant(true);
         
         
          vbytes.clear();
         
          vbytes.add(propertySensor1);
            vbytes.add(propertySensor2);
            vbytes.add(propertySensor3);
            vbytes.add(propertySensor4);
           
           
            collection = new BasicCollectionExpression(vbytes,null);
           
            v.add(new BooleanConstant(false));
            v.add(stringLOR);
            v.add(collection);
            Expression es5 = new AllInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(true));
            v.add(stringLAND);
            v.add(collection);
            Expression es6 = new AllInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(false));
            v.add(stringBXOR);
            v.add(collection);
            Expression es7 = new AllInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(false));
            v.add(stringNOT_EQUAL);
            v.add(collection);
            Expression es8 = new AllInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(true));
            v.add(stringEQUAL);
            v.add(collection);
            Expression es9 = new AllInCollection(v,true);
            v.clear();
           
View Full Code Here

            assertTrue(((Boolean)es3.evaluate()).booleanValue());
            assertTrue(((Boolean)es4.evaluate()).booleanValue());
           
           
           
            propertySensor1 = new BooleanConstant(true);
          propertySensor2 = new BooleanConstant(true);
          propertySensor3 = new BooleanConstant(true);
          propertySensor4 = new BooleanConstant(true);
         
         
          vbytes.clear();
         
          vbytes.add(propertySensor1);
            vbytes.add(propertySensor2);
            vbytes.add(propertySensor3);
            vbytes.add(propertySensor4);
           
           
            collection = new BasicCollectionExpression(vbytes,null);
           
            v.add(new BooleanConstant(false));
            v.add(stringLOR);
            v.add(collection);
            Expression es5 = new AnyInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(true));
            v.add(stringLAND);
            v.add(collection);
            Expression es6 = new AnyInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(false));
            v.add(stringBXOR);
            v.add(collection);
            Expression es7 = new AnyInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(false));
            v.add(stringNOT_EQUAL);
            v.add(collection);
            Expression es8 = new AnyInCollection(v,true);
            v.clear();
           
            v.add(new BooleanConstant(true));
            v.add(stringEQUAL);
            v.add(collection);
            Expression es9 = new AnyInCollection(v,true);
            v.clear();
           
View Full Code Here

 
  public void testBooleanConstant() {
    Boolean s1 = new Boolean(true);
   
    //HashMap map = new HashMap();
    propertySensor1=new BooleanConstant(s1.booleanValue());
   
   
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
View Full Code Here

TOP

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

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.