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

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


  @Test
  public void testImplies2Predicate() throws ParseException {
    String string = "a IMPLIES b IMPLIES c";
   
    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 testImpliesAndPredicate() throws ParseException {
    String string = "c IMPLIES b AND 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

    String string = "Foo(a, b)";
    RelationsEnvironment env = new RelationsEnvironment();
    env.addRelation(new Relation("Foo", new String[] {"Bar", "Baz"}));
   
    FPLParser parser = new FPLParser(string, env, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a RelationshipPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof RelationshipPredicate);
   
    RelationshipPredicate val = (RelationshipPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
View Full Code Here

    String string = "!Foo(a, b)";
    RelationsEnvironment env = new RelationsEnvironment();
    env.addRelation(new Relation("Foo", new String[] {"Bar", "Baz"}));

    FPLParser parser = new FPLParser(string, env, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a RelationshipPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof RelationshipPredicate);
   
    RelationshipPredicate val = (RelationshipPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
View Full Code Here

    String string = "?Foo(a, b) : c";
    RelationsEnvironment env = new RelationsEnvironment();
    env.addRelation(new Relation("Foo", new String[] {"Bar", "Baz"}));
   
    FPLParser parser = new FPLParser(string, env, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a TestPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof TestPredicate);
   
    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
View Full Code Here

    String string = "?Foo(a, b) : !c";
    RelationsEnvironment env = new RelationsEnvironment();
    env.addRelation(new Relation("Foo", new String[] {"Bar", "Baz"}));
   
    FPLParser parser = new FPLParser(string, env, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a TestPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof TestPredicate);
   
    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
View Full Code Here

    String string = "?!Foo(a, b) : c";
    RelationsEnvironment env = new RelationsEnvironment();
    env.addRelation(new Relation("Foo", new String[] {"Bar", "Baz"}));
   
    FPLParser parser = new FPLParser(string, env, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a TestPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof TestPredicate);
   
    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
View Full Code Here

    String string = "?!Foo(a, b) : !c";
    RelationsEnvironment env = new RelationsEnvironment();
    env.addRelation(new Relation("Foo", new String[] {"Bar", "Baz"}));
   
    FPLParser parser = new FPLParser(string, env, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a TestPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof TestPredicate);
   
    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
View Full Code Here

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

 
  @Test
  public void testNegInstanceOfTrue() throws ParseException {
    String string = "bar !instanceof Foo";
    FPLParser parser = new FPLParser(string, null, new StubIType());
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a InstanceOfPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof InstanceOfPredicate);
   
    InstanceOfPredicate val = (InstanceOfPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
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.