Package tcg.common.util

Examples of tcg.common.util.ExpressionParser.evaluate()


   
    //set-constant-value (string)
    parser = new ExpressionParser("true", Boolean.class);
    try
    {
      boolResult = (Boolean)parser.evaluate();
      Assert.assertNotNull(boolResult);
      Assert.assertEquals(true, boolResult.booleanValue());
    }
    catch(Exception ex)
    {
View Full Code Here


   
    //set-constant-value (string)
    parser = new ExpressionParser("false", Boolean.class);
    try
    {
      boolResult = (Boolean)parser.evaluate();
      Assert.assertNotNull(boolResult);
      Assert.assertEquals(false, boolResult.booleanValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value (positive value)
    parser = new ExpressionParser("15", Integer.class);
    try
    {
      intResult = (Integer)parser.evaluate();
      Assert.assertNotNull(intResult);
      Assert.assertEquals(15, intResult.intValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value (zero)
    parser = new ExpressionParser("0", Integer.class);
    try
    {
      intResult = (Integer)parser.evaluate();
      Assert.assertNotNull(intResult);
      Assert.assertEquals(0, intResult.intValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value (negative value)
    parser = new ExpressionParser("-15", Integer.class);
    try
    {
      intResult = (Integer)parser.evaluate();
      Assert.assertNotNull(intResult);
      Assert.assertEquals(-15, intResult.intValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value (positive value)
    parser = new ExpressionParser("15.0", Double.class);
    try
    {
      dblResult = (Double)parser.evaluate();
      Assert.assertNotNull(dblResult);
      Assert.assertEquals(15.0, dblResult.doubleValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value (zero)
    parser = new ExpressionParser("0.0", Double.class);
    try
    {
      dblResult = (Double)parser.evaluate();
      Assert.assertNotNull(dblResult);
      Assert.assertEquals(0.0, dblResult.doubleValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value (negative value)
    parser = new ExpressionParser("-15.0", Double.class);
    try
    {
      dblResult = (Double)parser.evaluate();
      Assert.assertNotNull(dblResult);
      Assert.assertEquals(-15.0, dblResult.doubleValue());
    }
    catch(Exception ex)
    {
View Full Code Here

   
    //set-constant-value
    parser = new ExpressionParser("\"any-string\"", String.class);
    try
    {
      strResult = (String)parser.evaluate();
      Assert.assertNotNull(strResult);
      Assert.assertTrue(strResult.compareTo("any-string") == 0);
    }
    catch(Exception ex)
    {
View Full Code Here

    parser = new ExpressionParser("var1", String.class);
    parser.createVariable("var1", String.class, "");
    try
    {
      //initial state
      strResult = (String)parser.evaluate();
      Assert.assertNotNull(strResult);
      Assert.assertTrue(strResult.isEmpty());
      //set to value (using variable name)
      parser.set("var1", "some-string");
      strResult = (String)parser.evaluate();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.