Returns all successful unification paths from the specified {@code Unifier} unifying the
specified lists, allowing varargs if and only if {@code allowVarargs} is true.
500587
public static <T, U extends Unifiable<? super T>> Choice<Unifier> unifyList(
      Unifier unifier,
      @Nullable List<U> toUnify,
      @Nullable final List<? extends T> targets,
      boolean allowVarargs) {
    if (toUnify == null && targets == null) {
      return Choice.of(unifier);
    } else if (toUnify == null
        || targets == null
        || (allowVarargs
            ? toUnify.size() - 1 > targets.size()
            : toUnify.size() != targets.size())) {
      return Choice.none();
    }
    Choice<Unifier> choice = Choice.of(unifier);
    int index;
    for (index = 0; index < toUnify.size(); index++) {
      U toUnifyNext = toUnify.get(index);
      if (allowVarargs && toUnifyNext instanceof URepeated) {
        final URepeated repeated = (URepeated) toUnifyNext;
        final int startIndex = index;
        return choice
            .condition(index + 1 == toUnify.size())
            .thenOption(
                new Function<Unifier, Optional<Unifier>>() {
                  @Override
                  public Optional<Unifier> apply(Unifier unifier) {
                    List<JCExpression> expressions = new ArrayList<>();
                    for (int j = startIndex; j < targets.size(); j++) {
                      Optional<Unifier> forked =
                          repeated.unify((JCTree) targets.get(j), unifier.fork()).first();
                      if (!forked.isPresent()) {
                        return Optional.absent();
                      }
                      JCExpression boundExpr = repeated.getUnderlyingBinding(forked.get());
                      if (boundExpr == null) {
                        return Optional.absent();
                      }
                      expressions.add(boundExpr);
                    }
                    unifier.putBinding(repeated.key(), expressions);
                    return Optional.of(unifier);
                  }
                });
      }
      if (index >= targets.size()) {
        return Choice.none();
      }
      choice = choice.thenChoose(unifications(toUnifyNext, targets.get(index)));
    }
    if (index < targets.size()) {
      return Choice.none();
    }
    return choice;
  }
372357
@Nullable
  public final AnalyzedTokenReadings[] getUnifiedTokens() {
    if (tokSequence.isEmpty()) {
      return null;
    }
    List<AnalyzedTokenReadings> uTokens = new ArrayList<>();
    for (int j = 0; j < tokSequence.size(); j++) {
      boolean unifiedTokensFound = false; // assume that nothing has been found
      for (int i = 0; i < tokSequenceEquivalences.get(j).size(); i++) {
        int featUnified = 0;
        if (tokSequenceEquivalences.get(j).get(i).containsKey(UNIFY_IGNORE)) {
          addTokenToSequence(uTokens, tokSequence.get(j).getAnalyzedToken(i), j);
          unifiedTokensFound = true;
        } else {
          for (Map.Entry<String, List<String>> feat : unificationFeats.entrySet()) {
            if (tokSequenceEquivalences.get(j).get(i).containsKey(feat.getKey()) &&
                    tokSequenceEquivalences.get(j).get(i).get(feat.getKey()).isEmpty()) {
              featUnified = 0;
            } else {
              featUnified++;
            }
            if (featUnified == unificationFeats.entrySet().size()) {
              addTokenToSequence(uTokens, tokSequence.get(j).getAnalyzedToken(i), j);
              unifiedTokensFound = true;
            }
          }
        }
      }
      if (!unifiedTokensFound) {
        return null;
      }
    }
    return uTokens.toArray(new AnalyzedTokenReadings[0]);
  }
230284
public List<VarDef> getCombinedVars( FunctionInputDef inputDef)
    {
    assertApplicable( inputDef);

    List<VarDef> combinedVars = new ArrayList<VarDef>();
    for( VarDefIterator varDefs = new VarDefIterator( inputDef); varDefs.hasNext(); )
      {
      VarDef varDef = varDefs.next();
      if( isEligible( varDef))
        {
        combinedVars.add( varDef);
        }
      }

    if( combinedVars.size() < getTupleSize())
      {
      throw
        new IllegalStateException
        ( "Can't return " + getTupleSize() + "-tuples for " + inputDef
          + ": only " + combinedVars.size() + " variables eligible for combination");
      }

    return combinedVars;
    }
284129
public JCExpression getUnderlyingBinding(Unifier unifier) {
    return (unifier == null) ? null : unifier.getBinding(new UFreeIdent.Key(identifier()));
  }
1140767
private List<JoinableResourceBundle> getBundleDependencies(ResourceBundleDefinition definition,
			List<JoinableResourceBundle> bundles) throws BundleDependencyException {

		List<JoinableResourceBundle> dependencies = new ArrayList<>();
		List<String> processedBundles = new ArrayList<>();
		if (definition.isGlobal() && definition.getDependencies() != null && !definition.getDependencies().isEmpty()) {
			throw new BundleDependencyException(definition.getBundleName(),
					"The dependencies property is not allowed for global bundles. Please use the order property "
							+ "to define the import order.");
		}
		initBundleDependencies(definition.getBundleName(), definition, dependencies, processedBundles, bundles);
		return dependencies;
	}
858128
public KUrl unified() {
        KUrl res = new KUrl(toUrlString(false));
        res.elements[0] = normalizeDomain(elements[0]);
        return res;
    }
543370
function unipath(...bases) {
  return partial;

  /**
   * Resolve base with paths.
   *
   * @param {...string} paths - Paths to join to base
   * @returns {string} Resolved path
   */
  function partial(...paths) {
    const baseList = bases.length ? bases : [ '.' ];
    const pathList = paths.length ? paths : [ '.' ];

    return path.resolve(path.join(...baseList, ...pathList));
  }
}
1334322
public static ImmutableSet<VarSymbol> findUnusedIdentifiers(VisitorState state) {
    ImmutableSet.Builder<VarSymbol> definedVariables = ImmutableSet.builder();
    ImmutableSet.Builder<Symbol> usedSymbols = ImmutableSet.builder();
    Tree prev = state.getPath().getLeaf();
    for (Tree curr : state.getPath().getParentPath()) {
      createFindIdentifiersScanner(usedSymbols, prev).scan(curr, null);
      switch (curr.getKind()) {
        case BLOCK:
          // If we see a block then walk over each statement to see if it defines a variable
          for (StatementTree statement : ((BlockTree) curr).getStatements()) {
            if (statement.equals(prev)) {
              // break if we see the tree we have just processed so that we only consider things
              // declared/used before us in the tree
              break;
            }
            addIfVariable(statement, definedVariables);
          }
          break;
        case FOR_LOOP:
          ForLoopTree forLoop = (ForLoopTree) curr;
          forLoop.getInitializer().stream().forEach(t -> addIfVariable(t, definedVariables));
          break;
        case ENHANCED_FOR_LOOP:
          EnhancedForLoopTree enhancedFor = (EnhancedForLoopTree) curr;
          addIfVariable(enhancedFor.getVariable(), definedVariables);
          break;
        default:
          break;
      }
      prev = curr;
    }
    return ImmutableSet.copyOf(Sets.difference(definedVariables.build(), usedSymbols.build()));
  }
276158
private ImmutableSet<ImmutableExpression> getExpressionsToPropagateAboveUnion(ImmutableSet<CommutativeJoinOrFilterNode> providers) {
        return providers.stream()
                .map(n -> n.getOptionalFilterCondition().get().flattenAND())
                .reduce(this::computeIntersection).get();
    }
1171585
function allPaths (splitPath, partialPath, finalPaths, i) {
  i = i || 0
  finalPaths = finalPaths || []
  partialPath = (partialPath || '') + splitPath[i]

  if (i >= splitPath.length - 1) {
    finalPaths.push(partialPath)
  } else {
    allPaths(splitPath, partialPath + '/', finalPaths, i + 1)
    allPaths(splitPath, partialPath + '\\', finalPaths, i + 1)
  }

  return finalPaths
}
1087975
private String getAvailableVariant(Map<String, String> curVariants) {

		String variantKey = null;
		if (variants != null) {
			Map<String, String> availableVariants = generatorRegistry.getAvailableVariantMap(variants, curVariants);
			variantKey = VariantUtils.getVariantKey(availableVariants);
		}

		return variantKey;
	}
1180336
public MultiUnifier getMultiUnifier(Atom parentAtom, UnifierComparison unifierType) {
        //NB only for relations we can have non-unique unifiers
        Unifier unifier = this.getUnifier(parentAtom, unifierType);
        return unifier != null ? new MultiUnifierImpl(unifier) : MultiUnifierImpl.nonExistent();
    }
366515
private Type parseUnionType(EnclosingScope scope) {
		int start = index;
		Type t = parseIntersectionType(scope);
		// Now, attempt to look for union and/or intersection types
		if (tryAndMatch(true, VerticalBar) != null) {
			// This is a union type
			ArrayList<Type> types = new ArrayList<>();
			types.add(t);
			do {
				types.add(parseIntersectionType(scope));
			} while (tryAndMatch(true, VerticalBar) != null);
			//
			Type[] bounds = types.toArray(new Type[types.size()]);
			t = annotateSourceLocation(new Type.Union(bounds), start);
		}
		return t;
	}
666672
private List<List<ConceptId>> getComputePathResultList(Multimap<ConceptId, ConceptId> resultGraph, ConceptId fromID) {
        List<List<ConceptId>> allPaths = new ArrayList<>();
        List<ConceptId> firstPath = new ArrayList<>();
        firstPath.add(fromID);

        Deque<List<ConceptId>> queue = new ArrayDeque<>();
        queue.addLast(firstPath);
        while (!queue.isEmpty()) {
            List<ConceptId> currentPath = queue.pollFirst();
            if (resultGraph.containsKey(currentPath.get(currentPath.size() - 1))) {
                Collection<ConceptId> successors = resultGraph.get(currentPath.get(currentPath.size() - 1));
                Iterator<ConceptId> iterator = successors.iterator();
                for (int i = 0; i < successors.size() - 1; i++) {
                    List<ConceptId> extendedPath = new ArrayList<>(currentPath);
                    extendedPath.add(iterator.next());
                    queue.addLast(extendedPath);
                }
                currentPath.add(iterator.next());
                queue.addLast(currentPath);
            } else {
                allPaths.add(currentPath);
            }
        }
        return allPaths;
    }
29404
public Map<String, String> getAvailableVariantMap(Map<String, VariantSet> variants,
			Map<String, String> curVariants) {

		Map<String, String> availableVariantMap = new HashMap<>();
		for (Entry<String, VariantSet> entry : variants.entrySet()) {
			String variantType = entry.getKey();
			VariantSet variantSet = entry.getValue();
			String variant = variantSet.getDefaultVariant();
			if (curVariants.containsKey(variantType)) {
				String curVariant = curVariants.get(variantType);
				VariantResolver resolver = variantResolvers.get(variantType);
				if (resolver != null) {
					variant = resolver.getAvailableVariant(curVariant, variants.get(variantType));
					if (variant == null) {
						variant = variants.get(variantType).getDefaultVariant();
					}
				} else {
					throw new BundlingProcessException(
							"Unable to find variant resolver for variant type '" + variantType + "'");
				}
			}
			availableVariantMap.put(variantType, variant);
		}
		return availableVariantMap;
	}
1122780
@Nullable
  private List<LookupBean> getLookupListFromCoordinator(String tier)
  {
    try {
      MutableBoolean firstAttempt = new MutableBoolean(true);
      Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry(
          () -> {
            if (firstAttempt.isTrue()) {
              firstAttempt.setValue(false);
            } else if (lookupConfig.getCoordinatorRetryDelay() > 0) {
              // Adding any configured extra time in addition to the retry wait. In RetryUtils, retry wait starts from
              // a few seconds, that is likely not enough to coordinator to be back to healthy state, e. g. if it
              // experiences 30-second GC pause. Default is 1 minute
              Thread.sleep(lookupConfig.getCoordinatorRetryDelay());
            }
            return tryGetLookupListFromCoordinator(tier);
          },
          e -> true,
          lookupConfig.getCoordinatorFetchRetries()
      );
      if (lookupMap != null) {
        List<LookupBean> lookupBeanList = new ArrayList<>();
        lookupMap.forEach((k, v) -> lookupBeanList.add(new LookupBean(k, null, v)));
        return lookupBeanList;
      } else {
        return null;
      }
    }
    catch (Exception e) {
      LOG.error(e, "Error while trying to get lookup list from coordinator for tier[%s]", tier);
      return null;
    }
  }
1208563
private static String combinePaths(List<String> paths) {
    File file = new File(paths.get(0));

    for (int i = 1; i < paths.size(); i++) {
      file = new File(file, paths.get(i));
    }

    return file.getPath();
  }