List of usage examples for com.google.common.collect Sets difference
public static <E> SetView<E> difference(final Set<E> set1, final Set<?> set2)
From source file:modules.HandleMonitorModule.java
@Override public void processOut(String extractNative) { HashSet<LSOFout> res = new HashSet<LSOFout>(); String lines[] = extractNative.split("\\r?\\n"); for (int n = 0; n < lines.length; n++) { // start of a new process if (lines[n].startsWith(divider) && ++n < lines.length) { String[] header = lines[n].split("\\s+", 5); String name = header[0]; long pid = Long.parseLong(header[2]); n++;/*from ww w.j a v a2s . c o m*/ while (n < lines.length && !lines[n].startsWith(divider)) { String[] current = lines[n].split("\\s+", 5); LSOFout o = new LSOFout(); o.command = name; o.pid = pid; o.node = current[1]; o.type = current[2]; if (current.length > 4) { o.FD = current[3]; o.name = current[4]; if (!name.equals("handle.exe")) { res.add(o); } } n++; } } } if (prev != null) { for (LSOFout o : Sets.difference(prev, res)) { disappear(o); } for (LSOFout o : Sets.difference(res, prev)) { appear(o); } } else { for (LSOFout o : res) { appear(o); } } prev = res; }
From source file:com.facebook.buck.jvm.java.AbstractAnnotationProcessingParams.java
@Value.Lazy protected ImmutableList<JavacPluginProperties> getLegacyProcessors() { JavacPluginProperties.Builder legacySafeProcessorsBuilder = JavacPluginProperties.builder() .setCanReuseClassLoader(true).setDoesNotAffectAbi(false).setSupportsAbiGenerationFromSource(false) .setProcessorNames(Sets.intersection(getLegacyAnnotationProcessorNames(), getLegacySafeAnnotationProcessors())); JavacPluginProperties.Builder legacyUnsafeProcessorsBuilder = JavacPluginProperties.builder() .setCanReuseClassLoader(false).setDoesNotAffectAbi(false).setSupportsAbiGenerationFromSource(false) .setProcessorNames(//from w w w. j a v a 2s . c o m Sets.difference(getLegacyAnnotationProcessorNames(), getLegacySafeAnnotationProcessors())); for (BuildRule dep : getLegacyAnnotationProcessorDeps()) { legacySafeProcessorsBuilder.addDep(dep); legacyUnsafeProcessorsBuilder.addDep(dep); } JavacPluginProperties legacySafeProcessors = legacySafeProcessorsBuilder.build(); JavacPluginProperties legacyUnsafeProcessors = legacyUnsafeProcessorsBuilder.build(); ImmutableList.Builder<JavacPluginProperties> resultBuilder = ImmutableList.builder(); if (!legacySafeProcessors.isEmpty()) { resultBuilder.add(legacySafeProcessors); } if (!legacyUnsafeProcessors.isEmpty()) { resultBuilder.add(legacyUnsafeProcessors); } return resultBuilder.build(); }
From source file:com.codemacro.jcm.storage.StatusStorage.java
@Override void onListChanged() { Set<String> names = new HashSet<String>(getChildren()); logger.info("node status list changed {}", names.size()); Set<String> added = Sets.difference(names, this.clusterNames); for (String name : added) { loadNodesStatus(name);/* www . jav a 2s .c o m*/ } this.clusterNames = names; }
From source file:io.fluo.webindex.data.fluo.PageObserver.java
@Override public void process(TransactionBase tx, Bytes row, Column col) throws Exception { TypedTransactionBase ttx = FluoConstants.TYPEL.wrap(tx); Map<Column, Value> pages = ttx.get().row(row).columns(FluoConstants.PAGE_NEW_COL, FluoConstants.PAGE_CUR_COL); String nextJson = pages.get(FluoConstants.PAGE_NEW_COL).toString(""); if (nextJson.isEmpty()) { log.error("An empty page was set at row {} col {}", row.toString(), col.toString()); return;/*from w ww. ja v a 2 s . c o m*/ } Page curPage = Page.fromJson(gson, pages.get(FluoConstants.PAGE_CUR_COL).toString("")); Set<Link> curLinks = curPage.getOutboundLinks(); Map<String, UriInfo> updates = new HashMap<>(); String pageUri = getPageRowHasher().removeHash(row).toString(); Page nextPage = Page.fromJson(gson, nextJson); if (nextPage.isDelete()) { ttx.mutate().row(row).col(FluoConstants.PAGE_CUR_COL).delete(); updates.put(pageUri, new UriInfo(0, -1)); } else { ttx.mutate().row(row).col(FluoConstants.PAGE_CUR_COL).set(nextJson); if (curPage.isEmpty()) { updates.put(pageUri, new UriInfo(0, 1)); } } Set<Link> nextLinks = nextPage.getOutboundLinks(); Sets.SetView<Link> addLinks = Sets.difference(nextLinks, curLinks); for (Link link : addLinks) { updates.put(link.getPageID(), new UriInfo(1, 0)); } Sets.SetView<Link> delLinks = Sets.difference(curLinks, nextLinks); for (Link link : delLinks) { updates.put(link.getPageID(), new UriInfo(-1, 0)); } uriMap.update(tx, updates); exportQ.add(tx, pageUri, new PageExport(nextJson, addLinks, delLinks)); // clean up ttx.mutate().row(row).col(FluoConstants.PAGE_NEW_COL).delete(); }
From source file:com.google.devtools.j2objc.types.HeaderImportCollector.java
private void addForwardDecl(ITypeBinding type) { forwardDecls.addAll(Sets.difference(Import.getImports(type, unit), declaredTypes)); }
From source file:prm4j.spec.finite.FiniteParametricProperty.java
@Override public SetMultimap<BaseEvent, Set<Parameter<?>>> getEnableParameterSets() { final SetMultimap<BaseEvent, Set<BaseEvent>> event2eventSets = HashMultimap.create(); new FSMVisitor(finiteSpec.getBaseEvents()) { @Override/*from w w w . ja v a2 s . c o m*/ public void processTransition(MonitorState thisState, BaseEvent baseEvent, MonitorState nextState, Set<BaseEvent> inducedEventSet) { if (nextState != null) { event2eventSets.put(baseEvent, Sets.difference(inducedEventSet, Util.set(baseEvent))); } } }.visit(partEnableInitialState); return toParameterSetMultimap(event2eventSets); }
From source file:se.sics.caracaldb.View.java
public SetView<Address> removedSince(View oldView) { return Sets.difference(oldView.members, members); }
From source file:org.glassfish.jersey.gf.cdi.InjecteeSkippingAnalyzer.java
@Override public <T> Set<Method> getInitializerMethods(Class<T> type) throws MultiException { final Set<Method> originalMethods = defaultAnalyzer.getInitializerMethods(type); final Set<Method> skippedMethods = getMembersToSkip(type, methodsToSkip); return skippedMethods == null ? originalMethods : Sets.difference(originalMethods, skippedMethods); }
From source file:org.jenkinsci.plugins.workflow.steps.FlowInterruptedException.java
/** * If a build catches this exception, it should use this method to report it. * @param run/*from ww w. j a va 2 s . co m*/ * @param listener */ public void handle(Run<?, ?> run, TaskListener listener) { Set<CauseOfInterruption> boundCauses = new HashSet<>(); for (InterruptedBuildAction a : run.getActions(InterruptedBuildAction.class)) { boundCauses.addAll(a.getCauses()); } Collection<CauseOfInterruption> diff = Sets.difference(new LinkedHashSet<>(causes), boundCauses); if (!diff.isEmpty()) { run.addAction(new InterruptedBuildAction(diff)); for (CauseOfInterruption cause : diff) { cause.print(listener); } } print(getCause(), listener); for (Throwable t : getSuppressed()) { print(t, listener); } }
From source file:com.facebook.buck.core.model.impl.AbstractImmutableBuildTarget.java
@Override public BuildTarget withoutFlavors(Set<Flavor> flavors) { return withFlavors(Sets.difference(getFlavors(), flavors)); }