List of usage examples for com.google.common.base Predicates not
public static <T> Predicate<T> not(Predicate<T> predicate)
From source file:com.twitter.bazel.checkstyle.PythonCheckstyle.java
@SuppressWarnings("unchecked") private static Collection<String> getSourceFiles(String extraActionFile) { ExtraActionInfo info = ExtraActionUtils.getExtraActionInfo(extraActionFile); SpawnInfo spawnInfo = info.getExtension(SpawnInfo.spawnInfo); return Collections2.filter(spawnInfo.getInputFileList(), Predicates.and(Predicates.containsPattern(".*/src/.+\\.py[c]{0,1}$"), Predicates.not(Predicates.containsPattern("3rdparty/")))); }
From source file:com.google.devtools.build.lib.rules.proto.ProtoSourceFileBlacklist.java
/** * Filters the blacklisted protos from the given protos. *//*from w ww .j a va 2 s . co m*/ public Iterable<Artifact> filter(Iterable<Artifact> protoFiles) { return ImmutableSet.copyOf(Iterables.filter(protoFiles, Predicates.not(isBlacklistProto))); }
From source file:forge.game.GameFormat.java
private Predicate<PaperCard> buildFilterPrinted() { final Predicate<PaperCard> banNames = Predicates.not(IPaperCard.Predicates.names(this.bannedCardNames_ro)); if (this.allowedSetCodes_ro.isEmpty()) { return banNames; }/*from w w w . j av a2 s . c o m*/ return Predicates.and(banNames, IPaperCard.Predicates.printedInSets(this.allowedSetCodes_ro, true)); }
From source file:org.polarsys.reqcycle.traceability.utils.LazyMap.java
@Override public Collection<Link> get(Reachable arg0) { Collection<Link> result = delegate.get(arg0); if (result.isEmpty()) { Predicate<Reachable> equalTo = Predicates.equalTo(arg0); addUntil(equalTo, Predicates.not(equalTo)); }//from w w w . ja va 2s. co m return result; }
From source file:dom.multimap.DominatorsSetMultimap_Default_Instrumented.java
public SetMultimap.Immutable<IConstructor, IConstructor> calculateDominators(Set.Immutable<ITuple> graph) { // long totalNrOfUniqueKeys = 0; // long totalNrOfTuple = 0; // long unique = 0; // long tuples = 0; // long one2one = 0; IConstructor n0 = getTop(graph);// w w w . java 2s.c om Set.Immutable<IConstructor> nodes = carrier(graph); SetMultimap.Immutable<IConstructor, IConstructor> preds = toMultimap(project(graph, 1, 0)); { Predicate<Object> predicate = Predicates.not(Predicates.instanceOf(IValue.class)); JmhCfgDominatorBenchmarks.memoryInBytes_multimap += objectexplorer.MemoryMeasurer.measureBytes(preds, predicate); // Footprint memoryFootprint_multimap = objectexplorer.ObjectGraphMeasurer.measure(preds, // predicate); Object mapWithNestedSets = toMap(project(graph, 1, 0)); JmhCfgDominatorBenchmarks.memoryInBytes_mapWithNestedSets += objectexplorer.MemoryMeasurer .measureBytes(mapWithNestedSets, predicate); // Footprint memoryFootprint_mapWithNestedSets = // objectexplorer.ObjectGraphMeasurer.measure(mapWithNestedSets, predicate); } Iterator<Entry<IConstructor, Object>> it = preds.nativeEntryIterator(); while (it.hasNext()) { Entry<IConstructor, Object> tuple = it.next(); Object singletonOrSet = tuple.getValue(); if (singletonOrSet instanceof Set.Immutable) { JmhCfgDominatorBenchmarks.unique++; JmhCfgDominatorBenchmarks.tuples += ((Set.Immutable) singletonOrSet).size(); } else { JmhCfgDominatorBenchmarks.unique++; JmhCfgDominatorBenchmarks.tuples++; JmhCfgDominatorBenchmarks.tuples_one2one++; } } SetMultimap.Transient<IConstructor, IConstructor> w = TrieSetMultimap_HHAMT.transientOf(); w.__insert(n0, n0); // JmhCfgDominatorBenchmarks.unique++; // JmhCfgDominatorBenchmarks.tuples++; // JmhCfgDominatorBenchmarks.one2one++; for (IConstructor n : nodes.__remove(n0)) { w.__put(n, nodes); // TODO: implement method to put a whole set at once! // JmhCfgDominatorBenchmarks.unique++; // JmhCfgDominatorBenchmarks.tuples+=nodes.size(); } SetMultimap.Immutable<IConstructor, IConstructor> dom = w.freeze(); SetMultimap.Immutable<IConstructor, IConstructor> prev = TrieSetMultimap_HHAMT.of(); /* * solve (dom) for (n <- nodes) dom[n] = {n} + intersect({dom[p] | p <- preds[n]?{}}); */ while (!prev.equals(dom)) { prev = dom; // System.out.println(prev.size()); SetMultimap.Transient<IConstructor, IConstructor> newDom = TrieSetMultimap_HHAMT.transientOf(); for (IConstructor n : nodes) { Set.Immutable ps = preds.get(n); if (ps == null) { ps = EMPTY; } // System.out.println(" ps: " + ps.size()); Set.Immutable<Set.Immutable<IConstructor>> sos = setofdomsets(dom, ps); // System.out.println(" sos: " + sos.size()); Set.Immutable<IConstructor> intersected = intersect(sos); // System.out.println(" intersected: " + intersected.size()); if (!intersected.isEmpty()) { Set.Immutable<IConstructor> newValue = union(intersected, Immutable.of(n)); newDom.__put(n, newValue); // TODO: implement method to put a whole set at once! // JmhCfgDominatorBenchmarks.unique++; // JmhCfgDominatorBenchmarks.tuples+=newValue.size(); } else { newDom.__insert(n, n); // TODO: implement method to put a // whole set at once! // JmhCfgDominatorBenchmarks.unique++; // JmhCfgDominatorBenchmarks.tuples++; // JmhCfgDominatorBenchmarks.one2one++; } } dom = newDom.freeze(); // return dom; // TODO: remove } // System.out.println("unique:" + unique); // System.out.println("tuples:" + tuples); // System.out.println("one2one:" + one2one); // // System.out.println("ratio:" + tuples / unique); return dom; }
From source file:org.grouplens.lenskit.data.dao.EventCollectionDAO.java
@Override public <E extends Event> Cursor<E> streamEvents(Class<E> type, SortOrder order) { boolean needFilter = Iterables.any(types, Predicates.not(TypeUtils.subtypePredicate(type))); Comparator<Event> comp = order.getEventComparator(); if (!needFilter) { if (comp == null) { return (Cursor<E>) Cursors.wrap(events); } else {/* w w w .j av a2 s .co m*/ List evts = Lists.newArrayList(events); Collections.sort(evts, comp); return Cursors.wrap(evts); } } else { if (comp == null) { return Cursors.filter(streamEvents(), type); } else { List<E> filtered = Lists.newArrayList(Iterables.filter(events, type)); Collections.sort(filtered, comp); return Cursors.wrap(filtered); } } }
From source file:org.androidtransfuse.analysis.module.ProvidesProcessor.java
private void validate(ASTMethod astMethod, Collection<ASTAnnotation> annotations) { ImmutableSet<ASTAnnotation> nonQualifierAnnotations = FluentIterable.from(annotations) .filter(Predicates.and(Predicates.not(qualifierPredicate), Predicates.not(scopePredicate), Predicates.not(javaAnnotationPredicate))) .toSet();// w w w . j a v a2s. c om ImmutableSet<ASTAnnotation> scopeAnnotations = FluentIterable.from(annotations).filter(scopePredicate) .toSet(); ASTType providesType = astClassFactory.getType(Provides.class); for (ASTAnnotation annotation : nonQualifierAnnotations) { if (!annotation.getASTType().equals(providesType)) { //error validator.error( "@Provides methods may only be annotated with scope, qualifier or standard Java annotations") .element(astMethod).annotation(annotation).build(); } } if (scopeAnnotations.size() > 1) { for (ASTAnnotation scopeAnnotation : scopeAnnotations) { validator.error("Only one scope annotation is allowed per @Provides method").element(astMethod) .annotation(scopeAnnotation).build(); } } }
From source file:com.urswolfer.intellij.plugin.gerrit.ui.changesbrowser.CommitDiffBuilder.java
public List<Change> getDiff() throws VcsException { baseChanges = Maps.uniqueIndex(changesProvider.provide(base), GET_CHANGED_FILE_PATH); changes = Maps.uniqueIndex(changesProvider.provide(commit), GET_CHANGED_FILE_PATH); addedFiles();//from www . j a va 2 s . c o m changedFiles(); removedFiles(); return Lists.newArrayList(Iterables.filter(diff, Predicates.not(CONTAINS_NO_CHANGE))); }
From source file:gg.uhc.uhc.modules.team.TeamModule.java
@Override public void initialize() throws InvalidConfigurationException { if (!config.contains("removed team combos")) { config.set("removed team combos", Lists.newArrayList("RESET", "STRIKETHROUGH", "MAGIC", "BLACK", "WHITE", "=GRAY+ITALIC" // spectator styling in tab ));//from w ww. ja va 2 s. co m } Predicate<Prefix> isFiltered; try { List<String> removedCombos = config.getStringList("removed team combos"); List<Predicate<Prefix>> temp = Lists.newArrayListWithCapacity(removedCombos.size()); PrefixColourPredicateConverter converter = new PrefixColourPredicateConverter(); for (String combo : removedCombos) { temp.add(converter.convert(combo)); } isFiltered = Predicates.or(temp); } catch (Exception ex) { ex.printStackTrace(); plugin.getLogger() .severe("Failed to parse filtered team combos, allowing all combos to be used instead"); isFiltered = Predicates.alwaysFalse(); } setupTeams(Predicates.not(isFiltered)); this.icon.setLore(messages.evalTemplates("lore", ImmutableMap.of("count", teams.size()))); }
From source file:org.eclipse.sirius.diagram.sequence.business.internal.layout.horizontal.LostMessageEndHorizontalLayoutHelper.java
private void registerUnconnectedLostEnds() { Predicate<LostMessageEnd> unConnectedEnds = Predicates.not(Predicates.in(lostMessages.keySet())); for (LostMessageEnd lme : Iterables.filter(sequenceDiagram.getAllLostMessageEnds(), unConnectedEnds)) { unconnectedLostEnds.add(lme);//w w w .j ava2 s . c om // look viewpoint edges if (lme.getNotationNode().getElement() instanceof EdgeTarget) { EdgeTarget targetNode = getKnownTargetNode(lme); if (targetNode != null) { ISequenceEvent ise = getISequenceEvent(targetNode); if (ise != null && ise.getLifeline().some()) { lostSources.put(ise.getLifeline().get(), lme); Option<Operand> parentOperand = ise.getParentOperand(); if (parentOperand.some()) { operands.put(lme, parentOperand.get()); operands2lostEnds.put(parentOperand.get(), lme); } else { diagramLostEnds.add(lme); } } } EdgeTarget sourceNode = getKnownSourceNode(lme); if (sourceNode != null) { ISequenceEvent ise = getISequenceEvent(sourceNode); if (ise != null && ise.getLifeline().some()) { lostTargets.put(ise.getLifeline().get(), lme); Option<Operand> parentOperand = ise.getParentOperand(); if (parentOperand.some()) { operands.put(lme, parentOperand.get()); operands2lostEnds.put(parentOperand.get(), lme); } else { diagramLostEnds.add(lme); } } } } } }