java.util.EnumSet.contains()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(13.4k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中java.util.EnumSet.contains()方法的一些代码示例,展示了EnumSet.contains()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EnumSet.contains()方法的具体详情如下:
包路径:java.util.EnumSet
类名称:EnumSet
方法名:contains

EnumSet.contains介绍

暂无

代码示例

代码示例来源:origin: apache/hive

public final void setReducerTraits(EnumSet<ReducerTraits> traits) {
 // we don't allow turning on auto parallel once it has been
 // explicitly turned off. That is to avoid scenarios where
 // auto parallelism could break assumptions about number of
 // reducers or hash function.
 boolean wasUnset = this.reduceTraits.remove(ReducerTraits.UNSET);
 if (this.reduceTraits.contains(ReducerTraits.FIXED)) {
  return;
 } else if (traits.contains(ReducerTraits.FIXED)) {
  this.reduceTraits.removeAll(EnumSet.of(
    ReducerTraits.AUTOPARALLEL,
    ReducerTraits.UNIFORM));
  this.reduceTraits.addAll(traits);
 } else {
  this.reduceTraits.addAll(traits);
 }
}

代码示例来源:origin: btraceio/btrace

@Override
public int getInstrClasses() {
  return EnumSet.of(State.INSTRUMENTING, State.RUNNING).contains(getState()) ? numInstrClasses : -1;
}

代码示例来源:origin: plantuml/plantuml

private List<Shape> getShapesEntryExit(EnumSet<EntityPosition> positions) {
  final List<Shape> result = new ArrayList<Shape>();
  for (final Iterator<Shape> it = shapes.iterator(); it.hasNext();) {
    final Shape sh = it.next();
    if (positions.contains(sh.getEntityPosition())) {
      result.add(sh);
    }
  }
  return result;
}

代码示例来源:origin: apache/hive

rules.add(HiveFilterProjectTransposeRule.INSTANCE_DETERMINISTIC_WINDOWING);
} else {
 rules.add(HiveFilterProjectTransposeRule.INSTANCE_DETERMINISTIC);
rules.add(HiveFilterSetOpTransposeRule.INSTANCE);
rules.add(HiveFilterSortTransposeRule.INSTANCE);
rules.add(HiveFilterJoinRule.JOIN);
rules.add(HiveProjectJoinTransposeRule.INSTANCE);
if (conf.getBoolVar(HiveConf.ConfVars.HIVE_OPTIMIZE_CONSTRAINTS_JOIN) &&
  profilesCBO.contains(ExtendedCBOProfile.REFERENTIAL_CONSTRAINTS)) {
 rules.add(HiveJoinConstraintsRule.INSTANCE);
perfLogger.PerfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER);
basePlan = hepPlan(basePlan, true, mdProvider, executorProvider, HepMatchOrder.BOTTOM_UP,
    rules.toArray(new RelOptRule[rules.size()]));
perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER,
 "Calcite: Prejoin ordering transformation, PPD, not null predicates, transitive inference, constant folding");
HiveRelFieldTrimmer fieldTrimmer = new HiveRelFieldTrimmer(null,
  HiveRelFactories.HIVE_BUILDER.create(cluster, null),
  profilesCBO.contains(ExtendedCBOProfile.JOIN_REORDERING));
basePlan = fieldTrimmer.trim(basePlan);
perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER,

代码示例来源:origin: runelite/runelite

worldIdx = worlds.size() - 1;
  if (worldIdx >= worlds.size())
if (types.contains(WorldType.SKILL_TOTAL))

代码示例来源:origin: graphhopper/graphhopper

private List<Trip.Leg> parsePathIntoLegs(List<Label.Transition> path, GraphExplorer graph, Weighting weighting, Translation tr) {
  if (path.size() <= 1) {
    return Collections.emptyList();
    long boardTime = -1;
    List<Label.Transition> partition = null;
    for (int i = 1; i < path.size(); i++) {
      Label.Transition transition = path.get(i);
      Label.EdgeLabel edge = path.get(i).edge;
        partition.add(path.get(i));
      if (EnumSet.of(GtfsStorage.EdgeType.TRANSFER, GtfsStorage.EdgeType.LEAVE_TIME_EXPANDED_NETWORK).contains(edge.edgeType)) {
        Geometry lineString = lineStringFromEdges(partition);
        GtfsRealtime.TripDescriptor tripDescriptor;
            .filter(e -> EnumSet.of(GtfsStorage.EdgeType.HOP, GtfsStorage.EdgeType.BOARD, GtfsStorage.EdgeType.DWELL).contains(e.edge.edgeType))
            .forEach(stopsFromBoardHopDwellEdges::next);
        stopsFromBoardHopDwellEdges.finish();
        List<Trip.Stop> stops = stopsFromBoardHopDwellEdges.stops;
        result.add(new Trip.PtLeg(
            feedIdWithTimezone.feedId, partition.get(0).edge.nTransfers == 0,
            tripDescriptor.getTripId(),

代码示例来源:origin: wildfly/wildfly

continue;
} else if (callback instanceof NameCallback) {
  if (config.getUserCallbackKinds().contains(CallbackKind.PRINCIPAL)) {
    userCallbacks.add(callback);
    continue;
  if (config.getUserCallbackKinds().contains(CallbackKind.CREDENTIAL)) {
    userCallbacks.add(callback);
    continue;
  if (config.getUserCallbackKinds().contains(CallbackKind.CREDENTIAL_RESET)) {
    userCallbacks.add(callback);
    continue;
  continue;
} else if (callback instanceof CredentialCallback) {
  if (config.getUserCallbackKinds().contains(CallbackKind.CREDENTIAL)) {
    userCallbacks.add(callback);
    continue;
  if (config.getUserCallbackKinds().contains(CallbackKind.REALM)) {
    userCallbacks.add(callback);
    continue;
  if (config.getUserCallbackKinds().contains(CallbackKind.REALM)) {
    userCallbacks.add(callback);
    continue;
  continue;

代码示例来源:origin: wildfly/wildfly

private void parseSecurityDomain(List<ModelNode> list, XMLExtendedStreamReader reader, PathAddress parentAddress) throws XMLStreamException {
  ModelNode op = Util.createAddOperation();
  list.add(op);
  PathElement secDomainPath = null;
  EnumSet<Attribute> required = EnumSet.of(Attribute.NAME);
  final int count = reader.getAttributeCount();
  for (int i = 0; i < count; i++) {
  while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
    final Element element = Element.forName(reader.getLocalName());
    if (!visited.add(element)) {
      throw unexpectedElement(reader);
        if (visited.contains(Element.AUTHENTICATION_JASPI)) {
          throw SecurityLogger.ROOT_LOGGER.xmlStreamExceptionAuth(reader.getLocation());
        if (visited.contains(Element.AUTHENTICATION)) { throw SecurityLogger.ROOT_LOGGER.xmlStreamExceptionAuth(reader.getLocation()); }
        parseAuthenticationJaspi(list, address, reader);
        break;

代码示例来源:origin: remkop/picocli

private void buildMixins(RoundEnvironment roundEnv,
             IFactory factory,
             Map<Element, CommandSpec> mixinsDeclared,
             List<MixinInfo> mixinInfoList,
             Map<TypeMirror, List<CommandSpec>> commandTypes,
             Map<Element, OptionSpec.Builder> options,
             Map<Element, PositionalParamSpec.Builder> parameters) {
  Set<? extends Element> explicitMixins = roundEnv.getElementsAnnotatedWith(Mixin.class);
  for (Element element : explicitMixins) {
    if (element.asType().getKind() != TypeKind.DECLARED) {
      error(element, "@Mixin must have a declared type, not %s", element.asType());
      continue;
    }
    TypeElement type = (TypeElement) ((DeclaredType) element.asType()).asElement();
    CommandSpec mixin = buildCommand(type, factory, mixinsDeclared, commandTypes, options, parameters);
    logger.fine("Built mixin: " + mixin + " from " + element);
    if (EnumSet.of(ElementKind.FIELD, ElementKind.PARAMETER).contains(element.getKind())) {
      VariableElement variableElement = (VariableElement) element;
      String name = element.getAnnotation(Mixin.class).name();
      if (name.length() == 0) {
        name = variableElement.getSimpleName().toString();
      }
      Element targetType = element.getEnclosingElement();
      CommandSpec mixee = buildCommand(targetType, factory, mixinsDeclared, commandTypes, options, parameters);
      mixinInfoList.add(new MixinInfo(mixee, name, mixin));
      logger.fine("Mixin name=" + name + ", target command=" + mixee.userObject());
    }
  }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

private enum NodeNotChosenReason {
 NOT_IN_SERVICE("the node is not in service"),
 NODE_STALE("the node is stale"),
 NODE_TOO_BUSY("the node is too busy"),
 TOO_MANY_NODES_ON_RACK("the rack has too many chosen nodes"),
 NOT_ENOUGH_STORAGE_SPACE("not enough storage space to place the block");
 private final String text;
 NodeNotChosenReason(final String logText) {
  text = logText;
 }
 private String getText() {
  return text;
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

scopeFound.add(entry.getScope());
if (entry.getType() == GROUP || entry.getName() != null) {
 FsAction scopeUnionPerms = unionPerms.get(entry.getScope());
 maskNeeded.add(entry.getScope());
if (!providedMask.containsKey(scope) && maskNeeded.contains(scope) &&
  maskDirty.contains(scope)) {
  (!scopeDirty.contains(scope) || maskDirty.contains(scope))) {
 aclBuilder.add(providedMask.get(scope));
} else if (maskNeeded.contains(scope) || providedMask.containsKey(scope)) {
 aclBuilder.add(new AclEntry.Builder()
  .setScope(scope)
  .setType(MASK)

代码示例来源:origin: mabe02/lanterna

/**
 * Returns a copy of this TextCharacter with an additional SGR modifier. All of the currently active SGR codes
 * will be carried over to the copy, in addition to the one specified.
 * @param modifier SGR modifiers the copy should have in additional to all currently present
 * @return Copy of the TextCharacter with a new SGR modifier
 */
public TextCharacter withModifier(SGR modifier) {
  if(modifiers.contains(modifier)) {
    return this;
  }
  EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
  newSet.add(modifier);
  return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
}

代码示例来源:origin: wildfly/wildfly

EnumSet<Attribute> expectedAttributes = EnumSet.of(Attribute.SECURITY_SUPPORT_SSL,
    Attribute.SECURITY_ADD_COMPONENT_INTERCEPTOR, Attribute.SECURITY_CLIENT_SUPPORTS,
    Attribute.SECURITY_CLIENT_REQUIRES, Attribute.SECURITY_SERVER_SUPPORTS, Attribute.SECURITY_SERVER_REQUIRES,
  final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
  if (!expectedAttributes.contains(attribute))
    throw unexpectedAttribute(reader, i);
  if (!parsedAttributes.add(attribute)) {
    throw duplicateAttribute(reader, attribute.getLocalName());

代码示例来源:origin: facebook/litho

public static ImmutableList<EventDeclarationModel> getEventDeclarations(
  Elements elements, TypeElement element, Class<?> annotationType, EnumSet<RunMode> runMode) {
 final List<AnnotationValue> eventTypes =
   ProcessorUtils.getAnnotationParameter(
     elements, element, annotationType, "events", List.class);
 final List<EventDeclarationModel> eventDeclarations;
 if (eventTypes != null) {
  eventDeclarations = new ArrayList<>();
  for (AnnotationValue eventType : eventTypes) {
   final DeclaredType type = (DeclaredType) eventType.getValue();
   final TypeName returnType =
     runMode.contains(RunMode.ABI)
       ? TypeName.VOID
       : getReturnType(elements, type.asElement());
   final ImmutableList<FieldModel> fields =
     runMode.contains(RunMode.ABI)
       ? ImmutableList.of()
       : FieldsExtractor.extractFields(type.asElement());
   eventDeclarations.add(
     new EventDeclarationModel(
       ClassName.bestGuess(type.asElement().toString()),
       returnType,
       fields,
       type.asElement()));
  }
 } else {
  eventDeclarations = Collections.emptyList();
 }
 return ImmutableList.copyOf(eventDeclarations);
}

代码示例来源:origin: apache/drill

rules.add(HiveFilterProjectTransposeRule.INSTANCE_DETERMINISTIC_WINDOWING);
} else {
 rules.add(HiveFilterProjectTransposeRule.INSTANCE_DETERMINISTIC);
rules.add(HiveFilterSetOpTransposeRule.INSTANCE);
rules.add(HiveFilterSortTransposeRule.INSTANCE);
rules.add(HiveFilterJoinRule.JOIN);
perfLogger.PerfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER);
basePlan = hepPlan(basePlan, true, mdProvider, executorProvider, HepMatchOrder.BOTTOM_UP,
    rules.toArray(new RelOptRule[rules.size()]));
perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER,
 "Calcite: Prejoin ordering transformation, PPD, not null predicates, transitive inference, constant folding");
HiveRelFieldTrimmer fieldTrimmer = new HiveRelFieldTrimmer(null,
  HiveRelFactories.HIVE_BUILDER.create(cluster, null),
  profilesCBO.contains(ExtendedCBOProfile.JOIN_REORDERING));
basePlan = fieldTrimmer.trim(basePlan);
perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER,

代码示例来源:origin: apache/hive

LOG.debug("keys size is " + keys.size());
 for (ExprNodeDesc k : keys) {
  LOG.debug("Key exprNodeDesc " + k.getExprString());
keyEval = new ExprNodeEvaluator[keys.size()];
int i = 0;
for (ExprNodeDesc e : keys) {
numDistinctExprs = distinctColIndices.size();
useUniformHash = conf.getReducerTraits().contains(UNIFORM);

代码示例来源:origin: jamesagnew/hapi-fhir

for (SourceElementComponent e : g.getElement()) {
    if (!src.hasSystem() && src.getCode().equals(e.getCode())) 
  list.add(new SourceElementComponentWrapper(g, e));
 else if (src.hasSystem() && src.getSystem().equals(g.getSource()) && src.getCode().equals(e.getCode()))
  list.add(new SourceElementComponentWrapper(g, e));
if (list.size() == 0)
  done = true;
else if (list.get(0).comp.getTarget().size() == 0)
  message = "Concept map "+su+" found no translation for "+src.getCode();
else {
  for (TargetElementComponent tgt : list.get(0).comp.getTarget()) {
    if (tgt.getEquivalence() == null || EnumSet.of( ConceptMapEquivalence.EQUAL , ConceptMapEquivalence.RELATEDTO , ConceptMapEquivalence.EQUIVALENT, ConceptMapEquivalence.WIDER).contains(tgt.getEquivalence())) {
      if (done) {
        message = "Concept map "+su+" found multiple matches for "+src.getCode();

代码示例来源:origin: konsoletyper/teavm

public ClassNode decompile(ClassHolder cls) {
  ClassNode clsNode = new ClassNode(cls.getName(), cls.getParent());
  for (FieldHolder field : cls.getFields()) {
    FieldNode fieldNode = new FieldNode(field.getReference(), field.getType());
    fieldNode.getModifiers().addAll(field.getModifiers());
    fieldNode.setInitialValue(field.getInitialValue());
    clsNode.getFields().add(fieldNode);
  }
  for (MethodHolder method : cls.getMethods()) {
    if (method.getModifiers().contains(ElementModifier.ABSTRACT)) {
      continue;
    }
    if ((!isBootstrap() && method.getAnnotations().get(InjectedBy.class.getName()) != null)
        || methodsToSkip.contains(method.getReference())) {
      continue;
    }
    MethodNode methodNode = decompile(method);
    clsNode.getMethods().add(methodNode);
  }
  clsNode.getInterfaces().addAll(cls.getInterfaces());
  clsNode.getModifiers().addAll(cls.getModifiers());
  clsNode.setAccessLevel(cls.getLevel());
  return clsNode;
}

代码示例来源:origin: schemacrawler/SchemaCrawler

.of(TableConstraintType.check, TableConstraintType.unique);
if (printableConstraints.contains(constraint.getConstraintType()))
 constraints.add(constraint);

代码示例来源:origin: ahmetaa/zemberek-nlp

if (refItems.size() > 0) {
 attrSet = morphemicAttributes(null, root, posInfo);
attrSet.add(RootAttribute.CompoundP3sgRoot);
if (item.attributes.contains(RootAttribute.Ext)) {
 attrSet.add(RootAttribute.Ext);
  attrSet,
  index);
fakeRoot.attributes.add(RootAttribute.Dummy);
fakeRoot.attributes.remove(RootAttribute.Voicing);
fakeRoot.setReferenceItem(item);

相关文章