Package edu.cmu.cs.fusion.constraint

Examples of edu.cmu.cs.fusion.constraint.Predicate


  @BeforeClass
  static public void setup() {
    utils = new TestUtils();
   
    Operation op;
    Predicate trigger;
    Predicate req;
    List<Effect> effects = new LinkedList<Effect>();
   
    op = new MethodInvocationOp("methodName", "Foo", new SpecVar[] {utils.getVar(0), utils.getVar(1)}, new String[] {"Foo", "Bar"}, "Bar", false);
    trigger = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    req = new RelationshipPredicate(utils.getRelation(1), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
View Full Code Here


  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    Predicate bPred = new BooleanValue(utils.getVar(0));
   
    fv = bPred.getFreeVariables();
    assertEquals(1, fv.size());
    assertEquals(fv.getType(utils.getVar(0)), FreeVars.BOOL_TYPE);
  }
View Full Code Here

    assertEquals(fv.getType(utils.getVar(0)), FreeVars.BOOL_TYPE);
  }
 
  @Test
  public void testTruthFalse() {
    Predicate bv = new BooleanValue(utils.getVar(0));
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.FALSE);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.FALSE, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.FALSE, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthTrue() {
    Predicate bv = new BooleanValue(utils.getVar(0));
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.TRUE);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

  @BeforeClass
  static public void setup() {
    utils = new TestUtils();
   
    Operation op;
    Predicate trigger;
    Predicate req;
    List<Effect> effects = new LinkedList<Effect>();
   
    op = new MethodInvocationOp("methodName", "Foo", new SpecVar[] {utils.getVar(0), utils.getVar(1)}, new String[] {"Foo", "Bar"}, "Bar", false);
    trigger = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    req = new RelationshipPredicate(utils.getRelation(1), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
View Full Code Here

    assertEquals(ThreeValue.TRUE, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthUnknown() {
    Predicate bv = new BooleanValue(utils.getVar(0));
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.UNKNOWN);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.UNKNOWN, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    utils = new TestUtils();
  }
 
  @Test
  public void testFreeVars() {
    Predicate tPred = new TruePredicate();
    Predicate fPred = new FalsePredicate();
   
    assertTrue(tPred.getFreeVariables().isEmpty());
    assertTrue(fPred.getFreeVariables().isEmpty());
  }
View Full Code Here

    assertTrue(fPred.getFreeVariables().isEmpty());
  }
 
  @Test
  public void testTruthFalse() {
    Predicate fPred = new FalsePredicate();
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(fPred.getTruth(env, utils.getSub(0)), ThreeValue.FALSE);
  }
View Full Code Here

    assertEquals(fPred.getTruth(env, utils.getSub(0)), ThreeValue.FALSE);
  }

  @Test
  public void testTruthTrue() {
    Predicate tPred = new TruePredicate();
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(tPred.getTruth(env, utils.getSub(0)), ThreeValue.TRUE);
  }
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);   
  }
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.Predicate

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.