List of usage examples for com.google.common.base Predicates not
public static <T> Predicate<T> not(Predicate<T> predicate)
From source file:org.apache.aurora.scheduler.async.preemptor.PendingTaskProcessor.java
private List<TaskGroupKey> fetchIdlePendingGroups(StoreProvider store) { Multiset<TaskGroupKey> taskGroupCounts = HashMultiset .create(FluentIterable.from(store.getTaskStore().fetchTasks(Query.statusScoped(PENDING))) .filter(Predicates.and(isIdleTask, Predicates.not(hasCachedSlot))) .transform(Functions.compose(ASSIGNED_TO_GROUP_KEY, SCHEDULED_TO_ASSIGNED))); return getPreemptionSequence(taskGroupCounts); }
From source file:alien4cloud.webconfiguration.RestDocumentationConfig.java
private Predicate<String> otherApiPredicate() { Predicate<String> notAlreadyTreated = Predicates.not(Predicates.or(predicates)); Predicate<String> isCurrentVersionApi = PathSelectors .regex("/rest/" + PREFIXED_CURRENT_API_VERSION + "/.*"); return Predicates.and(notAlreadyTreated, isCurrentVersionApi); }
From source file:org.eclipse.sirius.diagram.business.api.query.DDiagramElementQuery.java
/** * Check if this {@link DDiagramElement} is directly collapsed. * //from www .j av a 2 s. com * @return true if the given element is directly collapsed. */ public boolean isCollapsed() { return Iterables.any(element.getGraphicalFilters(), Predicates.and(Predicates.instanceOf(CollapseFilter.class), Predicates.not(Predicates.instanceOf(IndirectlyCollapseFilter.class)))); }
From source file:org.eclipse.sirius.diagram.ui.tools.internal.layout.provider.PinnedElementsLayoutProvider.java
/** * Finds the "real" children of the specified edit part that needs to be * laid out./* ww w .ja v a 2 s . c om*/ */ private Collection<IGraphicalEditPart> getChildrenOfInterest(final IGraphicalEditPart gep) { final Iterable<IGraphicalEditPart> rawChildren = Iterables.filter(gep.getChildren(), IGraphicalEditPart.class); // Ignore these, which are technically children edit parts but not // "inside" the container. final Predicate<Object> invalidChildKind = Predicates.or( Predicates.instanceOf(IDiagramBorderNodeEditPart.class), Predicates.instanceOf(IDiagramNameEditPart.class)); // These are OK. final Predicate<Object> validChildKind = Predicates.or(Predicates.instanceOf(IDiagramNodeEditPart.class), Predicates.instanceOf(IDiagramContainerEditPart.class), Predicates.instanceOf(IDiagramListEditPart.class)); final Predicate<Object> isProperChild = Predicates.and(validChildKind, Predicates.not(invalidChildKind)); final Collection<IGraphicalEditPart> result = Lists .newArrayList(Iterables.filter(rawChildren, isProperChild)); // Containers have an intermediate level of children edit parts. We // ignore these "wrapper" parts, but must look inside for proper // children of the container. for (IGraphicalEditPart part : Iterables.filter(rawChildren, Predicates.not(isProperChild))) { if (part instanceof DNodeContainerViewNodeContainerCompartmentEditPart || part instanceof DNodeContainerViewNodeContainerCompartment2EditPart) { result.addAll(getChildrenOfInterest(part)); } } return result; }
From source file:com.facebook.buck.apple.AppleBundleDescription.java
/** * Propagate the bundle's platform, debug symbol and strip flavors to its dependents * which are other bundles (e.g. extensions) *///from w ww. j a v a 2s . c o m @Override public ImmutableSet<BuildTarget> findDepsForTargetFromConstructorArgs(BuildTarget buildTarget, CellPathResolver cellRoots, AppleBundleDescription.Arg constructorArg) { if (!cxxPlatformFlavorDomain.containsAnyOf(buildTarget.getFlavors())) { buildTarget = BuildTarget.builder(buildTarget) .addAllFlavors(ImmutableSet.of(defaultCxxPlatform.getFlavor())).build(); } Optional<MultiarchFileInfo> fatBinaryInfo = MultiarchFileInfos.create(appleCxxPlatformsFlavorDomain, buildTarget); CxxPlatform cxxPlatform; if (fatBinaryInfo.isPresent()) { AppleCxxPlatform appleCxxPlatform = fatBinaryInfo.get().getRepresentativePlatform(); cxxPlatform = appleCxxPlatform.getCxxPlatform(); } else { cxxPlatform = ApplePlatforms.getCxxPlatformForBuildTarget(cxxPlatformFlavorDomain, defaultCxxPlatform, buildTarget); } String platformName = cxxPlatform.getFlavor().getName(); final Flavor actualWatchFlavor; if (ApplePlatform.isSimulator(platformName)) { actualWatchFlavor = WATCH_SIMULATOR_FLAVOR; } else if (platformName.startsWith(ApplePlatform.IPHONEOS.getName()) || platformName.startsWith(ApplePlatform.WATCHOS.getName())) { actualWatchFlavor = WATCH_OS_FLAVOR; } else { actualWatchFlavor = ImmutableFlavor.of(platformName); } FluentIterable<BuildTarget> depsExcludingBinary = FluentIterable.from(constructorArg.deps) .filter(Predicates.not(constructorArg.binary::equals)); // Propagate platform flavors. Need special handling for watch to map the pseudo-flavor // watch to the actual watch platform (simulator or device) so can't use // BuildTargets.propagateFlavorsInDomainIfNotPresent() { FluentIterable<BuildTarget> targetsWithPlatformFlavors = depsExcludingBinary .filter(BuildTargets.containsFlavors(cxxPlatformFlavorDomain)); FluentIterable<BuildTarget> targetsWithoutPlatformFlavors = depsExcludingBinary .filter(Predicates.not(BuildTargets.containsFlavors(cxxPlatformFlavorDomain))); FluentIterable<BuildTarget> watchTargets = targetsWithoutPlatformFlavors .filter(BuildTargets.containsFlavor(WATCH)).transform(input -> BuildTarget .builder(input.withoutFlavors(WATCH)).addFlavors(actualWatchFlavor).build()); targetsWithoutPlatformFlavors = targetsWithoutPlatformFlavors .filter(Predicates.not(BuildTargets.containsFlavor(WATCH))); // Gather all the deps now that we've added platform flavors to everything. depsExcludingBinary = targetsWithPlatformFlavors.append(watchTargets) .append(BuildTargets.propagateFlavorDomains(buildTarget, ImmutableSet.of(cxxPlatformFlavorDomain), targetsWithoutPlatformFlavors)); } // Propagate some flavors depsExcludingBinary = BuildTargets.propagateFlavorsInDomainIfNotPresent(StripStyle.FLAVOR_DOMAIN, buildTarget, depsExcludingBinary); depsExcludingBinary = BuildTargets.propagateFlavorsInDomainIfNotPresent(AppleDebugFormat.FLAVOR_DOMAIN, buildTarget, depsExcludingBinary); depsExcludingBinary = BuildTargets.propagateFlavorsInDomainIfNotPresent(LinkerMapMode.FLAVOR_DOMAIN, buildTarget, depsExcludingBinary); return ImmutableSet.copyOf(depsExcludingBinary); }
From source file:de.iteratec.iteraplan.businesslogic.exchange.xmi.importer.XmiImportServiceImpl.java
private void importEObjects(Map<IdEntity, EObject> createObjects) { final Map<EObject, IdEntity> eObjectsMap = getEObjectsMap(); persistCoreObjects(createObjects.values(), eObjectsMap); Set<String> relationClassNames = Sets.newHashSet("BusinessMapping", "Tcr2IeAssociation", "Isr2BoAssociation"); Predicate<EObject> relationsClassNamePredicate = new EObjectClassNamePredicate(relationClassNames); Iterable<EObject> relationsFiltered = Iterables.filter(createObjects.values(), relationsClassNamePredicate); List<EObject> relations = Lists.newArrayList(relationsFiltered); Predicate<EObject> nonRelationsClassNamePredicate = Predicates.not(relationsClassNamePredicate); Iterable<EObject> nonRelationsFiltered = Iterables.filter(createObjects.values(), nonRelationsClassNamePredicate); List<EObject> nonRelations = Lists.newArrayList(nonRelationsFiltered); final Map<IdEntity, EObject> objectToEObject = getEntityToEObjectMap(); persistBuildingBlocks(objectToEObject, eObjectsMap, nonRelations); setAllReferences(objectToEObject);// ww w . ja v a 2 s . com List<EObject> persistentObjectsRel = EntityClassStore.getPersistentObjects(relations); List<IdEntity> convertRel = EntityClassStore.convert(persistentObjectsRel, eObjectsMap); persistAssociationsWithoutAVA(convertRel); List<EObject> persistentObjects2 = EntityClassStore.getPersistentObjects(nonRelations); List<IdEntity> convert = EntityClassStore.convert(persistentObjects2, eObjectsMap); persistOrderedObjects(convert); savedQueriesHelper.update(objectToEObject); }
From source file:com.google.api.tools.framework.model.MessageType.java
/** * Returns all fields which are not oneof-scoped. *///from w w w .java 2 s . c o m public Iterable<Field> getNonOneofScopedFields() { return FluentIterable.from(fields).filter(Predicates.not(Field.IS_ONEOF_SCOPED)); }
From source file:io.fabric8.partition.internal.profile.ProfileTemplateWorker.java
/** * Creates a representation of the profile based on the assigned item for the specified {@linkTaskContext}. * @param context/*from w w w . j a v a2 s .co m*/ * @return */ private ProfileData createProfileData(TaskContext context) { ProfileData profileData = new ProfileData(); Set<WorkItem> workItems = assignedWorkItems.get(context); if (workItems.isEmpty()) { return profileData; } Container current = fabricService.get().getCurrentContainer(); Version version = current.getVersion(); String templateProfileName = String.valueOf(context.getConfiguration().get(TEMPLATE_PROFILE_PROPERTY_NAME)); Profile templateProfile = version.getProfile(templateProfileName); Set<String> allFiles = templateProfile.getFileConfigurations().keySet(); Iterable<String> mvelFiles = Iterables.filter(allFiles, MvelPredicate.INSTANCE); Iterable<String> plainFiles = Iterables.filter(allFiles, Predicates.not(MvelPredicate.INSTANCE)); for (String mvelFile : mvelFiles) { Key key = new Key(templateProfile.getId(), mvelFile); synchronized (templates) { CompiledTemplate template = templates.get(key); if (template == null) { template = TemplateCompiler.compileTemplate( new String(templateProfile.getFileConfigurations().get(mvelFile)), parserContext); templates.put(key, template); } } } for (WorkItem workItem : workItems) { Map<String, WorkItem> data = new HashMap<String, WorkItem>(); data.put(WorkItem.ITEM, workItem); //Render templates for (String fileTemplate : mvelFiles) { String file = renderTemplateName(fileTemplate, workItem); Key key = new Key(templateProfile.getId(), fileTemplate); try { String renderedTemplate = TemplateRuntime.execute(templates.get(key), parserContext, data) .toString(); updateProfileData(file, renderedTemplate, profileData); } catch (Exception ex) { LOGGER.warn("Failed to render {}. Ignoring.", fileTemplate); } } //Copy plain files. for (String file : plainFiles) { String content = new String(templateProfile.getFileConfigurations().get(file)); updateProfileData(file, content, profileData); } } return profileData; }
From source file:com.google.devtools.build.lib.rules.cpp.CppCompileActionBuilder.java
private Iterable<IncludeScannable> getLipoScannables(NestedSet<Artifact> realMandatoryInputs) { return lipoScannableMap == null ? ImmutableList.<IncludeScannable>of() : Iterables.filter(Iterables.transform( Iterables.filter(/*from ww w . j a va 2 s . com*/ FileType.filter(realMandatoryInputs, CppFileTypes.C_SOURCE, CppFileTypes.CPP_SOURCE, CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR), Predicates.not(Predicates.equalTo(getSourceFile()))), Functions.forMap(lipoScannableMap, null)), Predicates.notNull()); }
From source file:org.apache.aurora.scheduler.preemptor.PendingTaskProcessor.java
private List<TaskGroupKey> fetchIdlePendingGroups(StoreProvider store) { Multiset<TaskGroupKey> taskGroupCounts = HashMultiset .create(FluentIterable.from(store.getTaskStore().fetchTasks(Query.statusScoped(PENDING))) .filter(Predicates.and(isIdleTask, Predicates.not(hasCachedSlot))) .transform(Functions.compose(ASSIGNED_TO_GROUP_KEY, IScheduledTask::getAssignedTask))); return getPreemptionSequence(taskGroupCounts, reservationBatchSize); }