Produces all tuples of size n chosen from a list of variable names

@param variables the list of variable names to make tuples of
@param nWise     the size of the desired tuples
@return all tuples of size nWise
438816
public List<Set<String>> makeNWiseTuples(String[] variables, int nWise) {
        List<Set<String>> completeTuples = new ArrayList<>();
        makeNWiseTuplesHelper(completeTuples, variables, 0, new HashSet<String>(), nWise);

        return completeTuples;
    }
992916
private List<Integer> getRelevantVarIndices(final Collection<Variable> variables) {
        final List<Integer> relevantVarIndices = new ArrayList<>(variables.size());
        for (final Variable var : variables) {
            final Integer idx = this.name2idx.get(var.name());
            // Note: Unknown variables are variables added to the solver yet. Thus, these are optional variables and can
            // be left out for the backbone computation.
            if (idx != null) {
                relevantVarIndices.add(idx);
            }
        }
        return relevantVarIndices;
    }
1322078
def _get_vars_to_collections(variables):
  """"""
  var_to_collections = collections.defaultdict(lambda: [])
  if isinstance(variables, dict):
    variables = list(v for _, v in variable_map_items(variables))
  for graph in set(v.graph for v in variables):
    for collection_name in list(graph.collections):
      entries = set(entry for entry in graph.get_collection(collection_name)
                    if isinstance(entry, tf.Variable))
      # For legacy reasons, tf.GraphKeys.GLOBAL_VARIABLES == "variables".
      # Correcting for this here, to avoid confusion.
      if collection_name == tf.GraphKeys.GLOBAL_VARIABLES:
        collection_name = "global_variables"
      for var in entries.intersection(variables):
        var_to_collections[var].append(collection_name)
  return var_to_collections
1034746
def variables(self):
    """"""
    result = []
    for _, value in sorted(self.variable_map.items()):
      if isinstance(value, list):
        result.extend(value)
      else:
        result.append(value)
    return result
345277
public void setVariables(List<VariableInitializer> variables) {
        assertNotNull(variables);
        this.variables.clear();
        for (VariableInitializer vi : variables) {
            addVariable(vi);
        }
    }
230649
private void encodeIntern(final LNGVector<Literal> vars) {
    if (vars.size() <= this.groupSize)
      for (int i = 0; i + 1 < vars.size(); i++)
        for (int j = i + 1; j < vars.size(); j++)
          this.result.addClause(vars.get(i).negate(), vars.get(j).negate());
    else {
      final LNGVector<Literal> l1 = new LNGVector<>(vars.size() / 2);
      final LNGVector<Literal> l2 = new LNGVector<>(vars.size() / 2);
      int i = 0;
      for (; i < vars.size() / 2; i++)
        l1.push(vars.get(i));
      for (; i < vars.size(); i++)
        l2.push(vars.get(i));
      final Variable newVariable = this.result.newVariable();
      l1.push(newVariable);
      l2.push(newVariable.negate());
      this.encodeIntern(l1);
      this.encodeIntern(l2);
    }
  }
1337317
private HashMap<String, String[]>[][] expandedQueryVariables(
      HashMap<String, String[]>[] queryVariables) {
    HashMap<String, String[]>[][] subResult = new HashMap[queryVariables.length][];
    for (int q = 0; q < queryVariables.length; q++) {
      subResult[q] = expandedQueryVariables(queryVariables[q]);
    }
    ArrayList<HashMap<String, String[]>[]> result = new ArrayList<>();
    generatePermutations(result, 0, subResult);
    return result.toArray(new HashMap[result.size()][]);
  }
691455
public Collection<Variable> getVariables() {
        if (parent == null) {
            return getLocalVariables();
        }
        List<Variable> result = new ArrayList<>();
        result.addAll(parent.getVariables());
        result.addAll(getLocalVariables());
        return result;
    }
1310328
public final Set<Variable> vars() {
        if (vars == null) {
            ImmutableSet.Builder<Variable> builder = ImmutableSet.<Variable>builder().add(start());
            Variable end = end();
            if (end != null) builder.add(end);
            builder.addAll(otherVars());
            vars = builder.build();
        }

        return vars;
    }
1367448
def get_vars(n):
    
    op = n[0]
    if op.startswith('_') and op.endswith('_'):
        op = op.strip('_')
        if op == 'var':
            return [n[1]]
        return []
    else:
        ret = []
        for c in n[1:]:
            vs = get_vars(c)
            if vs:
                ret.extend(vs)
        return ret
1045556
private static Collection<Tuple> getTuples( List<VarDef> varDefs, int varStart, int varEnd, int tupleSize)
    {
    Collection<Tuple> tuples = new ArrayList<Tuple>();

    // For each variable up to the last included...
    for( int i = varStart; i < varEnd; i++)
      {
      // Combine each valid value...
      VarDef                nextVar   = varDefs.get(i);
      Iterator<VarValueDef> values    = nextVar.getValidValues();
      if( !values.hasNext())
        {
        throw new IllegalStateException( "Can't complete tuples -- no valid values defined for var=" + nextVar);
        }

      // With all subtuples from the remaining variables.
      Collection<Tuple> subTuples =
        tupleSize==1
        ? null
        : getTuples( varDefs, i + 1, varEnd + 1, tupleSize - 1);

      // Only one variable to combine?
      if( subTuples == null)
        {
        // Yes, return list of 1-tuples for this variable.
        while( values.hasNext())
          {
          tuples.add( new Tuple( new VarBindingDef( nextVar, values.next())));
          }
        }

      // Any compatible subtuples for remaining variables?
      else if( !subTuples.isEmpty())
        {
        // Yes, add all compatible combinations with values for this variable.
        while( values.hasNext())
          {
          VarBindingDef nextBinding = new VarBindingDef( nextVar, values.next());
          for( Tuple subTuple : subTuples)
            {
            Tuple nextTuple = new Tuple( nextBinding).addAll( subTuple);
            if( nextTuple.isCompatible())
              {
              tuples.add( nextTuple);
              }
            }
          }
        }
      }
    
    return tuples;
    }
1125552
public final VariableNumMap getVariablesByName(Collection<String> variableNames) {
    int[] newNums = new int[nums.length];
    String[] newNames = new String[nums.length];
    Variable[] newVars = new Variable[nums.length];

    int numFilled = 0;
    for (int i = 0; i < nums.length; i++) {
      if (variableNames.contains(names[i])) {
        newNums[numFilled] = nums[i];
        newNames[numFilled] = names[i];
        newVars[numFilled] = vars[i];
        numFilled++;
      }
    }
    return VariableNumMap.fromSortedArrays(newNums, newNames, newVars, numFilled);
  }
556876
public Tuple<Decl.Variable> determineUsedVariables(Tuple<WyilFile.Expr> exprs) {
		HashSet<Decl.Variable> used = new HashSet<>();
		usedVariableExtractor.visitExpressions(exprs, used);
		return new Tuple<>(used);
	}
70525
private static Variable[] litsAsVars(final Literal[] lits) {
    final Variable[] vars = new Variable[lits.length];
    for (int i = 0; i < vars.length; i++)
      vars[i] = lits[i].variable();
    return vars;
  }
1292073
public UriTemplate with(TemplateVariables variables) {

		Assert.notNull(variables, "TemplateVariables must not be null!");

		if (variables.equals(TemplateVariables.NONE)) {
			return this;
		}

		UriComponents components = UriComponentsBuilder.fromUriString(baseUri).build();
		List<TemplateVariable> result = new ArrayList<>();

		for (TemplateVariable variable : variables) {

			boolean isRequestParam = variable.isRequestParameterVariable();
			boolean alreadyPresent = components.getQueryParams().containsKey(variable.getName());

			if (isRequestParam && alreadyPresent) {
				continue;
			}

			if (variable.isFragment() && StringUtils.hasText(components.getFragment())) {
				continue;
			}

			result.add(variable);
		}

		return new UriTemplate(baseUri, this.variables.concat(result));
	}
453500
public List<Variable> variables() {
        List<Variable> result = new ArrayList<Variable>(inputVariables.size() + outputVariables.size());
        result.addAll(inputVariables);
        result.addAll(outputVariables);
        return result;
    }
806259
@Override
  public Set<String> getVariables() {
    Set<String> variables = lhs.getVariables();
    variables.addAll(rhs.getVariables());

    return variables;
  }