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


Java EnumSet.containsAll方法代码示例

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


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

示例1: createNonRecursive

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
    EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize,
    Progressable progress) throws IOException {

  // Check if file should be appended or overwritten. Assume that the file
  // is overwritten on if the CREATE and OVERWRITE create flags are set. Note
  // that any other combinations of create flags will result in an open new or
  // open with append.
  final EnumSet<CreateFlag> createflags =
      EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE);
  boolean overwrite = flags.containsAll(createflags);

  // Delegate the create non-recursive call.
  return this.createNonRecursive(f, permission, overwrite,
      bufferSize, replication, blockSize, progress);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:NativeAzureFileSystem.java

示例2: assertSetOfTypesIsEqual

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Asserts the the set of rsa given are equal.
 *
 * @param message  A detail message to record if the assertion fails.
 * @param expected A list of expected condition rsa.
 * @param actual   A set of condition rsa to compare against the ones expected.
 */
public static void assertSetOfTypesIsEqual(
    final String message, final List<String> expected, final EnumSet<CryptoConditionType> actual
) {
  final EnumSet<CryptoConditionType> expectedSet = CryptoConditionType
      .getEnumOfTypesFromString(String.join(",", expected.toArray(new String[expected.size()])));

  if (!expectedSet.containsAll(actual)) {
    throw new AssertionError(message + " - expected does not contain all values from actual.");
  }
  expectedSet.removeAll(actual);
  if (!expectedSet.isEmpty()) {
    throw new AssertionError(message + " - expected contains values not in actual.");
  }
}
 
开发者ID:hyperledger,项目名称:quilt,代码行数:22,代码来源:CryptoConditionAssert.java

示例3: getTables

import java.util.EnumSet; //导入方法依赖的package包/类
private static List<OracleTable> getTables(Connection connection,
    String owner, String tableName, TableNameQueryType tableNameQueryType)
    throws SQLException {

  EnumSet<GetTablesOptions> options = EnumSet.noneOf(GetTablesOptions.class);

  if (owner != null && !owner.isEmpty()) {
    options.add(GetTablesOptions.Owner);
  }

  if (tableName != null && !tableName.isEmpty()) {
    options.add(GetTablesOptions.Table);
  }

  String sql =
      "SELECT owner, table_name " + " FROM dba_tables" + " %s %s %s %s "
          + " ORDER BY owner, table_name";

  String tableComparitor = null;
  switch (tableNameQueryType) {
    case Equals:
      tableComparitor = "=";
      break;
    case Like:
      tableComparitor = "LIKE";
      break;
    default:
      throw new RuntimeException("Operator not implemented.");
  }

  sql =
      String.format(sql, options.isEmpty() ? "" : "WHERE", options
          .contains(GetTablesOptions.Owner) ? "owner = ?" : "", options
          .containsAll(EnumSet.of(GetTablesOptions.Owner,
              GetTablesOptions.Table)) ? "AND" : "", options
          .contains(GetTablesOptions.Table) ? String.format(
          "table_name %s ?", tableComparitor) : "");

  PreparedStatement statement = connection.prepareStatement(sql);

  if (options.containsAll(EnumSet.of(GetTablesOptions.Owner,
      GetTablesOptions.Table))) {
    statement.setString(1, owner);
    statement.setString(2, tableName);
  } else {
    if (options.contains(GetTablesOptions.Owner)) {
      statement.setString(1, owner);
    } else if (options.contains(GetTablesOptions.Table)) {
      statement.setString(1, tableName);
    }
  }

  ResultSet resultSet = statement.executeQuery();

  ArrayList<OracleTable> result = new ArrayList<OracleTable>();
  while (resultSet.next()) {
    result.add(new OracleTable(resultSet.getString("owner"), resultSet
        .getString("table_name")));
  }

  resultSet.close();
  statement.close();

  return result;
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:66,代码来源:OraOopOracleQueries.java

示例4: check

import java.util.EnumSet; //导入方法依赖的package包/类
void check(Result<?> res) {

        EnumSet<WarningKind> foundWarnings = EnumSet.noneOf(WarningKind.class);
        for (Diagnostic.Kind kind : new Kind[] { Kind.ERROR, Kind.MANDATORY_WARNING, Kind.WARNING}) {
            for (Diagnostic<? extends JavaFileObject> diag : res.diagnosticsForKind(kind)) {
                for (WarningKind wk : WarningKind.values()) {
                    if (wk.code.equals(diag.getCode())) {
                        foundWarnings.add(wk);
                    }
                }
            }
        }

        EnumSet<WarningKind> expectedWarnings =
                EnumSet.noneOf(WarningKind.class);

        if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 &&
                trustMe == TrustMe.TRUST &&
                suppressLevel != SuppressLevel.VARARGS &&
                xlint != XlintOption.NONE &&
                sig.isVarargs &&
                !sig.isReifiableArg &&
                body.hasAliasing &&
                (methKind == MethodKind.CONSTRUCTOR ||
                (methKind == MethodKind.METHOD &&
                 modKind == ModifierKind.FINAL || modKind == ModifierKind.STATIC ||
                 (modKind == ModifierKind.PRIVATE && sourceLevel.compareTo(SourceLevel.JDK_9) >= 0)))) {
            expectedWarnings.add(WarningKind.UNSAFE_BODY);
        }

        if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 &&
                trustMe == TrustMe.DONT_TRUST &&
                sig.isVarargs &&
                !sig.isReifiableArg &&
                xlint == XlintOption.ALL) {
            expectedWarnings.add(WarningKind.UNSAFE_DECL);
        }

        if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 &&
                trustMe == TrustMe.TRUST &&
                (!sig.isVarargs ||
                 ((modKind == ModifierKind.NONE ||
                 modKind == ModifierKind.PRIVATE && sourceLevel.compareTo(SourceLevel.JDK_9) < 0 ) &&
                 methKind == MethodKind.METHOD))) {
            expectedWarnings.add(WarningKind.MALFORMED_SAFEVARARGS);
        }

        if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 &&
                trustMe == TrustMe.TRUST &&
                xlint != XlintOption.NONE &&
                suppressLevel != SuppressLevel.VARARGS &&
                (modKind == ModifierKind.FINAL || modKind == ModifierKind.STATIC ||
                 (modKind == ModifierKind.PRIVATE && sourceLevel.compareTo(SourceLevel.JDK_9) >= 0) ||
                 methKind == MethodKind.CONSTRUCTOR) &&
                sig.isVarargs &&
                sig.isReifiableArg) {
            expectedWarnings.add(WarningKind.REDUNDANT_SAFEVARARGS);
        }

        if (!expectedWarnings.containsAll(foundWarnings) ||
                !foundWarnings.containsAll(expectedWarnings)) {
            fail("invalid diagnostics for source:\n" +
                    res.compilationInfo() +
                    "\nOptions: " + xlint.getXlintOption() +
                    "\nSource Level: " + sourceLevel +
                    "\nExpected warnings: " + expectedWarnings +
                    "\nFound warnings: " + foundWarnings);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:70,代码来源:Warn5.java


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