Instantiate discrete constraints for a collection of VMs.

@param vms   the VMs to integrate
@param nodes the hosts to disallow
@return the associated list of constraints
163894
public static List<Fence> newFence(Collection<VM> vms, Collection<Node> nodes) {
        return vms.stream().map(v -> new Fence(v, nodes)).collect(Collectors.toList());
    }
889194
public GroupsType<ConstraintType<T>> getOrCreateGroups()
   {
      Node node = childNode.getOrCreate("groups");
      GroupsType<ConstraintType<T>> groups = new GroupsTypeImpl<ConstraintType<T>>(this, "groups", childNode, node);
      return groups;
   }
283314
public void setReservedNodes(java.util.Collection<ReservedNode> reservedNodes) {
        if (reservedNodes == null) {
            this.reservedNodes = null;
            return;
        }

        this.reservedNodes = new com.amazonaws.internal.SdkInternalList<ReservedNode>(reservedNodes);
    }
993364
def _build_ip_constraints(roles, ips, constraints):
    
    local_ips = copy.deepcopy(ips)
    for constraint in constraints:
        gsrc = constraint['src']
        gdst = constraint['dst']
        gdelay = constraint['delay']
        grate = constraint['rate']
        gloss = constraint['loss']
        for s in roles[gsrc]:
            # one possible source
            # Get all the active devices for this source
            active_devices = filter(lambda x: x["active"],
                                    local_ips[s.alias]['devices'])
            # Get only the devices specified in the network constraint
            if 'network' in constraint:
                active_devices = filter(
                    lambda x:
                    x['device'] == s.extra[constraint['network']],
                    active_devices)
            # Get only the name of the active devices
            sdevices = map(lambda x: x['device'], active_devices)
            for sdevice in sdevices:
                # one possible device
                for d in roles[gdst]:
                    # one possible destination
                    dallips = local_ips[d.alias]['all_ipv4_addresses']
                    # Let's keep docker bridge out of this
                    dallips = filter(lambda x: x != '172.17.0.1', dallips)
                    for dip in dallips:
                        local_ips[s.alias].setdefault('tc', []).append({
                            'source': s.alias,
                            'target': dip,
                            'device': sdevice,
                            'delay': gdelay,
                            'rate': grate,
                            'loss': gloss
                        })
    return local_ips
1315568
@Deprecated
    public synchronized FailureDetectorConfig setNodes(Collection<Node> nodes) {
        Utils.notNull(nodes);
        this.nodes = new HashSet<Node>(nodes);
        return this;
    }
1077439
@Override
    public List<NoDelay> 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));
            return s != null ? NoDelay.newNoDelay(s) : Collections.emptyList();
        }
        return Collections.emptyList();
    }
551870
protected void obtainEndpoints(List<Node> nodes, List<EndpointInfo> endpoints) {
        for (int i = 0; i < nodes.size(); i++) {
            Node node = nodes.get(i);

            if (node.getUri() != null) {
                EndpointInfo ei=new EndpointInfo();
                ei.setEndpoint(EndpointUtil.encodeEndpoint(node.getUri(), node.getOperation()));

                if (!endpoints.contains(ei)) {
                    initEndpointInfo(ei);
                    endpoints.add(ei);
                }
            }

            if (node instanceof ContainerNode) {
                obtainEndpoints(((ContainerNode) node).getNodes(), endpoints);
            }
        }
    }
990751
private void placeVMs(Parameters ps, List<AbstractStrategy<?>> strategies, List<VMTransition> actions, OnStableNodeFirst schedHeuristic, Map<IntVar, VM> map) {
        IntValueSelector rnd = new WorstFit(map, rp, new BiggestDimension());
        if (!useResources) {
            rnd = new RandomVMPlacement(rp, map, true, ps.getRandomSeed());
        }
        IntVar[] hosts = dSlices(actions).map(Slice::getHoster).filter(v -> !v.isInstantiated()).toArray(IntVar[]::new);
        if (hosts.length > 0) {
            strategies.add(new IntStrategy(hosts, new HostingVariableSelector(rp.getModel(), schedHeuristic), rnd));
        }
    }
1323311
public void setHosts(java.util.Collection<Host> hosts) {
        if (hosts == null) {
            this.hosts = null;
            return;
        }

        this.hosts = new com.amazonaws.internal.SdkInternalList<Host>(hosts);
    }
416515
def list_nodes_min(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_min function must be called '
            'with -f or --function.'
        )

    ret = {}
    vm_properties = ["name"]

    vm_list = salt.utils.vmware.get_mors_with_properties(_get_si(), vim.VirtualMachine, vm_properties)

    for vm in vm_list:
        ret[vm['name']] = {'state': 'Running', 'id': vm['name']}

    return ret
256835
public static List<Root> newRoots(Collection<VM> vms) {
        return vms.stream().map(Root::new).collect(Collectors.toList());
    }
1176073
private List<Tuple> tuplesResult(EntityKey[] keys, TupleContext tupleContext, ResourceIterator<Node> nodes) {
		// The list is initialized with null because some keys might not have a corresponding node
		Tuple[] tuples = new Tuple[keys.length];
		while ( nodes.hasNext() ) {
			Node node = nodes.next();
			for ( int i = 0; i < keys.length; i++ ) {
				if ( matches( node, keys[i].getColumnNames(), keys[i].getColumnValues() ) ) {
					tuples[i] = new Tuple( EmbeddedNeo4jTupleSnapshot.fromNode( node,
							tupleContext.getTupleTypeContext().getAllAssociatedEntityKeyMetadata(),
							tupleContext.getTupleTypeContext().getAllRoles(),
							keys[i].getMetadata() ), SnapshotType.UPDATE );
					// We assume there are no duplicated keys
					break;
				}
			}
		}
		return Arrays.asList( tuples );
	}
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;
    }
1273584
static int[]
	offsets(final ISeq<? extends FlatTree<? extends Op<?>, ?>> nodes) {
		final int[] offsets = new int[nodes.size()];

		int offset = 1;
		for (int i = 0; i < offsets.length; ++i) {
			final Op<?> op = nodes.get(i).getValue();

			offsets[i] = op.isTerminal() ? -1 : offset;
			offset += op.arity();
		}

		return offsets;
	}
518603
def _handle_nodes(nodes: MaybeNodeList) -> List[BaseEntity]:
    """"""
    if isinstance(nodes, BaseEntity):
        return [nodes]

    return [
        (
            parse_result_to_dsl(node)
            if not isinstance(node, BaseEntity) else
            node
        )
        for node in nodes
    ]
1064411
private void addLinkConstraints(ReconfigurationProblem rp) {

        // Links limitation
        List<Task> tasksListUp = new ArrayList<>();
        List<Task> tasksListDown = new ArrayList<>();
        List<IntVar> heightsListUp = new ArrayList<>();
        List<IntVar> heightsListDown = new ArrayList<>();

        for (Link l : net.getLinks()) {

            for (VM vm : rp.getVMs()) {
                VMTransition a = rp.getVMAction(vm);

                if (a instanceof RelocatableVM
                        && !a.getDSlice().getHoster().isInstantiatedTo(a.getCSlice().getHoster().getValue())) {

                    Node src = source.getMapping().getVMLocation(vm);
                    Node dst = rp.getNode(a.getDSlice().getHoster().getValue());
                    List<Link> path = net.getRouting().getPath(src, dst);

                    // Check first if the link is on migration path
                    if (path.contains(l)) {
                        // Get link direction
                        LinkDirection linkDirection = net.getRouting().getLinkDirection(src, dst, l);
                        // UpLink
                        if (linkDirection == LinkDirection.UPLINK) {
                            tasksListUp.add(((RelocatableVM) a).getMigrationTask());
                            heightsListUp.add(((RelocatableVM) a).getBandwidth());
                        }
                        // DownLink
                        else {
                            tasksListDown.add(((RelocatableVM) a).getMigrationTask());
                            heightsListDown.add(((RelocatableVM) a).getBandwidth());
                        }
                    }
                }
            }
            if (!tasksListUp.isEmpty()) {

                // Post the cumulative constraint for the current UpLink
                csp.post(csp.cumulative(
                        tasksListUp.toArray(new Task[tasksListUp.size()]),
                        heightsListUp.toArray(new IntVar[heightsListUp.size()]),
                        csp.intVar(l.getCapacity()),
                        true
                ));

                tasksListUp.clear();
                heightsListUp.clear();
            }
            if (!tasksListDown.isEmpty()) {

                // Post the cumulative constraint for the current DownLink
                csp.post(csp.cumulative(
                        tasksListDown.toArray(new Task[tasksListDown.size()]),
                        heightsListDown.toArray(new IntVar[heightsListDown.size()]),
                        csp.intVar(l.getCapacity()),
                        true
                ));

                tasksListDown.clear();
                heightsListDown.clear();
            }
        }
    }
651159
public static List<Running> newRunning(Collection<VM> vms) {
        return vms.stream().map(Running::new).collect(Collectors.toList());
    }