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

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


    try {
      Vector v = new Vector();
      v.add(new StringConstant(string));
      v.add(ic4);
      v.add(lr);
      Expression esnl = new LeftSubstring(v,true);
      // Examples: LeftSubstring("AutonomicComputing", 4, LeftToRight) = "Auto".

      v.clear();
      v.add(new StringConstant(string));
      v.add(icmin1);
      v.add(lr);
      Expression esnlmin1 = new LeftSubstring(v,true);
      // Examples: LeftSubstring("AutonomicComputing", -1, LeftToRight) = "AutonomicComputing".

      v.clear();
      v.add(new StringConstant(string));
      v.add(ic4);
      v.add(rl);
      Expression esnr = new LeftSubstring(v,true);
      // LeftSubstring("AutonomicComputing", 4, RightToLeft) = "AutonomicCompu".

      v.clear();
      v.add(new StringConstant(string));
      v.add(icmin1);
      v.add(rl);
      Expression esnrmin1 = new LeftSubstring(v,true);
      // Examples: LeftSubstring("AutonomicComputing", -1, RightToLeft) = "".

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"om\""));
      v.add(lr);
      Expression essl = new LeftSubstring(v,true);
      // Examples: LeftSubstring("AutonomicComputing", "om", LeftToRight)="Auton"

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"\""));
      v.add(lr);
      Expression esslempty = new LeftSubstring(v,true);
      // Examples: LeftSubstring("AutonomicComputing", "", LeftToRight)=""

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"om\""));
      v.add(rl);
      Expression essr = new LeftSubstring(v,true);
      // LeftSubstring("AutonomicComputing", "om", RightToLeft)="AutonomicC"

      v.clear();
      v.add(new StringConstant(string));
      v.add(new StringConstant("\"\""));
      v.add(lr);
      Expression essrempty = new LeftSubstring(v,true);
      // Examples: LeftSubstring("AutonomicComputing", "", RightToLeft)=""

      assertTrue(((String) esnl.evaluate()).equals("Auto"));
      assertTrue(
          ((String) esnlmin1.evaluate()).equals(
          "AutonomicComputing"));
      assertTrue(
          ((String) esnr.evaluate()).equals("AutonomicCompu"));
      assertTrue(((String) esnrmin1.evaluate()).equals(""));
      assertTrue(((String) essl.evaluate()).equals("Auton"));
      assertTrue(((String) esslempty.evaluate()).equals(""));
      assertTrue(((String) essr.evaluate()).equals("AutonomicC"));
      assertTrue(((String) essrempty.evaluate()).equals(""));
    } 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.LeftSubstring

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.