Package edu.cmu.cs.fusion.constraint

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


    utils = new TestUtils();
  }

  @Test
  public void testFreeVarsNormal() {
    Effect eff = RelEffect.createAddEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
    FreeVars fv = eff.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 testFreeVarsTest() {
    Effect eff = RelEffect.createNegatedTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
    FreeVars fv = eff.getFreeVariables();
   
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
    assertEquals(FreeVars.BOOL_TYPE, fv.getType(utils.getVar(2)));
View Full Code Here

    assertEquals(3, fv.size());
  }
 
  @Test
  public void testMakeEffectsAdd() {
    Effect eff = RelEffect.createAddEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    TestEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.TRU, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }
 
  @Test
  public void testMakeEffectsRemove() {
    Effect eff = RelEffect.createRemoveEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    TestEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.FAL, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }
 
  @Test
  public void testMakeEffectsTestTrue() {
    Effect eff = RelEffect.createTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    Map<ObjectLabel, ThreeValue> map = new HashMap<ObjectLabel, ThreeValue>();
    TestEnvironment env = new TestEnvironment(utils.getContext(0), map, Variant.SOUND_VARIANT);
   
    map.put(utils.getSub(0).getSub(utils.getVar(2)), ThreeValue.TRUE);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.TRU, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }
 
  @Test
  public void testMakeEffectsTestFalse() {
    Effect eff = RelEffect.createTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    Map<ObjectLabel, ThreeValue> map = new HashMap<ObjectLabel, ThreeValue>();
    TestEnvironment env = new TestEnvironment(utils.getContext(0), map, Variant.SOUND_VARIANT);
   
    map.put(utils.getSub(0).getSub(utils.getVar(2)), ThreeValue.FALSE);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.FAL, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }
 
  @Test
  public void testMakeEffectsTestUnk() {
    Effect eff = RelEffect.createTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    Map<ObjectLabel, ThreeValue> map = new HashMap<ObjectLabel, ThreeValue>();
    TestEnvironment env = new TestEnvironment(utils.getContext(0), map, Variant.SOUND_VARIANT);
   
    map.put(utils.getSub(0).getSub(utils.getVar(2)), ThreeValue.UNKNOWN);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.UNK, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }

  @Test
  public void testMakeEffectsTestNegFalse() {
    Effect eff = RelEffect.createNegatedTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    Map<ObjectLabel, ThreeValue> map = new HashMap<ObjectLabel, ThreeValue>();
    TestEnvironment env = new TestEnvironment(utils.getContext(0), map, Variant.SOUND_VARIANT);
   
    map.put(utils.getSub(0).getSub(utils.getVar(2)), ThreeValue.TRUE);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.FAL, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }

  @Test
  public void testMakeEffectsTestNegTrue() {
    Effect eff = RelEffect.createNegatedTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    Map<ObjectLabel, ThreeValue> map = new HashMap<ObjectLabel, ThreeValue>();
    TestEnvironment env = new TestEnvironment(utils.getContext(0), map, Variant.SOUND_VARIANT);
   
    map.put(utils.getSub(0).getSub(utils.getVar(2)), ThreeValue.FALSE);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.TRU, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

    assertEquals(1, delta.numberOfChanges());
  }

  @Test
  public void testMakeEffectsTestNegUnk() {
    Effect eff = RelEffect.createNegatedTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    Map<ObjectLabel, ThreeValue> map = new HashMap<ObjectLabel, ThreeValue>();
    TestEnvironment env = new TestEnvironment(utils.getContext(0), map, Variant.SOUND_VARIANT);
   
    map.put(utils.getSub(0).getSub(utils.getVar(2)), ThreeValue.UNKNOWN);
   
    RelationshipDelta delta = eff.makeEffects(env, utils.getSub(0));
    ObjectLabel[] labels = new ObjectLabel[] {utils.getSub(0).getSub(utils.getVar(0)), utils.getSub(0).getSub(utils.getVar(1))};
    SevenPointLattice val = delta.getValue(new Relationship(utils.getRelation(0), labels));
    assertEquals(SevenPointLattice.UNK, val);
   
    assertEquals(1, delta.numberOfChanges());
View Full Code Here

TOP

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

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.