本文整理汇总了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;
}
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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());
}
}
示例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));
}
示例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);
}
}
示例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()));
}
}
}
示例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)));
}
示例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;
}
示例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);
}
示例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));
}
示例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;
}