Examples of OrPredicate


Examples of cascading.pattern.model.tree.predicate.compound.OrPredicate

      CompoundPredicate.BooleanOperator operator = compoundPredicate.getBooleanOperator();

      switch( operator )
        {
        case OR:
          return new OrPredicate( predicates );
        case AND:
          return new AndPredicate( predicates );
        case XOR:
          return new XorPredicate( predicates );
        case SURROGATE:
View Full Code Here

Examples of cascading.pattern.model.tree.predicate.compound.OrPredicate

  @Test
  public void testComplex()
    {
    Predicate complexPredicate = new AndPredicate(
      new IsNotMissingPredicate( "var0" ),
      new OrPredicate( new EqualsToPredicate( "var1", "value" ), new IsMissingPredicate( "var2" ) ) );

    assertTrue( new PredicateEvaluator( expectedFields, complexPredicate ).evaluate( tupleEntry ) );
    }
View Full Code Here

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

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a OrPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof OrPredicate);
   
    OrPredicate val = (OrPredicate)pred;
   
    Assert.assertTrue("Left side is a bool value", val.getLeft() instanceof BooleanValue);
    Assert.assertTrue("Right side is a and pred", val.getRight() instanceof AndPredicate);
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());

    vars = val.getLeft().getFreeVariables();
    Assert.assertEquals("Should only contain one free variables", 1, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   

    vars = val.getRight().getFreeVariables();
    Assert.assertEquals("Should only contain two free variables", 2, vars.size());
    Assert.assertEquals("a should have a boolean type", "boolean", vars.getType(new SpecVar("a")));   
    Assert.assertEquals("b should have a boolean type", "boolean", vars.getType(new SpecVar("b")));   

  }
View Full Code Here

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

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a OrPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof OrPredicate);
   
    OrPredicate val = (OrPredicate)pred;
   
    Assert.assertTrue("Left side is a bool value", val.getLeft() instanceof BooleanValue);
    Assert.assertTrue("Right side is a bool value", val.getRight() instanceof BooleanValue);
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain two free variables", 2, vars.size());

    vars = val.getLeft().getFreeVariables();
    Assert.assertEquals("Should only contain one free variables", 1, vars.size());
    Assert.assertEquals("a should have a boolean type", "boolean", vars.getType(new SpecVar("a")));   

    vars = val.getRight().getFreeVariables();
    Assert.assertEquals("Should only contain one free variables", 1, vars.size());
    Assert.assertEquals("b should have a boolean type", "boolean", vars.getType(new SpecVar("b")));   
  }
View Full Code Here

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

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a OrPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof OrPredicate);
   
    OrPredicate val = (OrPredicate)pred;
   
    Assert.assertTrue("Left side is a or pred", val.getLeft() instanceof OrPredicate);
    Assert.assertTrue("Right side is a bool value", val.getRight() instanceof BooleanValue);
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());

    vars = val.getLeft().getFreeVariables();
    Assert.assertEquals("Should only contain two free variables", 2, vars.size());
    Assert.assertEquals("a should have a boolean type", "boolean", vars.getType(new SpecVar("a")));   
    Assert.assertEquals("b should have a boolean type", "boolean", vars.getType(new SpecVar("b")));   

    vars = val.getRight().getFreeVariables();
    Assert.assertEquals("Should only contain one free variables", 1, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
  }
View Full Code Here

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

    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 OrPredicate);
   
    OrPredicate val = (OrPredicate)pred;
   
    Assert.assertTrue("Left side is a implies pred", val.getLeft() instanceof ImpliesPredicate);
    Assert.assertTrue("Right side is a bool value", val.getRight() instanceof BooleanValue);
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());

    vars = val.getLeft().getFreeVariables();
    Assert.assertEquals("Should only contain two free variables", 2, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
    Assert.assertEquals("b should have a boolean type", "boolean", vars.getType(new SpecVar("b")));   

    vars = val.getRight().getFreeVariables();
    Assert.assertEquals("Should only contain 1 free variables", 1, vars.size());
    Assert.assertEquals("a should have a boolean type", "boolean", vars.getType(new SpecVar("a")));   
  }
View Full Code Here

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

    FreeVars fv;
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
   
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    OrPredicate pred = new OrPredicate(lP, rP);
    fv = pred.getFreeVariables();
 
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
    assertEquals(types[1], fv.getType(utils.getVar(2)));
   
View Full Code Here

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

  @Test
  public void testTruthTrue1() {
    //Test T or T
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(4), utils.getVar(3)});
    OrPredicate pred = new OrPredicate(lP, rP);

    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

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

  @Test
  public void testTruthTrue2() {
    //Test U or T
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(2), utils.getVar(3)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(4), utils.getVar(3)});
    OrPredicate pred = new OrPredicate(lP, rP);

    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

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

  @Test
  public void testTruthTrue3() {
    //Test T or F
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(4), utils.getVar(3)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    OrPredicate pred = new OrPredicate(lP, rP);

    FusionEnvironment env = new TestEnvironment(utils.getContext(0), Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
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.