Package edu.cmu.cs.fusion.parsers.predicate

Examples of edu.cmu.cs.fusion.parsers.predicate.FPLParser.expression()


  @Test
  public void testRefEquality() throws ParseException {
    String string = "foo == bar";
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a RefEquality, but is " + pred.getClass().getCanonicalName(), pred instanceof ReferenceEqualityPredicate);
   
    ReferenceEqualityPredicate val = (ReferenceEqualityPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
View Full Code Here


 
  @Test
  public void testRefInequality() throws ParseException {
    String string = "foo != bar";
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a RefEquality, but is " + pred.getClass().getCanonicalName(), pred instanceof ReferenceEqualityPredicate);
   
    ReferenceEqualityPredicate val = (ReferenceEqualityPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
View Full Code Here

public class ParseSimplePredicate {
  @Test
  public void testTrueParses() throws ParseException {
    String string = "TRUE";
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a TruePredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof TruePredicate);   
  }

  @Test
View Full Code Here

  @Test
  public void testFalseParses() throws ParseException {
    String string = "FALSE";
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a FalsePredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof FalsePredicate);
   
  }
View Full Code Here

  @Test
  public void testBoolParses() throws ParseException {
    String string = "foo";
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a BooleanValue, but is " + pred.getClass().getCanonicalName(), pred instanceof BooleanValue);
   
    BooleanValue val = (BooleanValue)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
View Full Code Here

  @Test
  public void testNegBoolParses() throws ParseException {
    String string = "!foo";
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a BooleanValue, but is " + pred.getClass().getCanonicalName(), pred instanceof BooleanValue);
   
    BooleanValue val = (BooleanValue)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
View Full Code Here

 
  @Test(expected=ParseException.class)
  public void badParse() throws ParseException {
    String string = "!";
    FPLParser parser = new FPLParser(string, null, null);
    parser.expression();
  }
}
View Full Code Here

          parser.reset((String)pair.getValue());
          op = parser.operation();
        }
        else if (name.equals("trigger")) {
          parser.reset((String)pair.getValue());
          trigger = parser.expression();
        }
        else if (name.equals("requires")) {
          parser.reset((String)pair.getValue());
          requires = parser.expression();
        }
View Full Code Here

          parser.reset((String)pair.getValue());
          trigger = parser.expression();
        }
        else if (name.equals("requires")) {
          parser.reset((String)pair.getValue());
          requires = parser.expression();
        }
        else if (name.equals("restrictTo")) {
          parser.reset((String)pair.getValue());
          restrict = parser.expression();
        }
View Full Code Here

          parser.reset((String)pair.getValue());
          requires = parser.expression();
        }
        else if (name.equals("restrictTo")) {
          parser.reset((String)pair.getValue());
          restrict = parser.expression();
        }
        else if (name.equals("effects")) {     
          for (Object effect : (Object[])pair.getValue()) {
            parser.reset((String)effect);
            effects.add(parser.effect());
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.