本文整理汇总了Java中org.gradle.api.specs.Spec.isSatisfiedBy方法的典型用法代码示例。如果您正苦于以下问题:Java Spec.isSatisfiedBy方法的具体用法?Java Spec.isSatisfiedBy怎么用?Java Spec.isSatisfiedBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.specs.Spec
的用法示例。
在下文中一共展示了Spec.isSatisfiedBy方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: partition
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
/**
* Partition given Collection into a Pair of Collections.
*
* <pre>Left</pre> Collection containing entries that satisfy the given predicate
* <pre>Right</pre> Collection containing entries that do NOT satisfy the given predicate
*/
public static <T> Pair<Collection<T>, Collection<T>> partition(Iterable<T> items, Spec<? super T> predicate) {
Preconditions.checkNotNull(items, "Cannot partition null Collection");
Preconditions.checkNotNull(predicate, "Cannot apply null Spec when partitioning");
Collection<T> left = new LinkedList<T>();
Collection<T> right = new LinkedList<T>();
for (T item : items) {
if (predicate.isSatisfiedBy(item)) {
left.add(item);
} else {
right.add(item);
}
}
return Pair.of(left, right);
}
示例2: exceedsThreshold
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private boolean exceedsThreshold(String pool, GarbageCollectionStats gcStats, Spec<GarbageCollectionStats> spec) {
if (isEnabled()
&& strategy != GarbageCollectorMonitoringStrategy.UNKNOWN
&& spec.isSatisfiedBy(gcStats)) {
if (gcStats.getUsage() > 0) {
LOGGER.debug(String.format("GC rate: %.2f/s %s usage: %s%%", gcStats.getRate(), pool, gcStats.getUsage()));
} else {
LOGGER.debug("GC rate: 0.0/s");
}
return true;
}
return false;
}
示例3: formatKnownTypes
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private String formatKnownTypes(Spec<ModelType<?>> constraints, Set<? extends ModelType<?>> supportedTypes) {
StringBuilder builder = new StringBuilder();
for (ModelType<?> supportedType : supportedTypes) {
if (constraints.isSatisfiedBy(supportedType)) {
if (builder.length() > 0) {
builder.append(", ");
}
builder.append(supportedType);
}
}
if (builder.length() == 0) {
return "(none)";
}
return builder.toString();
}
示例4: findAllMethodsInternal
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private static List<Method> findAllMethodsInternal(Class<?> target, Spec<Method> predicate, MultiMap<String, Method> seen, List<Method> collector, boolean stopAtFirst) {
for (final Method method : target.getDeclaredMethods()) {
List<Method> seenWithName = seen.get(method.getName());
Method override = CollectionUtils.findFirst(seenWithName, new Spec<Method>() {
public boolean isSatisfiedBy(Method potentionOverride) {
return potentionOverride.getName().equals(method.getName())
&& Arrays.equals(potentionOverride.getParameterTypes(), method.getParameterTypes());
}
});
if (override == null) {
seenWithName.add(method);
if (predicate.isSatisfiedBy(method)) {
collector.add(method);
if (stopAtFirst) {
return collector;
}
}
}
}
Class<?> parent = target.getSuperclass();
if (parent != null) {
return findAllMethodsInternal(parent, predicate, seen, collector, stopAtFirst);
}
return collector;
}
示例5: findFirst
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
public static <T> T findFirst(Iterable<? extends T> source, Spec<? super T> filter) {
for (T item : source) {
if (filter.isSatisfiedBy(item)) {
return item;
}
}
return null;
}
示例6: replace
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
public static <E> boolean replace(List<E> list, Spec<? super E> filter, Transformer<? extends E, ? super E> transformer) {
boolean replaced = false;
int i = 0;
for (E it : list) {
if (filter.isSatisfiedBy(it)) {
list.set(i, transformer.transform(it));
replaced = true;
}
++i;
}
return replaced;
}
示例7: every
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
public static <T> boolean every(Iterable<? extends T> things, Spec<? super T> predicate) {
for (T thing : things) {
if (!predicate.isSatisfiedBy(thing)) {
return false;
}
}
return true;
}
示例8: getDaemonsMatching
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private List<DaemonInfo> getDaemonsMatching(Spec<DaemonInfo> spec) {
lock.lock();
try {
List<DaemonInfo> out = new LinkedList<DaemonInfo>();
List<DaemonInfo> all = getAll();
for (DaemonInfo d : all) {
if (spec.isSatisfiedBy(d)) {
out.add(d);
}
}
return out;
} finally {
lock.unlock();
}
}
示例9: maybeFetch
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private <K, V extends Response<?>> V maybeFetch(String operationName, final PersistentIndexedCache<K, V> cache, final K key, Factory<V> factory, Spec<? super V> shouldFetch) {
V cachedValue = cacheAccess.useCache(operationName + " - read", new Factory<V>() {
public V create() {
return cache.get(key);
}
});
boolean fetch = cachedValue == null || shouldFetch.isSatisfiedBy(cachedValue);
if (fetch) {
return fetch(operationName, cache, key, factory);
} else {
return cachedValue;
}
}
示例10: getFirstLevelNodes
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private Set<DependencyGraphNodeResult> getFirstLevelNodes(Spec<? super Dependency> dependencySpec) {
Set<DependencyGraphNodeResult> matches = new LinkedHashSet<DependencyGraphNodeResult>();
TransientConfigurationResults graphResults = loadTransientGraphResults(selectedArtifacts);
for (Map.Entry<ModuleDependency, DependencyGraphNodeResult> entry : graphResults.getFirstLevelDependencies().entrySet()) {
if (dependencySpec.isSatisfiedBy(entry.getKey())) {
matches.add(entry.getValue());
}
}
return matches;
}
示例11: visitArtifacts
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
/**
* Recursive, includes unsuccessfully resolved artifacts
*
* @param dependencySpec dependency spec
*/
private void visitArtifacts(Spec<? super Dependency> dependencySpec, AttributeContainerInternal requestedAttributes, SelectedArtifactResults artifactResults, SelectedFileDependencyResults fileDependencyResults, ArtifactVisitor visitor) {
ArtifactVisitor transformingVisitor = artifactTransformer.visitor(visitor, requestedAttributes);
//this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends
//avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario
if (dependencySpec == Specs.SATISFIES_ALL) {
if (transformingVisitor.includeFiles()) {
fileDependencyResults.getFiles().visit(transformingVisitor);
}
artifactResults.getArtifacts().visit(transformingVisitor);
return;
}
if (transformingVisitor.includeFiles()) {
for (Map.Entry<FileCollectionDependency, ResolvedArtifactSet> entry: fileDependencyResults.getFirstLevelFiles().entrySet()) {
if (dependencySpec.isSatisfiedBy(entry.getKey())) {
entry.getValue().visit(transformingVisitor);
}
}
}
CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact> walker = new CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph(transformingVisitor, fileDependencyResults));
DependencyGraphNodeResult rootNode = loadTransientGraphResults(artifactResults).getRootNode();
for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
node.getArtifactsForIncomingEdge(rootNode).visit(transformingVisitor);
walker.add(node);
}
walker.findValues();
}
示例12: processRules
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
private boolean processRules(Collection<SpecRuleAction<? super ComponentSelection>> specRuleActions, Spec<SpecRuleAction<? super ComponentSelection>> filter, ComponentSelectionInternal selection, MetadataProvider metadataProvider) {
for (SpecRuleAction<? super ComponentSelection> rule : specRuleActions) {
if (filter.isSatisfiedBy(rule)) {
processRule(rule, selection, metadataProvider);
if (selection.isRejected()) {
LOGGER.info("Selection of {} rejected by component selection rule: {}", selection.getCandidate().getDisplayName(), selection.getRejectionReason());
return false;
}
}
}
return true;
}
示例13: findAll
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
public Set<T> findAll(Spec<? super T> constraint) {
Set<T> matches = new HashSet<T>();
for (T project : projects.values()) {
if (constraint.isSatisfiedBy(project)) {
matches.add(project);
}
}
return matches;
}
示例14: isAllowed
import org.gradle.api.specs.Spec; //导入方法依赖的package包/类
static boolean isAllowed(FileTreeElement element, Spec<? super FileTreeElement> spec) {
return spec.isSatisfiedBy(element);
}