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

Examples of edu.cmu.cs.fusion.parsers.predicate.FPLParser


public class ParseBinaryPredicate {
  @Test
  public void testAndPredicate() throws ParseException {
    String string = "a AND b";
   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a AndPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof AndPredicate);
   
    AndPredicate val = (AndPredicate)pred;
   
View Full Code Here


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

 
  @Test
  public void testAnd3ParenPredicate() throws ParseException {
    String string = "a AND (b AND (c AND d))";
   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a AndPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof AndPredicate);   
    AndPredicate val = (AndPredicate)pred;
   
    Assert.assertTrue("Left side is a bool value", val.getLeft() instanceof BooleanValue);
View Full Code Here

 
  @Test
  public void testOrAndPredicate() throws ParseException {
    String string = "c OR b AND a";
   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a OrPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof OrPredicate);
   
    OrPredicate val = (OrPredicate)pred;
   
View Full Code Here

  @Test
  public void testOrAndParenPredicate() throws ParseException {
    String string = "(c OR b) AND a";
   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a AndPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof AndPredicate);
   
    AndPredicate val = (AndPredicate)pred;
   
View Full Code Here

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

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

  @Test
  public void testImpliesOrPredicate() throws ParseException {
    String string = "c IMPLIES b OR a";
   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a ImpliesPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof ImpliesPredicate);
   
    ImpliesPredicate val = (ImpliesPredicate)pred;
   
View Full Code Here

 
  @Test
  public void testImpliesOrParenPredicate() throws ParseException {
    String string = "(c IMPLIES b) OR a";
   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a ImpliesPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof OrPredicate);
   
    OrPredicate val = (OrPredicate)pred;
   
View Full Code Here

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

TOP

Related Classes of edu.cmu.cs.fusion.parsers.predicate.FPLParser

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.