Examples of OrPredicate


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

  @Test
  public void testTruthFalse() {
    //Test F or F
    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(4), utils.getVar(2)});
    OrPredicate pred = new OrPredicate(lP, rP);

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

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

  @Test
  public void testTruthUnknown1() {
    //Test U or F
    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(0), utils.getVar(2)});
    OrPredicate pred = new OrPredicate(lP, rP);

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

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

  @Test
  public void testTruthUnknown2() {
    //Test U or U
    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(3), utils.getVar(2)});
    OrPredicate pred = new OrPredicate(lP, rP);

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

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

    switch (operator) {
      case And:
        predicate = new AndPredicate(predicates.toArray(new BasePredicate[predicates.size()]));
        break;
      case Or:
        predicate = new OrPredicate(predicates.toArray(new BasePredicate[predicates.size()]));
        break;
      default:
        throw new IllegalStateException("Unknown operator " + this.operator);
    }
    predicates.clear();
View Full Code Here

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

        left : AndPredicate.instance(left, right));
  }

  private static List<BasePredicate> distributeOr(OrPredicate orPredicate, BasePredicate other) {
    List<BasePredicate> andPredicateList = new LinkedList<BasePredicate>();
    OrPredicate otherOr = null;

    if (other instanceof OrPredicate) {
      otherOr = (OrPredicate) other;
    }
View Full Code Here

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

    switch (operator) {
      case And:
        predicate = new AndPredicate(predicates.toArray(new Predicate[predicates.size()]));
        break;
      case Or:
        predicate = new OrPredicate(predicates.toArray(new Predicate[predicates.size()]));
        break;
      default:
        throw new IllegalStateException("Unknown operator " + this.operator);
    }
    predicates.clear();
View Full Code Here

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

    Predicate andPredicate1 = new AndPredicate(namePredicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);
    Predicate andPredicate2 = new AndPredicate(name2Predicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);
    Predicate orPredicate = new OrPredicate(andPredicate1, andPredicate2);

    //mock expectations
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
        "dep_comp_name", "comp_name")).andReturn(dependencyInfo);
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
View Full Code Here

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

        left : AndPredicate.instance(left, right));
  }

  private static List<BasePredicate> distributeOr(OrPredicate orPredicate, BasePredicate other) {
    List<BasePredicate> andPredicateList = new LinkedList<BasePredicate>();
    OrPredicate otherOr = null;

    if (other instanceof OrPredicate) {
      otherOr = (OrPredicate) other;
    }
View Full Code Here

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

        left : AndPredicate.instance(left, right));
  }

  private static List<BasePredicate> distributeOr(OrPredicate orPredicate, BasePredicate other) {
    List<BasePredicate> andPredicateList = new LinkedList<BasePredicate>();
    OrPredicate otherOr = null;

    if (other instanceof OrPredicate) {
      otherOr = (OrPredicate) other;
    }
View Full Code Here

Examples of org.apache.ambari.server.controller.predicate.OrPredicate

    return listPredicates.size() == 1 ? listPredicates.get(0) :
        buildOrPredicate(listPredicates);
  }

  private OrPredicate buildOrPredicate(List<EqualsPredicate> listPredicates) {
    return new OrPredicate(listPredicates.toArray(new BasePredicate[listPredicates.size()]));
  }
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.