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

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


    String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse\"";
    String s2 = "\"This\"";
    int n = 3;

    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    propertySensor2=new StringConstant(s2);
    propertySensor3=new IntegerConstant(1);
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Vector v = new Vector();
      v.add(new StringConstant(s1));
      v.add(new StringConstant(s2));
      v.add(new IntegerConstant(n));
      Expression e1 = new Word(v,true);

      v.clear();
      v.add(propertySensor1);
View Full Code Here


  public void testContains() {
    String s1 = "\"ThisIsADogThisIsAPenThisIsATelevisionSetThisIsAHouse\"";
    String s2 = "\"ThisIsAPen\"";

    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    propertySensor2=new StringConstant(s2);
    //SensorLookup lookup = new SensorLookupImpl(map);

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

      v.clear();
      v.add(propertySensor1);
      v.add(propertySensor2);
View Full Code Here

        String s1 = "\"HELLO\"";
          String s2 = "\"HellO\"";
          String s3 = "hello";

          //HashMap map = new HashMap();
          propertySensor1=new StringConstant(s1.toString());
          propertySensor2=new StringConstant(s2.toString());
         
          try {
              Vector v = new Vector();
              v.add(propertySensor1);
              Expression es1 = new ToLower(v,true);
View Full Code Here

        String s1 = "\"hello\"";
          String s2 = "\"HellO\"";
          String s3 = "HELLO";

          //HashMap map = new HashMap();
          propertySensor1=new StringConstant(s1.toString());
          propertySensor2=new StringConstant(s2.toString());
         
          try {
              Vector v = new Vector();
              v.add(propertySensor1);
              Expression es1 = new ToUpper(v,true);
View Full Code Here

      propertySensor5 = new ByteConstant((byte)5);
      propertySensor6 = new ByteConstant((byte)6);
      propertySensor7 = new ByteConstant((byte)7);
      propertySensor8 = new ByteConstant((byte)8);
     
      StringConstant stringLOR = new StringConstant("\"OR\"");
      StringConstant stringLAND = new StringConstant("\"AND\"");
      StringConstant stringBXOR = new StringConstant("\"XOR\"");
      StringConstant stringNOT_EQUAL = new StringConstant("\"NOT_EQUAL\"");
      StringConstant stringEQUAL = new StringConstant("\"EQUAL\"");
      StringConstant stringLT = new StringConstant("\"LESS\"");
      StringConstant stringGT = new StringConstant("\"GREATER\"");
      StringConstant stringLE = new StringConstant("\"LESS_OR_EQUAL\"");
      StringConstant stringGE = new StringConstant("\"GREATER_OR_EQUAL\"");
     
     
   
   
     
View Full Code Here

    String s3 = "\"18007778888\"";
    String s4 = "\"\"";
    String s5 = "\"@#$%^&*(){}|\"";

    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    propertySensor2=new StringConstant(s2);
    propertySensor3=new StringConstant(s3);
    propertySensor4=new StringConstant(s4);
    propertySensor5=new StringConstant(s5);
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Expression exp;
     
      Vector v = new Vector();
      v.add(new StringConstant(s1));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor1);
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));
     
      v.clear();
      v.add(new StringConstant(s2));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor2);
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(new StringConstant(s3));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor3);
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));
     
      v.clear();
      v.add(new StringConstant(s4));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor4);
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(new StringConstant(s5));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor5);
View Full Code Here

    String s2 = "\"30 Sawmill River Rd, Hawthorne, NY 10532\"";
    String s3 = "\"1 800 777 8888\"";
    String s4 = "\"\"";
    String s5 = "\"@#$%^&*(){}|\"";
    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    propertySensor2=new StringConstant(s2);
    propertySensor3=new StringConstant(s3);
    propertySensor4=new StringConstant(s4);
    propertySensor5=new StringConstant(s5);
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Expression exp;
     
      Vector v = new Vector();
      v.add(new StringConstant(s1));
      exp = new ContainsOnlyLetters(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor1);
      exp = new ContainsOnlyLetters(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(new StringConstant(s2));
      exp = new ContainsOnlyLetters(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor2);
      exp = new ContainsOnlyLetters(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(new StringConstant(s3));
      exp = new ContainsOnlyLetters(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor3);
      exp = new ContainsOnlyLetters(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));
     
      v.clear();
      v.add(new StringConstant(s4));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor4);
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(new StringConstant(s5));
      exp = new ContainsOnlyDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor5);
View Full Code Here

    String s2 = "\"30 Sawmill River Rd, Hawthorne, NY 10532\"";
    String s3 = "\"TollFree18007778888\"";
    String s4 = "\"\"";
    String s5 = "\"@#$%^&*(){}|\"";
    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    propertySensor2=new StringConstant(s2);
    propertySensor3=new StringConstant(s3);
    propertySensor4=new StringConstant(s4);
    propertySensor5=new StringConstant(s5);
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Expression exp;

      Vector v = new Vector();
      v.add(new StringConstant(s1));
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor1);
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(new StringConstant(s2));
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor2);
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(new StringConstant(s3));
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor3);
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));
     
      v.clear();
      v.add(new StringConstant(s4));
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(propertySensor4);
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(new StringConstant(s5));
      exp = new ContainsOnlyLettersOrDigits(v,true);
      assertTrue(exp.evaluate().equals(Boolean.FALSE));

      v.clear();
      v.add(propertySensor5);
View Full Code Here

   */ 
  public void testMatchesRegExp() {
    String s1 = "\"aaaaab\"";
    String s2 = "\"a*b\"";
    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    propertySensor2=new StringConstant(s2);
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Expression exp;
      Vector v = new Vector();
      v.add(new StringConstant(s1));
      v.add(new StringConstant(s2));
      exp = new MatchesRegExp(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));

      v.clear();
      v.add(new StringConstant(s1));
      v.add(new StringConstant(s2));
      exp = new MatchesRegExp(v,true);
      assertTrue(exp.evaluate().equals(Boolean.TRUE));
    } catch (SPLException e) {
      fail("Received evaluation exception " + e.getMessage());
    } catch (Exception e) {
View Full Code Here

   * This will test Substring Expression
   */
  public void testSubstring() {
    String s1 = "\"containsDigitsAndLetters12345\"";
    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Expression exp;

      Vector v = new Vector();
      v.add(new StringConstant(s1));
      v.add(new IntegerConstant(8));
      exp = new Substring(v,true);
      assertTrue(exp.evaluate().equals("DigitsAndLetters12345"));

      v.clear();
      v.add(propertySensor1);
      v.add(new IntegerConstant(8));
      exp = new Substring(v,true);
      assertTrue(exp.evaluate().equals("DigitsAndLetters12345"));

      v.clear();
      v.add(new StringConstant(s1));
      v.add(new IntegerConstant(8));
      v.add(new IntegerConstant(24));
      exp = new Substring(v,true);
      assertTrue(exp.evaluate().equals("DigitsAndLetters"));

View Full Code Here

TOP

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

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.