Examples of AndPredicate


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

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

Examples of com.hazelcast.query.Predicates.AndPredicate

        String name = randomString();
        map.put("key", new Value(name));

        final ShouldExecuteOncePredicate indexAwareNotIndexedPredicate = new ShouldExecuteOncePredicate();
        final EqualPredicate equalPredicate = new EqualPredicate("name", name);
        final AndPredicate andPredicate = new AndPredicate(indexAwareNotIndexedPredicate, equalPredicate);
        map.values(andPredicate);
    }
View Full Code Here

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

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a AndPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof AndPredicate);
   
    AndPredicate val = (AndPredicate)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.AndPredicate

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a AndPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof AndPredicate);
   
    AndPredicate val = (AndPredicate)pred;
   
    Assert.assertTrue("Left side is a and pred", val.getLeft() instanceof AndPredicate);
    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.AndPredicate

   
    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a AndPredicate, but is " + pred.getClass().getCanonicalName(), pred instanceof AndPredicate);   
    AndPredicate val = (AndPredicate)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 4 free variables", 4, 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 3 free variables", 3, vars.size());
   
    val = (AndPredicate)val.getRight();
    Assert.assertTrue("Left side is a bool value", val.getLeft() instanceof BooleanValue);
    Assert.assertTrue("Right side is a and pred", val.getRight() instanceof AndPredicate);
   
    vars = val.getLeft().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")));   

    vars = val.getRight().getFreeVariables();
    Assert.assertEquals("Should only contain 2 free variables", 2, vars.size());

    val = (AndPredicate)val.getRight();
    Assert.assertTrue("Left side is a bool value", val.getLeft() instanceof BooleanValue);
    Assert.assertTrue("Right side is a bool value", val.getRight() instanceof BooleanValue);

    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 one free variables", 1, vars.size());
    Assert.assertEquals("d should have a boolean type", "boolean", vars.getType(new SpecVar("d")));   

  }
View Full Code Here

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

    }

    if (setPredicates.size() == 1) {
      return setPredicates.iterator().next();
    } else if (setPredicates.size() > 1) {
      return new AndPredicate(setPredicates.toArray(new Predicate[setPredicates.size()]));
    } else {
      return null;
    }
  }
View Full Code Here

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

    if (internalPredicate == null) {
        return predicate;
    }
    return (predicate == null ? internalPredicate :
          new AndPredicate(predicate, internalPredicate));
  }
View Full Code Here

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

    Map<String, String> requestInfo = new HashMap<String, String>();
    requestInfo.put("context", "Install and start all services");
    Request installRequest = new RequestImpl(null, Collections.singleton(installProperties), requestInfo, null);
    Predicate statePredicate = new EqualsPredicate<String>(SERVICE_SERVICE_STATE_PROPERTY_ID, "INIT");
    Predicate clusterPredicate = new EqualsPredicate<String>(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
    Predicate installPredicate = new AndPredicate(statePredicate, clusterPredicate);

    final Request startRequest;
    Predicate startPredicate;
    try {
      LOG.info("Installing all services");
      requestStages = doUpdateResources(null, installRequest, installPredicate);
      notifyUpdate(Resource.Type.Service, installRequest, installPredicate);

      Map<String, Object> startProperties = new HashMap<String, Object>();
      startProperties.put(SERVICE_SERVICE_STATE_PROPERTY_ID, "STARTED");
      startRequest = new RequestImpl(null, Collections.singleton(startProperties), requestInfo, null);
      Predicate installedStatePredicate = new EqualsPredicate<String>(SERVICE_SERVICE_STATE_PROPERTY_ID, "INSTALLED");
      Predicate serviceClusterPredicate = new EqualsPredicate<String>(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
      startPredicate = new AndPredicate(installedStatePredicate, serviceClusterPredicate);

      LOG.info("Starting all services");
      doUpdateResources(requestStages, startRequest, startPredicate);
      notifyUpdate(Resource.Type.Service, startRequest, startPredicate);
      requestStages.persist();
View Full Code Here

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

    pb = new PredicateBuilder();
    Predicate userPredicate = pb.property("foo").equals("bar").toPredicate();
    // combine internal predicate and user predicate
    //todo: for now, need to cast to BasePredicate
    Predicate predicate = new AndPredicate((BasePredicate) internalPredicate, (BasePredicate) userPredicate);

    // expectations
    expect(componentResource.getType()).andReturn(Resource.Type.Component).anyTimes();

    expect(componentResourceInstance.getIds()).andReturn(mapResourceIds).anyTimes();
View Full Code Here

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

    }
    BasePredicate predicate;

    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:
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.