Package edu.cmu.cs.fusion.constraint

Examples of edu.cmu.cs.fusion.constraint.FreeVars.addVar()


  public void testFindLabelsOneOption() {
    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, null, null, testH, new InferenceEnvironment(null), Variant.PRAGMATIC_VARIANT);
    FreeVars fv = new FreeVars().addVar(new SpecVar("a"), "Foo").addVar(new SpecVar("b"), "Bar");
    Substitution existing = new Substitution().addSub(new SpecVar("a"), labels[0]).addSub(new SpecVar("b"), labels[1]);
   
    fv = fv.addVar(new SpecVar("c"), "Narf");
   
    List<Substitution> subs = env.allValidSubs(existing, fv);
   
    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
View Full Code Here


  public void testFindLabelsAliasesAllDefinite() {
    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, null, null, testH, new InferenceEnvironment(null), Variant.PRAGMATIC_VARIANT);
    FreeVars fv = new FreeVars().addVar(new SpecVar("a"), "Foo").addVar(new SpecVar("b"), "Bar");
    Substitution existing = new Substitution().addSub(new SpecVar("a"), labels[0]).addSub(new SpecVar("b"), labels[1]);
   
    fv = fv.addVar(new SpecVar("c"), "Foo");
   
    List<Substitution> subs = env.allValidSubs(existing, fv);
   
    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
View Full Code Here

  public void testFindLabelsPossibleFromSuperTypes() {
    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, null, null, testH, new InferenceEnvironment(null), Variant.PRAGMATIC_VARIANT);
    FreeVars fv = new FreeVars().addVar(new SpecVar("a"), "Foo").addVar(new SpecVar("b"), "Bar");
    Substitution existing = new Substitution().addSub(new SpecVar("a"), labels[0]).addSub(new SpecVar("b"), labels[1]);
   
    fv = fv.addVar(new SpecVar("c"), "Baz");
   
    List<Substitution> subs = env.allValidSubs(existing, fv);
   
    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
View Full Code Here

  }
 
  @Test
  public void testAdd() throws FusionException {
    FreeVars vars = new FreeVars();
    vars = vars.addVar(new SpecVar("foo"), "Foo");
    assertEquals(1, vars.size());
    assertEquals("Foo", vars.getType(new SpecVar("foo")));
  }
 
  @Test
View Full Code Here

  }
 
  @Test
  public void testUnionNormal() throws FusionException {
    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "Foo");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
    assertEquals(2, vars2.size());
View Full Code Here

  public void testUnionNormal() throws FusionException {
    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "Foo");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
    assertEquals(2, vars2.size());
    assertEquals("Foo", vars2.getType(new SpecVar("foo")));
    assertEquals("Bar", vars2.getType(new SpecVar("bar")));
  }
View Full Code Here

  }

  @Test
  public void testUnionSubtype() throws FusionException {
    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "Foo");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("foo"), "SnaFu");
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
View Full Code Here

  public void testUnionSubtype() throws FusionException {
    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "Foo");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("foo"), "SnaFu");
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
    assertEquals(2, vars2.size());
    assertEquals("Foo", vars2.getType(new SpecVar("foo")));
    assertEquals("Bar", vars2.getType(new SpecVar("bar")));
View Full Code Here

    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "Foo");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("foo"), "SnaFu");
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
    assertEquals(2, vars2.size());
    assertEquals("Foo", vars2.getType(new SpecVar("foo")));
    assertEquals("Bar", vars2.getType(new SpecVar("bar")));
  }
View Full Code Here

  }

  @Test
  public void testUnionSupertype() throws FusionException {
    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "SnaFu");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("foo"), "Foo");
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
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.