当前位置: 首页>>代码示例>>Java>>正文


Java Predicates.alwaysTrue方法代码示例

本文整理汇总了Java中com.google.common.base.Predicates.alwaysTrue方法的典型用法代码示例。如果您正苦于以下问题:Java Predicates.alwaysTrue方法的具体用法?Java Predicates.alwaysTrue怎么用?Java Predicates.alwaysTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.base.Predicates的用法示例。


在下文中一共展示了Predicates.alwaysTrue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testConcatIntersectionType

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
 * This test passes if the {@code concat(…).filter(…).filter(…)} statement at the end compiles.
 * That statement compiles only if {@link FluentIterable#concat concat(aIterable, bIterable)}
 * returns a {@link FluentIterable} of elements of an anonymous type whose supertypes are the
 * <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.9">intersection</a>
 * of the supertypes of {@code A} and the supertypes of {@code B}.
 */
public void testConcatIntersectionType() {
  Iterable<A> aIterable = ImmutableList.of();
  Iterable<B> bIterable = ImmutableList.of();

  Predicate<X> xPredicate = Predicates.alwaysTrue();
  Predicate<Y> yPredicate = Predicates.alwaysTrue();

  FluentIterable<?> unused =
      FluentIterable.concat(aIterable, bIterable).filter(xPredicate).filter(yPredicate);

  /* The following fails to compile:
   *
   * The method append(Iterable<? extends FluentIterableTest.A>) in the type
   * FluentIterable<FluentIterableTest.A> is not applicable for the arguments
   * (Iterable<FluentIterableTest.B>)
   */
  // FluentIterable.from(aIterable).append(bIterable);

  /* The following fails to compile:
   *
   * The method filter(Predicate<? super Object>) in the type FluentIterable<Object> is not
   * applicable for the arguments (Predicate<FluentIterableTest.X>)
   */
  // FluentIterable.of().append(aIterable).append(bIterable).filter(xPredicate);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:33,代码来源:FluentIterableTest.java

示例2: OIDCCoreProtocolConfiguration

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
 * Creates a new configuration instance.
 *
 * @param profileId Unique profile identifier.
 */
public OIDCCoreProtocolConfiguration(@Nonnull @NotEmpty final String profileId) {
    super(profileId);
    authenticationFlows = Collections.emptySet();
    postAuthenticationFlows = Collections.emptyList();
    defaultAuthenticationContexts = Collections.emptyList();
    nameIDFormatPrecedence = Collections.emptyList();
    signIDTokensPredicate = Predicates.alwaysTrue();
    pairwiseSubject = Predicates.alwaysFalse();
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:15,代码来源:OIDCCoreProtocolConfiguration.java

示例3: getDocIdFilter

import com.google.common.base.Predicates; //导入方法依赖的package包/类
private static Predicate<Symbol> getDocIdFilter(Parameters params) throws IOException {
  if (params.isPresent(RESTRICT_TO_THESE_DOCS)) {
    final File docIDsFile = params.getExistingFile(RESTRICT_TO_THESE_DOCS);
    final ImmutableList<String> docIDsToImport = Files.asCharSource(docIDsFile,
        Charsets.UTF_8).readLines();
    log.info("Restricting import to {} document IDs in {}",
        docIDsToImport.size(), docIDsFile);
    return in(SymbolUtils.setFrom(docIDsToImport));
  } else {
    return Predicates.alwaysTrue();
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:13,代码来源:ImportSystemOutputToAnnotationStore.java

示例4: NodeFilters

import com.google.common.base.Predicates; //导入方法依赖的package包/类
NodeFilters(@Nullable String name, @Nullable String id) {
    if (name == null && id == null) {
        innerPredicate = Predicates.alwaysTrue();
    } else {
        Predicate<DiscoveryNode> namesPredicate = name == null ? Predicates.<DiscoveryNode>alwaysTrue() : new NamesPredicate(name);
        Predicate<DiscoveryNode> idsPredicate = id == null ? Predicates.<DiscoveryNode>alwaysTrue() : new IdsPredicate(id);
        innerPredicate = Predicates.and(namesPredicate, idsPredicate);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:NodeFilters.java

示例5: discoveryNodePredicate

import com.google.common.base.Predicates; //导入方法依赖的package包/类
private static Predicate<DiscoveryNode> discoveryNodePredicate(Object[] parameters, @Nullable Expression nodeFiltersExpression) {
    if (nodeFiltersExpression == null) {
        return Predicates.alwaysTrue();
    }
    Object nodeFiltersObj = ExpressionToObjectVisitor.convert(nodeFiltersExpression, parameters);
    try {
        return NodeFilters.fromMap((Map) nodeFiltersObj);
    } catch (ClassCastException e) {
        throw new IllegalArgumentException(String.format(Locale.ENGLISH,
                "Invalid parameter passed to %s. Expected an object with name or id keys and string values. Got '%s'",
                NodeFilters.NAME, nodeFiltersObj));
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:CopyStatementAnalyzer.java

示例6: build

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
 * Builds a classifier based on previous allow/match decisions.
 * This may be reused after a call to build and subsequent calls to
 * allow/match methods will not affect previously built classifiers.
 */
public AuthorityClassifier build() {
  ImmutableSet<Inet4Address> ipv4Set = ipv4s.build();
  ImmutableSet<Inet6Address> ipv6Set = ipv6s.build();
  ImmutableSet<InternetDomainName> domainNameSet = domainNames.build();
  HostGlobMatcher hostGlobMatcher = new HostGlobMatcher(hostGlobs.build());
  int[] allowedPortsSorted;
  {
    ImmutableSet<Integer> allowedPortIntSet = allowedPorts.build();
    int n = allowedPortIntSet.size();
    allowedPortsSorted = new int[n];
    Iterator<Integer> allowedPortIt = allowedPortIntSet.iterator();
    for (int i = 0; i < n; ++i) {
      allowedPortsSorted[i] = allowedPortIt.next();
    }
    Arrays.sort(allowedPortsSorted);
  }
  Predicate<? super Integer> portClassifier =
      allowedPortsSorted.length == 0  // No exclusion specified
      ? Predicates.alwaysTrue()
      : Predicates.alwaysFalse();
  if (this.allowedPortClassifier != null) {
    portClassifier = this.allowedPortClassifier;
  }
  UserInfoClassifier userInfoClassifier =
      this.allowedUserInfoClassifier != null
      ? this.allowedUserInfoClassifier
      : UserInfoClassifiers.NO_PASSWORD_BUT_USERNAME_IF_ALLOWED_BY_SCHEME;
  return new AuthorityClassifierImpl(
      ipv4Set,
      ipv6Set,
      domainNameSet,
      hostGlobMatcher,
      matchesAnyHost,
      allowedPortsSorted,
      portClassifier,
      userInfoClassifier);
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:43,代码来源:AuthorityClassifierBuilder.java

示例7: all

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public static Predicate<MutableModelNode> all() {
    return Predicates.alwaysTrue();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:ModelNodes.java

示例8: createExtended

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/** This is useful if you want to use a particular class for this property, but don't care what the class contains
 * (it will never contain an incorrect value) */
public static <T extends Comparable<T>> BuildCraftExtendedProperty<T> createExtended(String name, Class clazz) {
    return new BuildCraftExtendedProperty<T>(name, clazz, Predicates.<T> alwaysTrue());
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:6,代码来源:BuildCraftExtendedProperty.java

示例9: EntityAIAvoidEntity

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public EntityAIAvoidEntity(EntityCreature p_i46404_1_, Class<T> p_i46404_2_, float p_i46404_3_, double p_i46404_4_, double p_i46404_6_)
{
    this(p_i46404_1_, p_i46404_2_, Predicates.<T>alwaysTrue(), p_i46404_3_, p_i46404_4_, p_i46404_6_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:EntityAIAvoidEntity.java

示例10: convertCopyFrom

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public CopyFromAnalyzedStatement convertCopyFrom(CopyFrom node, Analysis analysis) {
    analysis.expectsAffectedRows(true);

    DocTableInfo tableInfo = analysisMetaData.schemas().getWritableTable(
            TableIdent.of(node.table(), analysis.parameterContext().defaultSchema()));
    DocTableRelation tableRelation = new DocTableRelation(tableInfo);

    // Add SQL Authentication
    // GaoPan 2016/06/16
    AuthResult authResult = AuthService.sqlAuthenticate(analysis.parameterContext().getLoginUserContext(),
            tableInfo.ident().schema(), tableInfo.ident().name(), PrivilegeType.READ_ONLY);
    if (authResult.getStatus() != RestStatus.OK) {
        throw new NoPermissionException(authResult.getStatus().getStatus(), authResult.getMessage());
    }

    String partitionIdent = null;
    if (!node.table().partitionProperties().isEmpty()) {
        partitionIdent = PartitionPropertiesAnalyzer.toPartitionIdent(
                tableInfo,
                node.table().partitionProperties(),
                analysis.parameterContext().parameters());
    }

    Context context = new Context(analysisMetaData, analysis.parameterContext(), tableRelation, true);
    Predicate<DiscoveryNode> nodeFilters = Predicates.alwaysTrue();
    Settings settings = Settings.EMPTY;
    if (node.genericProperties().isPresent()) {
        // copy map as items are removed. The GenericProperties map is cached in the query cache and removing
        // items would cause subsequent queries that hit the cache to have different genericProperties
        Map<String, Expression> properties = new HashMap<>(node.genericProperties().get().properties());
        nodeFilters = discoveryNodePredicate(analysis.parameterContext().parameters(), properties.remove(NodeFilters.NAME));
        settings = settingsFromProperties(properties, context.expressionAnalyzer, context.expressionAnalysisContext);
    }
    Symbol uri = context.processExpression(node.path());

    if (!(uri.valueType() == DataTypes.STRING ||
         uri.valueType() instanceof CollectionType && ((CollectionType) uri.valueType()).innerType() == DataTypes.STRING)) {
        throw CopyFromAnalyzedStatement.raiseInvalidType(uri.valueType());
    }

    return new CopyFromAnalyzedStatement(tableInfo, settings, uri, partitionIdent, nodeFilters);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:43,代码来源:CopyStatementAnalyzer.java

示例11: build

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
 * Builds a classifier based on previous allow/match decisions.
 * This may be reused after a call to build and subsequent calls to
 * allow/match methods will not affect previously built classifiers.
 */
public QueryClassifier build() {
  ImmutableSet<String> mayKeySet = mayKeys.build();
  Predicate<? super String> mayKeyClassifier;
  if (mayClassifier != null) {
    mayKeyClassifier = mayClassifier;
  } else if (mayKeySet.isEmpty()) {
      // If nothing specified, assume permissive.
    mayKeyClassifier = Predicates.alwaysTrue();
  } else {
    // If a set specified, defer to the set.
    mayKeyClassifier = Predicates.<String>alwaysFalse();
  }

  ImmutableSet<String> onceKeySet = onceKeys.build();
  Predicate<? super String> onceKeyClassifier;
  if (onceClassifier != null) {
    onceKeyClassifier = onceClassifier;
  } else {
    onceKeyClassifier = Predicates.<String>alwaysFalse();
  }

  ImmutableSet<String> mustKeySet = mustKeys.build();
  ImmutableMap<String, Predicate<? super Optional<String>>> valueClassifierMap =
      ImmutableMap.copyOf(valueClassifiers);

  // If something may appear once or must appear, then it may appear.
  if (!Predicates.alwaysTrue().equals(mayKeyClassifier)) {
    if (!Predicates.alwaysFalse().equals(onceKeyClassifier)) {
      mayKeyClassifier = Predicates.or(mayKeyClassifier, onceKeyClassifier);
    }
    mayKeySet = ImmutableSet.<String>builder()
        .addAll(mayKeySet)
        .addAll(onceKeySet)
        .addAll(mustKeySet)
        .build();
  }

  return new QueryClassifierImpl(
      mayKeySet,
      mayKeyClassifier,
      onceKeySet,
      onceKeyClassifier,
      mustKeySet,
      valueClassifierMap);
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:51,代码来源:QueryClassifierBuilder.java

示例12: EntityAIAvoidEntity

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public EntityAIAvoidEntity(EntityCreature theEntityIn, Class<T> classToAvoidIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn)
{
    this(theEntityIn, classToAvoidIn, Predicates.<T>alwaysTrue(), avoidDistanceIn, farSpeedIn, nearSpeedIn);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:EntityAIAvoidEntity.java

示例13: PropertyFloat

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public PropertyFloat(String name)
{
    this(name, Predicates.<Float>alwaysTrue());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:PropertyFloat.java


注:本文中的com.google.common.base.Predicates.alwaysTrue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。