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


Java EnumSet.contains方法代码示例

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


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

示例1: handleAsyncUpgradeSubscription

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Sets subscription status and informs the technical service about the
 * changed parameter set when asynchronously upgrade subscription.
 * 
 * @param subscription
 *            the subscription to update
 * @param targetProduct
 *            the target product owned by the subscription
 * @throws TechnicalServiceNotAliveException
 * @throws TechnicalServiceOperationException
 */
void handleAsyncUpgradeSubscription(Subscription subscription,
        Product targetProduct) throws TechnicalServiceNotAliveException,
        TechnicalServiceOperationException {
    EnumSet<SubscriptionStatus> set = EnumSet.of(SubscriptionStatus.ACTIVE,
            SubscriptionStatus.EXPIRED, SubscriptionStatus.SUSPENDED);
    SubscriptionStatus status = subscription.getStatus();
    if (set.contains(status)) {
        appManager.asyncUpgradeSubscription(subscription, targetProduct);
        switch (status) {
        case ACTIVE:
            subscription.setStatus(SubscriptionStatus.PENDING_UPD);
            break;
        case SUSPENDED:
            subscription.setStatus(SubscriptionStatus.SUSPENDED_UPD);
            break;
        case EXPIRED:
        default:
            break;
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:33,代码来源:SubscriptionServiceBean.java

示例2: checkOperationAllowed

import java.util.EnumSet; //导入方法依赖的package包/类
private void checkOperationAllowed(Subscription sub,
        EnumSet<SubscriptionStatus> set) throws SubscriptionStateException {
    try {
        if (set.contains(sub.getStatus())) {
            SubscriptionStateException sse = new SubscriptionStateException(
                    SubscriptionStateException.Reason.SUBSCRIPTION_INVALID_STATE,
                    null, new Object[] { sub.getStatus() });

            LOG.logWarn(Log4jLogger.SYSTEM_LOG, sse,
                    LogMessageIdentifier.WARN_SUBSCRIPTION_STATE_INVALID,
                    sub.getStatus().name());
            throw sse;
        }
    } catch (SubscriptionStateException e) {
        sessionCtx.setRollbackOnly();
        throw e;
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:19,代码来源:ValidateSubscriptionStateBean.java

示例3: startSame

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Internal method to see if <start,*> values are all the same.
 */
@SuppressWarnings("unused")
StandardPlural startSame(StandardPlural start,
        EnumSet<StandardPlural> endDone, Output<Boolean> emit) {
    emit.value = false;
    StandardPlural first = null;
    for (StandardPlural end : StandardPlural.VALUES) {
        StandardPlural item = get(start, end);
        if (item == null) {
            continue;
        }
        if (first == null) {
            first = item;
            continue;
        }
        if (first != item) {
            return null;
        }
        // only emit if we didn't cover with the 'end' values
        if (!endDone.contains(end)) {
            emit.value = true;
        }
    }
    return first;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:28,代码来源:PluralRanges.java

示例4: parse

import java.util.EnumSet; //导入方法依赖的package包/类
static EnumSet<FileAttribute> parse(String s) {
  if (s == null || s.length() == 0) {
    return EnumSet.allOf(FileAttribute.class);
  }

  EnumSet<FileAttribute> set = EnumSet.noneOf(FileAttribute.class);
  FileAttribute[] attributes = values();
  for(char c : s.toCharArray()) {
    int i = 0;
    for(; i < attributes.length && c != attributes[i].symbol; i++);
    if (i < attributes.length) {
      if (!set.contains(attributes[i])) {
        set.add(attributes[i]);
      } else {
        throw new IllegalArgumentException("There are more than one '"
            + attributes[i].symbol + "' in " + s); 
      }
    } else {
      throw new IllegalArgumentException("'" + c + "' in " + s
          + " is undefined.");
    }
  }
  return set;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:DistCpV1.java

示例5: clearLocalPkg

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Clear the tracked visited folders & the cached {@link LocalPkgInfo} for the
 * given filter types.
 *
 * @param filters A set of PkgType constants or {@link PkgType#PKG_ALL} to clear everything.
 */
public void clearLocalPkg(@NonNull EnumSet<PkgType> filters) {
    mLegacyBuildTools = null;

    synchronized (mLocalPackages) {
        for (PkgType filter : filters) {
            mVisitedDirs.removeAll(filter);
            mLocalPackages.removeAll(filter);
        }
    }

    // Clear the targets if the platforms or addons are being cleared
    if (filters.contains(PkgType.PKG_PLATFORM) ||  filters.contains(PkgType.PKG_ADDON)) {
      mReloadTargets = true;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:22,代码来源:LocalSdk.java

示例6: getClientMmap

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Get or create a memory map for this replica.
 * 
 * There are two kinds of ClientMmap objects we could fetch here: one that 
 * will always read pre-checksummed data, and one that may read data that
 * hasn't been checksummed.
 *
 * If we fetch the former, "safe" kind of ClientMmap, we have to increment
 * the anchor count on the shared memory slot.  This will tell the DataNode
 * not to munlock the block until this ClientMmap is closed.
 * If we fetch the latter, we don't bother with anchoring.
 *
 * @param opts     The options to use, such as SKIP_CHECKSUMS.
 * 
 * @return         null on failure; the ClientMmap otherwise.
 */
@Override
public ClientMmap getClientMmap(EnumSet<ReadOption> opts) {
  boolean anchor = verifyChecksum &&
      (opts.contains(ReadOption.SKIP_CHECKSUMS) == false);
  if (anchor) {
    if (!createNoChecksumContext()) {
      if (LOG.isTraceEnabled()) {
        LOG.trace("can't get an mmap for " + block + " of " + filename + 
            " since SKIP_CHECKSUMS was not given, " +
            "we aren't skipping checksums, and the block is not mlocked.");
      }
      return null;
    }
  }
  ClientMmap clientMmap = null;
  try {
    clientMmap = replica.getOrCreateClientMmap(anchor);
  } finally {
    if ((clientMmap == null) && anchor) {
      releaseNoChecksumContext();
    }
  }
  return clientMmap;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:BlockReaderLocal.java

示例7: updateDestStatus

import java.util.EnumSet; //导入方法依赖的package包/类
private static void updateDestStatus(FileStatus src, FileStatus dst,
    EnumSet<FileAttribute> preseved, FileSystem destFileSys
    ) throws IOException {
  String owner = null;
  String group = null;
  if (preseved.contains(FileAttribute.USER)
      && !src.getOwner().equals(dst.getOwner())) {
    owner = src.getOwner();
  }
  if (preseved.contains(FileAttribute.GROUP)
      && !src.getGroup().equals(dst.getGroup())) {
    group = src.getGroup();
  }
  if (owner != null || group != null) {
    destFileSys.setOwner(dst.getPath(), owner, group);
  }
  if (preseved.contains(FileAttribute.PERMISSION)
      && !src.getPermission().equals(dst.getPermission())) {
    destFileSys.setPermission(dst.getPath(), src.getPermission());
  }
  if (preseved.contains(FileAttribute.TIMES)) {
    destFileSys.setTimes(dst.getPath(), src.getModificationTime(), src.getAccessTime());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:DistCpV1.java

示例8: inferNaming

import java.util.EnumSet; //导入方法依赖的package包/类
private Naming inferNaming(Element element, EnumSet<Tag> tags, AtomicReference<StandardNaming> standardNaming) {
  Optional<NamingMirror> namingAnnotation = NamingMirror.find(element);
  if (namingAnnotation.isPresent()) {
    try {
      NamingMirror mirror = namingAnnotation.get();
      Naming naming = Naming.from(mirror.value());
      if (mirror.depluralize()) {
        tags.add(Tag.DEPLURALIZE);
      }
      standardNaming.set(mirror.standard());
      return naming;
    } catch (IllegalArgumentException ex) {
      reporter.withElement(element)
          .annotationNamed(NamingMirror.simpleName())
          .error(ex.getMessage());
    }
  }
  if (element.getKind() == ElementKind.FIELD
      || (element.getKind() == ElementKind.METHOD
      && (element.getModifiers().contains(Modifier.PRIVATE) || tags.contains(Tag.PRIVATE)))) {
    return helperNaming(element.getSimpleName());
  }
  if (tags.contains(Tag.INIT) || tags.contains(Tag.COPY)) {
    return Naming.identity();
  }
  String encodedMethodName = element.getSimpleName().toString();
  return Naming.from("*" + Naming.Usage.CAPITALIZED.apply(encodedMethodName));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:Encodings.java

示例9: MBJointClip

import java.util.EnumSet; //导入方法依赖的package包/类
public MBJointClip(boolean loop, ImmutableList<MBVariableClip> variables)
{
    this.loop = loop;
    this.variables = variables;
    EnumSet<Variable> hadVar = Sets.newEnumSet(Collections.<Variable>emptyList(), Variable.class);
    for(MBVariableClip var : variables)
    {
        if(hadVar.contains(var.variable))
        {
            throw new IllegalArgumentException("duplicate variable: " + var);
        }
        hadVar.add(var.variable);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:ModelBlockAnimation.java

示例10: ResourcesRequestedMatcher

import java.util.EnumSet; //导入方法依赖的package包/类
ResourcesRequestedMatcher(Map<String, LocalResource> allResources,
    EnumSet<LocalResourceVisibility> vis) throws URISyntaxException {
  for (Entry<String, LocalResource> e : allResources.entrySet()) {
    if (vis.contains(e.getValue().getVisibility())) {
      resources.add(new LocalResourceRequest(e.getValue()));
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestContainer.java

示例11: open

import java.util.EnumSet; //导入方法依赖的package包/类
public OutputStream open(String path, EnumSet<CreateFlag> flags, 
			short mode, boolean recursive, int bufsize,
			long stripeSize, int stripeCount, int stripeOffset, 
			String poolName) throws IOException {

	int nFlags = NativeIO.POSIX.O_WRONLY;	
	nFlags |= flags.contains(CreateFlag.CREATE) ? NativeIO.POSIX.O_CREAT : 0;
	nFlags |= flags.contains(CreateFlag.OVERWRITE) ? NativeIO.POSIX.O_TRUNC : 0;
	nFlags |= flags.contains(CreateFlag.APPEND) ? NativeIO.POSIX.O_APPEND : 0;
		
//    return new AsyncFileOutputStream(open(path,nFlags, mode, 
//    	stripeSize, stripeCount, stripeOffset, poolName), bufsize);
	return new BufferedOutputStream(new FileOutputStream(open(path,nFlags, mode, 
		stripeSize, stripeCount, stripeOffset, poolName)));
  }
 
开发者ID:intel-hpdd,项目名称:lustre-connector-for-hadoop,代码行数:16,代码来源:LustreFsNativeImpl.java

示例12: getChecksumOpt

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * @return the checksum spec of the source checksum if checksum type should be
 *         preserved
 */
private ChecksumOpt getChecksumOpt(EnumSet<FileAttribute> fileAttributes,
    FileChecksum sourceChecksum) {
  if (fileAttributes.contains(FileAttribute.CHECKSUMTYPE)
      && sourceChecksum != null) {
    return sourceChecksum.getChecksumOpt();
  }
  return null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:RetriableFileCopyCommand.java

示例13: accept

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public synchronized boolean accept(CodeTemplate template) {
    if (treeKindCtx == null && stringCtx == null) {
        return false;
    }
    EnumSet<Tree.Kind> treeKindContexts = EnumSet.noneOf(Tree.Kind.class);
    HashSet stringContexts = new HashSet();
    getTemplateContexts(template, treeKindContexts, stringContexts);
    return treeKindContexts.isEmpty() && stringContexts.isEmpty() && treeKindCtx != Tree.Kind.STRING_LITERAL || treeKindContexts.contains(treeKindCtx) || stringContexts.contains(stringCtx);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:JavaCodeTemplateFilter.java

示例14: EhloResponse

import java.util.EnumSet; //导入方法依赖的package包/类
private EhloResponse(String ehloDomain, Iterable<CharSequence> lines, EnumSet<Extension> disabledExtensions) {
  this.ehloDomain = ehloDomain;
  this.extensions = EnumSet.noneOf(Extension.class);

  for (CharSequence line : lines) {
    List<String> parts = WHITESPACE_SPLITTER.splitToList(line);

    Optional<Extension> ext = Extension.find(parts.get(0));
    if (ext.isPresent()) {
      if (disabledExtensions.contains(ext.get())) {
        continue;
      }

      extensions.add(ext.get());
    }

    switch (parts.get(0).toLowerCase()) {
      case "auth":
        parseAuth(parts);
        break;
      case "size":
        parseSize(parts);
        break;
      default:
        break;
    }
  }

  supportedExtensions = ImmutableSet.copyOf(Iterables.transform(lines, CharSequence::toString));
}
 
开发者ID:HubSpot,项目名称:NioSmtpClient,代码行数:31,代码来源:EhloResponse.java

示例15: calculateSubtypes

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Determines the set of condition rsa that are ultimately held via the sub condition.
 *
 * @param subcondition The sub condition that this condition depends on.
 *
 * @return The set of condition rsa related to the sub condition.
 */
private static EnumSet<CryptoConditionType> calculateSubtypes(Condition subcondition) {
  EnumSet<CryptoConditionType> subtypes = EnumSet.of(subcondition.getType());
  if (subcondition instanceof CompoundCondition) {
    subtypes.addAll(((CompoundCondition) subcondition).getSubtypes());
  }

  // Remove our own type
  if (subtypes.contains(PREFIX_SHA256)) {
    subtypes.remove(PREFIX_SHA256);
  }

  return subtypes;
}
 
开发者ID:hyperledger,项目名称:quilt,代码行数:21,代码来源:PrefixSha256Condition.java


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