List of usage examples for com.google.common.collect Sets union
public static <E> SetView<E> union(final Set<? extends E> set1, final Set<? extends E> set2)
From source file:com.facebook.buck.cxx.CxxBinaryFlavored.java
@Override public boolean hasFlavors(ImmutableSet<Flavor> inputFlavors) { Set<Flavor> flavors = inputFlavors; Set<Flavor> platformFlavors = Sets.intersection(flavors, Sets.union(getCxxPlatformsProvider().getUnresolvedCxxPlatforms().getFlavors(), cxxBuckConfig.getDeclaredPlatforms())); if (platformFlavors.size() > 1) { return false; }/* www.ja v a2 s . co m*/ flavors = Sets.difference(flavors, platformFlavors); flavors = Sets.difference(flavors, ImmutableSet.of(CxxDescriptionEnhancer.CXX_LINK_MAP_FLAVOR, CxxDescriptionEnhancer.HEADER_SYMLINK_TREE_FLAVOR, CxxCompilationDatabase.COMPILATION_DATABASE, CxxCompilationDatabase.UBER_COMPILATION_DATABASE, CxxInferEnhancer.InferFlavors.INFER.getFlavor(), CxxInferEnhancer.InferFlavors.INFER_ANALYZE.getFlavor(), CxxInferEnhancer.InferFlavors.INFER_CAPTURE_ALL.getFlavor(), StripStyle.ALL_SYMBOLS.getFlavor(), StripStyle.DEBUGGING_SYMBOLS.getFlavor(), StripStyle.NON_GLOBAL_SYMBOLS.getFlavor(), LinkerMapMode.NO_LINKER_MAP.getFlavor())); return flavors.isEmpty(); }
From source file:com.facebook.buck.core.cell.CellPathResolverView.java
public CellPathResolverView(CellPathResolver delegate, ImmutableSet<String> declaredCellNames, Path cellPath) { this.delegate = delegate; Optional<String> thisName = delegate.getCanonicalCellName(cellPath); if (thisName.isPresent()) { // A cell should be able to view into itself even if it doesn't explicitly specify it. this.declaredCellNames = ImmutableSet .copyOf(Sets.union(declaredCellNames, ImmutableSet.of(thisName.get()))); } else {// w w w.j av a 2s . com this.declaredCellNames = declaredCellNames; } this.cellPath = cellPath; }
From source file:r.base.BaseFrame.java
@Override public Set<Symbol> getSymbols() { return Sets.union(Primitives.getBuiltinSymbols(), loaded.keySet()); }
From source file:com.jgaap.distances.ChiSquareDistance.java
/** * Returns Chi-Square distance between event sets es1 and es2 * //from w w w . j a v a 2 s. c o m * @param es1 * The first EventSet * @param es2 * The second EventSet * @return the Canberra distance between them */ @Override public double distance(Histogram unknownHistogram, Histogram knownHistogram) { double distance = 0.0; Set<Event> events = Sets.union(unknownHistogram.uniqueEvents(), knownHistogram.uniqueEvents()); for (Event event : events) { double x = unknownHistogram.relativeFrequency(event); double y = knownHistogram.relativeFrequency(event); distance += (x - y) * (x - y) / (x + y); } return distance; }
From source file:org.tensorics.core.tensor.variance.CoContraDimensionPairs.java
/** * Collects all the dimensions that are contained in at least one of the given pairs, as either left or right * dimension./*from www .j ava2 s .c o m*/ * * @param pairs the pairs from which to retrieve the dimensions * @return all the dimensions which are involved in at least one of the sets */ public static Set<Class<?>> allDimensionsIn(Iterable<CoContraDimensionPair> pairs) { return Sets.union(leftDimensionsIn(pairs), rightDimensionsIn(pairs)).immutableCopy(); }
From source file:com.textocat.textokit.morph.ruscorpora.RusCorporaWordform.java
public Set<String> getAllGrammems() { return Sets.union(lexGrammems, wordformGrammems); }
From source file:io.mindmaps.graql.internal.query.predicate.AbstractValuePredicate.java
@Override public ValuePredicate or(ValuePredicate other) { ImmutableSet<Object> innerUnion = ImmutableSet .copyOf(Sets.union(innerValues, other.admin().getInnerValues())); return new OrPredicate(this, other.admin(), innerUnion); }
From source file:org.eclipse.viatra.query.runtime.localsearch.matcher.integration.AllValidAdornments.java
@Override public Iterable<Set<PParameter>> getAdornments(PQuery query) { final Set<PParameter> ins = query.getParameters().stream() .filter(PQueries.parameterDirectionPredicate(PParameterDirection.IN)).collect(Collectors.toSet()); Set<PParameter> inouts = query.getParameters().stream() .filter(PQueries.parameterDirectionPredicate(PParameterDirection.INOUT)) .collect(Collectors.toSet()); Set<Set<PParameter>> possibleInouts = Sets.powerSet(inouts); return possibleInouts.stream().map(input -> Sets.union(ins, input)).collect(Collectors.toSet()); }
From source file:org.caleydo.view.relationshipexplorer.ui.collection.idprovider.ElementIDProviders.java
/** * Gets a Provider that returns the union of all elements given by the specified providers. Note that this union is * cached once and will not be recalculated when calling {@link IElementIDProvider#getElementIDs()}. * * @param providers// w ww .ja va 2s. co m * @return */ public static IElementIDProvider unionOf(IElementIDProvider... providers) { Set<Object> elementIDs = new HashSet<>(); for (IElementIDProvider provider : providers) { elementIDs = Sets.union(elementIDs, provider.getElementIDs()); } return new SimpleElementIDProvider(elementIDs); }
From source file:com.google.gerrit.server.index.IndexUtils.java
public static Set<String> groupFields(QueryOptions opts) { Set<String> fs = opts.fields(); return fs.contains(GroupField.UUID.getName()) ? fs : Sets.union(fs, ImmutableSet.of(GroupField.UUID.getName())); }