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

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


  public void testStringConstant() {
    String s1 = "\"Test String\"";
    String s2 = "Test String";
   
    //HashMap map = new HashMap();
    propertySensor1=new StringConstant(s1);
   
   
    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
View Full Code Here


    /*
     * This will test equals for string arguments.
     */
    public void testEqualExpressionWithStringArguments() {
        //HashMap map = new HashMap();
        propertySensor1=new StringConstant("test");
        propertySensor2=new StringConstant("testing");
        propertySensor3=new StringConstant("test");
        //SensorLookup lookup = new SensorLookupImpl(map);
        try {
            // Property1 != Property2   
            Vector v = new Vector();
            v.add(propertySensor1);
            v.add(propertySensor2);
            Expression firstExpression = new Equal(v,true);

            // Property1 == Property3   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression secondExpression = new Equal(v,true);

            // Property1 == StringConstant("test");
            v.clear();
            v.add(propertySensor1);
            v.add(new StringConstant("test"));
            Expression thirdExpression = new Equal(v,true);

            // StringConstant("test") != StringConstant("testing")
            v.clear();
            v.add(new StringConstant("test"));
            v.add(new StringConstant("testing"));
            Expression fourthExpression = new Equal(v,true);

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

    }
   
     public void testToBoolean() {
        propertySensor1=new IntegerConstant(243);
          propertySensor2=new StringConstant("\"false\"");
         
          try {
              Vector v = new Vector();
              v.add(propertySensor1);
              Expression es1 = new ToBoolean(v,true);
View Full Code Here

        returnExpr = new DateTimeConstant(dateStr
            .substring(1, size - 1));
      }
      else
      {
        returnExpr = new StringConstant(val);
      }

      break;

    case TypeConstants.booleanType:
View Full Code Here

    public static TimeZoneExpression getInstance(String tzid,
            SPLSymbolTable sTab) throws SPLException
    {
        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");

        Expression e = new StringConstant(tzid);
        List aList = new ArrayList(1)// DAW
        aList.add(e);
        boolean validateExp = true;
        if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT)
        {
View Full Code Here

      Byte sn2 = new Byte(Byte.MIN_VALUE);
        String s1 = "\""+sn1.toString()+"\"";
        String s2 = "\""+sn2.toString()+"\"";

        //HashMap map = new HashMap();
        propertySensor1=new StringConstant(s1.toString());
        propertySensor2=new StringConstant(s2.toString());
        propertySensor3=new ByteConstant(sn1.byteValue());
        propertySensor4=new ByteConstant(sn2.byteValue());
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(new ByteConstant(sn1.byteValue()));
            Expression esn1 = new ToSINT8(v,true);
View Full Code Here

        Short sn2 = new Short(Short.MIN_VALUE);
        String s1 = "\""+sn1.toString()+"\"";
        String s2 = "\""+sn2.toString()+"\"";

        //HashMap map = new HashMap();
        propertySensor1=new StringConstant(s1.toString());
        propertySensor2=new StringConstant(s2.toString());
        propertySensor3=new ShortConstant(sn1.shortValue());
        propertySensor4=new ShortConstant(sn2.shortValue());
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(new ShortConstant(sn1.shortValue()));
            Expression esn1 = new ToSINT16(v,true);
View Full Code Here

        Integer in2 = new Integer(Integer.MIN_VALUE);
        String s1 = "\""+in1.toString()+"\"";
        String s2 = "\""+in2.toString()+"\"";

        //HashMap map = new HashMap();
        propertySensor1=new StringConstant(s1.toString());
        propertySensor2=new StringConstant(s2.toString());
        propertySensor3=new IntegerConstant(in1.intValue());
        propertySensor4=new IntegerConstant(in2.intValue());
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(new IntegerConstant(in1.intValue()));
            Expression ein1 = new ToSINT32(v,true);
View Full Code Here

        Long ln2 = new Long(Long.MIN_VALUE);
        String s1 = "\""+ln1.toString()+"\"";
        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);
View Full Code Here

        Float fn2 = new Float(Float.MIN_VALUE);
        String s1 = "\""+fn1.toString()+"\"";
        String s2 = "\""+fn2.toString()+"\"";

        //HashMap map = new HashMap();
        propertySensor1=new StringConstant(s1.toString());
        propertySensor2=new StringConstant(s2.toString());
        propertySensor3=new FloatConstant(fn1.floatValue());
        propertySensor4=new FloatConstant(fn2.floatValue());
        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

            v.clear();
            v.add(new FloatConstant(fn1.floatValue()));
            Expression efn1 = new ToREAL32(v,true);
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.