Package edu.cmu.cs.fusion.constraint.predicates

Examples of edu.cmu.cs.fusion.constraint.predicates.RelationshipPredicate


    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)});
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {Constraint.RESULT, utils.getVar(1)}));
   
    cons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    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(2), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {Constraint.RESULT, utils.getVar(1)}));
   
    possCons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    aliases = new TestAliasContext();
View Full Code Here


  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    RelationshipPredicate pred;
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
   
    pred = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    fv = pred.getFreeVariables();
 
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
   
    assertEquals(2, fv.size());
View Full Code Here

    assertEquals(2, fv.size());
  }
 
  @Test
  public void testTruthFalse() {
    RelationshipPredicate pred = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.FALSE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

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

  @Test
  public void testTruthTrue() {
    RelationshipPredicate pred = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

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

  @Test
  public void testTruthUnknownNoInference() {
    RelationshipPredicate pred = new RelationshipPredicate(utils.getRelation(1), new SpecVar[] {utils.getVar(2), utils.getVar(1)});
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.UNKNOWN, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.UNKNOWN, pred.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthNotFalse() {
    RelationshipPredicate pred = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    pred.setPositive(false);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

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

  @Test
  public void testTruthNotTrue() {
    RelationshipPredicate pred = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    pred.setPositive(false);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.FALSE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

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

  @Test
  public void testTruthNotUnknownNoInference() {
    RelationshipPredicate pred = new RelationshipPredicate(utils.getRelation(1), new SpecVar[] {utils.getVar(2), utils.getVar(1)});
    pred.setPositive(false);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.UNKNOWN, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    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)});
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {Constraint.RESULT, utils.getVar(1)}));
   
    cons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    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(2), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {Constraint.RESULT, utils.getVar(1)}));
   
    possCons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    aliases = new TestAliasContext();
View Full Code Here

    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)});
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {Constraint.RESULT, utils.getVar(1)}));
   
    cons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    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(2), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {Constraint.RESULT, utils.getVar(1)}));
   
    possCons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    aliases = new TestAliasContext();
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.predicates.RelationshipPredicate

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.