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

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


    //SensorLookup lookup = new SensorLookupImpl(map);

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

      v.clear();
      v.add(new StringConstant(s2));
      Expression e2 = new StringLength(v,true);

      v.clear();
      v.add(new StringConstant(s3));
      Expression e3 = new StringLength(v,true);

      v.clear();
      v.add(propertySensor1);
      Expression eps1 = new StringLength(v,true);

      v.clear();
      v.add(propertySensor2);
      Expression eps2 = new StringLength(v,true);

      v.clear();
      v.add(propertySensor3);
      Expression eps3 = new StringLength(v,true);
      s1 = s1.substring(1, s1.length()-1);
      s2 = s2.substring(1, s2.length()-1);
      s3 = s3.substring(1, s3.length()-1);

      assertTrue(
          new Integer(s1.length()).compareTo((Integer)e1.evaluate()) == 0);
      assertTrue(
          new Integer(s2.length()).compareTo((Integer)e2.evaluate()) == 0);
      assertTrue(
          new Integer(s3.length()).compareTo((Integer)e3.evaluate()) == 0);
      assertTrue(
          new Integer(s1.length()).compareTo((Integer)eps1.evaluate()) == 0);
      assertTrue(
          new Integer(s2.length()).compareTo((Integer)eps2.evaluate()) == 0);
      assertTrue(
          new Integer(s3.length()).compareTo((Integer)eps3.evaluate()) == 0);
    } catch (SPLException e) {
      fail("Received evaluation exception " + e.getMessage());
    } catch (Exception e) {
      fail("Received expression exception " + e.getMessage());
    }
View Full Code Here

TOP

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

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.