Instantiate constraints for a collection of nodes.

@param nodes the nodes to integrate
@param rc    the resource identifier
@param r     the overbooking ratio, &gt;= 1
@return the associated list of continuous constraints
505291
public static List<Overbook> newOverbooks(Collection<Node> nodes, String rc, double r) {
        return nodes.stream().map(n -> new Overbook(n, rc, r)).collect(Collectors.toList());
    }
795141
public List<ConstraintDefinitionType<ValidationMappingDescriptor>> getAllConstraintDefinition()
   {
      List<ConstraintDefinitionType<ValidationMappingDescriptor>> list = new ArrayList<ConstraintDefinitionType<ValidationMappingDescriptor>>();
      List<Node> nodeList = model.get("constraint-definition");
      for(Node node: nodeList)
      {
         ConstraintDefinitionType<ValidationMappingDescriptor>  type = new ConstraintDefinitionTypeImpl<ValidationMappingDescriptor>(this, "constraint-definition", model, node);
         list.add(type);
      }
      return list;
   }
977844
@Override
    public List<SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
            @SuppressWarnings("unchecked")
            List<VM> s = (List<VM>) params[0].transform(this, t, args.get(0));
            if (s == null) {
                return Collections.emptyList();
            }
            return s.stream().map(Ready::new).collect(Collectors.toList());
        }
        return Collections.emptyList();
    }
560074
public Criteria in(Collection<?> c) {
        notNull(c, "collection can not be null");
        this.criteriaType = RelationalOperator.IN;
        this.right = new ValueListNode(c);
        return this;
    }
1251883
public static void scanForLeaves(List<RPNode> nodes,RPTree scan) {
        scanForLeaves(nodes,scan.getRoot());
    }
463458
public List<Object> fromThriftRow(Class<?> clazz, EntityMetadata m, List<String> relationNames, boolean isWrapReq,
            ConsistencyLevel consistencyLevel, Object... rowIds) throws Exception
    {
        List<Object> entities = new ArrayList<Object>();
        if (rowIds != null)
        {
            for (Object rowKey : rowIds)
            {
                Object e = fromThriftRow(clazz, m, rowKey, relationNames, isWrapReq, consistencyLevel);
                if (e != null)
                {
                    entities.add(e);
                }
            }
        }
        return entities;
    }
5910
public List<ConstraintType<ParameterType<T>>> getAllConstraint()
   {
      List<ConstraintType<ParameterType<T>>> list = new ArrayList<ConstraintType<ParameterType<T>>>();
      List<Node> nodeList = childNode.get("constraint");
      for(Node node: nodeList)
      {
         ConstraintType<ParameterType<T>>  type = new ConstraintTypeImpl<ParameterType<T>>(this, "constraint", childNode, node);
         list.add(type);
      }
      return list;
   }
1657
public static Builder builder(final Resource r) {
        return builder(r.getIdentifier()).interactionModel(r.getInteractionModel())
                        .container(r.getContainer().orElse(null))
                        .memberRelation(r.getMemberRelation().orElse(null))
                        .membershipResource(r.getMembershipResource().orElse(null))
                        .memberOfRelation(r.getMemberOfRelation().orElse(null))
                        .insertedContentRelation(r.getInsertedContentRelation().orElse(null));
    }
561315
@Override
    public Set<VM> getMisPlacedVMs(Instance i) {
        for (SatConstraint c : i.getSatConstraints()) {
            if (!(c instanceof ResourceRelated && ((ResourceRelated) c).getResource().equals(rc.getResourceIdentifier()))) {
                continue;
            }
            if (c instanceof Preserve) {
                VM v = c.getInvolvedVMs().iterator().next();
                wantedAmount.put(v, consumption(v, ((Preserve) c).getAmount()));
            } else if (c instanceof Overbook) {
                Node n = c.getInvolvedNodes().iterator().next();
                wantedRatios.put(n, ratio(n, ((Overbook) c).getRatio()));
            } else if (c instanceof ResourceCapacity && c.getInvolvedNodes().size() == 1) {
                Node n = c.getInvolvedNodes().iterator().next();
                wantedCapacity.put(n, capacity(n, ((ResourceCapacity) c).getAmount()));
            }
        }
        Mapping m = i.getModel().getMapping();
        Set<VM> candidates = new HashSet<>();
        for (Node n : m.getOnlineNodes()) {
            if (overloaded(m, n)) {
                candidates.addAll(m.getRunningVMs(n));
            }
        }
        return candidates;
    }
1102276
public static List<Quarantine> newQuarantine(Collection<Node> nodes) {
        return nodes.stream().map(Quarantine::new).collect(Collectors.toList());
    }
609764
public static Map<Node, List<String>> getConditionNodes(final Node node) {
        final Map<Node, List<String>> conditionalNodes = new HashMap<Node, List<String>>();
        getConditionNodes(node, conditionalNodes);
        return conditionalNodes;
    }
446308
private static List<Set<Integer>> createFinalAggregates(
                List<Set<Integer>> C, List<Set<Integer>> N, boolean[] R) {

            for (int i = 0; i < R.length; ++i) {

                // Skip non-free nodes
                if (!R[i])
                    continue;

                // Create new aggregate from the nodes in N[i] which are free
                Set<Integer> Cn = new HashSet<Integer>();
                for (int j : N.get(i))
                    if (R[j]) {
                        R[j] = false;
                        Cn.add(j);
                    }

                if (!Cn.isEmpty())
                    C.add(Cn);
            }

            return C;
        }
21664
private Iterable<YamlNode> cast(Iterable<Object> nodes) {
        return () -> new UnmodifiableIterator<YamlNode>() {
            private final Iterator<Object> iter = nodes.iterator();

            @Override
            public boolean hasNext() {
                return iter.hasNext();
            }

            @Override
            public YamlNode next() {
                return (YamlNode) iter.next();
            }
        };
    }
545468
public List<Node<K, V>> stab(K k) {
      Interval<K> i = new Interval<K>(k, true, k, true);
      final List<Node<K, V>> nodes = new ArrayList<Node<K, V>>();
      findOverlap(root.left, i, new NodeCallback<K, V>() {
         @Override
         public void handle(Node<K, V> node) {
            nodes.add(node);
         }
      });
      return nodes;
   }
140425
public List<UniqueConstraint<CollectionTable<T>>> getAllUniqueConstraint()
   {
      List<UniqueConstraint<CollectionTable<T>>> list = new ArrayList<UniqueConstraint<CollectionTable<T>>>();
      List<Node> nodeList = childNode.get("unique-constraint");
      for(Node node: nodeList)
      {
         UniqueConstraint<CollectionTable<T>>  type = new UniqueConstraintImpl<CollectionTable<T>>(this, "unique-constraint", childNode, node);
         list.add(type);
      }
      return list;
   }
427832
@Override
	protected Constraint[] createInternalConstraints(Variable from, Variable to) {		
		this.xConstraint.setFrom(((RectangularRegion)from).getInternalVariables()[0]);
		this.xConstraint.setTo(((RectangularRegion)to).getInternalVariables()[0]);
		this.yConstraint.setFrom(((RectangularRegion)from).getInternalVariables()[1]);
		this.yConstraint.setTo(((RectangularRegion)to).getInternalVariables()[1]);
		//xConstraint should not be processed by Y solver		
		xConstraint.skipSolver(((MultiVariable)from).getInternalConstraintSolvers()[1]);
		//yConstraint should not be processed by X solver
		yConstraint.skipSolver(((MultiVariable)from).getInternalConstraintSolvers()[0]);
		return new Constraint[] {this.xConstraint, this.yConstraint};
	}
646311
private static void dfVisit(DMNResource node, List<DMNResource> allNodes, Collection<DMNResource> visited, List<DMNResource> dfv) {
        if (visited.contains(node)) {
            throw new RuntimeException("Circular dependency detected: " + visited + " , and again to: " + node);
        }
        visited.add(node);

        List<DMNResource> neighbours = node.getDependencies().stream()
                                           .flatMap(dep -> allNodes.stream().filter(r -> r.getModelID().equals(dep)))
                                           .collect(Collectors.toList());
        for (DMNResource n : neighbours) {
            if (!visited.contains(n)) {
                dfVisit(n, allNodes, visited, dfv);
            }
        }

        dfv.add(node);
    }