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


Java EnumSet.addAll方法代码示例

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


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

示例1: generateCondition

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public Condition generateCondition() {
    Condition subcondition = subfulfillment.getCondition();

    EnumSet<FeatureSuite> features = subcondition.getFeatures();
    features.addAll(BASE_FEATURES);

    byte[] fingerprint = Crypto.getSha256Hash(
            calculateFingerPrintContent(
                    prefix,
                    subcondition
            )
    );

    int maxFulfillmentLength = calculateMaxFulfillmentLength(
            prefix,
            subcondition
    );

    return new ConditionImpl(
            ConditionType.PREFIX_SHA256,
            features,
            fingerprint,
            maxFulfillmentLength);
}
 
开发者ID:mgrand,项目名称:bigchaindb-java-driver,代码行数:26,代码来源:PrefixSha256Fulfillment.java

示例2: calculateSubtypes

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Determines the set of condition rsa that are ultimately held via the sub condition.
 *
 * @param subconditions The sub conditions that this condition depends on.
 *
 * @return The set of condition rsa related to the sub condition.
 */
private static final EnumSet<CryptoConditionType> calculateSubtypes(
    final List<Condition> subconditions
) {
  Objects.requireNonNull(subconditions);

  final EnumSet<CryptoConditionType> subtypes = EnumSet.noneOf(CryptoConditionType.class);
  for (int i = 0; i < subconditions.size(); i++) {
    subtypes.add(subconditions.get(i).getType());
    if (subconditions.get(i) instanceof CompoundCondition) {
      subtypes.addAll(((CompoundCondition) subconditions.get(i)).getSubtypes());
    }
  }

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

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

示例3: Scheme

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 */
public Scheme(
    ImmutableSet<String> lcaseNames,
    boolean isHierarchical, int defaultPortOrNegOne,
    SchemePart... parts) {
  Preconditions.checkArgument(
      defaultPortOrNegOne == -1
      || (1 <= defaultPortOrNegOne && defaultPortOrNegOne <= 65535),
      "Port is out of range");
  EnumSet<SchemePart> partSet = EnumSet.noneOf(SchemePart.class);
  partSet.addAll(Arrays.asList(parts));
  this.lcaseNames = lcaseNames;
  this.isHierarchical = isHierarchical;
  this.defaultPortOrNegOne = defaultPortOrNegOne;
  this.naturallyEmbedsContent = partSet.contains(SchemePart.CONTENT);
  this.naturallyHasAuthority = partSet.contains(SchemePart.AUTHORITY);
  this.mayHaveUserName = partSet.contains(SchemePart.USERINFO);
  this.naturallyHasPath = partSet.contains(SchemePart.PATH);
  this.naturallyHasQuery = partSet.contains(SchemePart.QUERY);
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:22,代码来源:Scheme.java

示例4: assertCornerCases

import java.util.EnumSet; //导入方法依赖的package包/类
private static void assertCornerCases(
    String refUrl, String baseUrl,
    String wantUrl, UrlValue.CornerCase... wantCases) {
  Absolutizer abs = new Absolutizer(
      UrlContext.DEFAULT.absolutizer.schemes, baseUrl);
  Absolutizer.Result got = abs.absolutize(refUrl);
  EnumSet<UrlValue.CornerCase> wantCaseSet = EnumSet.noneOf(
      UrlValue.CornerCase.class);
  wantCaseSet.addAll(Arrays.asList(wantCases));
  assertEquals(
      "base=" + baseUrl + ", ref=" + refUrl,
      wantCaseSet, got.cornerCases);
  assertEquals(
      "base=" + baseUrl + ", ref=" + refUrl,
      wantUrl, got.absUrlText);
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:17,代码来源:AbsolutizerTest.java

示例5: getFlags

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
protected EnumSet<OperandFlag> getFlags(Field field) {
    EnumSet<OperandFlag> result = EnumSet.noneOf(OperandFlag.class);
    // Unfortunately, annotations cannot have class hierarchies or implement interfaces, so
    // we have to duplicate the code for every operand mode.
    // Unfortunately, annotations cannot have an EnumSet property, so we have to convert
    // from arrays to EnumSet manually.
    if (field.isAnnotationPresent(LIRInstruction.Use.class)) {
        result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Use.class).value()));
    } else if (field.isAnnotationPresent(LIRInstruction.Alive.class)) {
        result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Alive.class).value()));
    } else if (field.isAnnotationPresent(LIRInstruction.Temp.class)) {
        result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Temp.class).value()));
    } else if (field.isAnnotationPresent(LIRInstruction.Def.class)) {
        result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Def.class).value()));
    } else {
        GraalError.shouldNotReachHere();
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:LIRInstructionClass.java

示例6: addOptions

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Creates a new configuration by adding the new options to the options used in this configuration.
 * @param options options to add
 * @return a new configuration
 */
public Configuration addOptions(Option... options) {
    EnumSet<Option> opts = EnumSet.noneOf(Option.class);
    opts.addAll(this.options);
    opts.addAll(asList(options));
    return Configuration.builder().jsonProvider(jsonProvider).mappingProvider(mappingProvider).options(opts).evaluationListener(evaluationListeners).build();
}
 
开发者ID:osswangxining,项目名称:iot-edge-greengrass,代码行数:12,代码来源:Configuration.java

示例7: typeFromDescription

import java.util.EnumSet; //导入方法依赖的package包/类
public static EnumSet<SatelliteImageType> typeFromDescription(String description) throws BuenOjoCSVParserException  {
	
	String types[] = description.split(",");
	EnumSet<SatelliteImageType> typeSet = EnumSet.noneOf(SatelliteImageType.class);
	for (String type : types) {
		EnumSet<SatelliteImageType> subSet = enumSetFromTypeString(type.trim());
		 typeSet.addAll(subSet);
	}
	return typeSet;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:11,代码来源:ImageCompletionTipCSVParser.java

示例8: 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

示例9: copyCompilationState

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Copy a compilation state from an original function to this function. Used when creating synthetic
 * function nodes by the splitter.
 *
 * @param lc lexical context
 * @param original the original function node to copy compilation state from
 * @return function node or a new one if state was changed
 */
public FunctionNode copyCompilationState(final LexicalContext lc, final FunctionNode original) {
    final EnumSet<CompilationState> origState = original.compilationState;
    if (!AssertsEnabled.assertsEnabled() || this.compilationState.containsAll(origState)) {
        return this;
    }
    final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
    newState.addAll(origState);
    return setCompilationState(lc, newState);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:FunctionNode.java

示例10: getFlags

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
protected EnumSet<OperandFlag> getFlags(Field field) {
    EnumSet<OperandFlag> result = EnumSet.noneOf(OperandFlag.class);
    if (field.isAnnotationPresent(CompositeValue.Component.class)) {
        result.addAll(Arrays.asList(field.getAnnotation(CompositeValue.Component.class).value()));
    } else {
        GraalError.shouldNotReachHere();
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:CompositeValueClass.java

示例11: getCascadeStrategy

import java.util.EnumSet; //导入方法依赖的package包/类
private static String getCascadeStrategy(
		javax.persistence.CascadeType[] ejbCascades,
		Cascade hibernateCascadeAnnotation,
		boolean orphanRemoval,
		boolean forcePersist) {
	EnumSet<CascadeType> hibernateCascadeSet = convertToHibernateCascadeType( ejbCascades );
	CascadeType[] hibernateCascades = hibernateCascadeAnnotation == null ?
			null :
			hibernateCascadeAnnotation.value();

	if ( hibernateCascades != null && hibernateCascades.length > 0 ) {
		hibernateCascadeSet.addAll( Arrays.asList( hibernateCascades ) );
	}

	if ( orphanRemoval ) {
		hibernateCascadeSet.add( CascadeType.DELETE_ORPHAN );
		hibernateCascadeSet.add( CascadeType.REMOVE );
	}
	if ( forcePersist ) {
		hibernateCascadeSet.add( CascadeType.PERSIST );
	}

	StringBuilder cascade = new StringBuilder();
	for ( CascadeType aHibernateCascadeSet : hibernateCascadeSet ) {
		switch ( aHibernateCascadeSet ) {
			case ALL:
				cascade.append( "," ).append( "all" );
				break;
			case SAVE_UPDATE:
				cascade.append( "," ).append( "save-update" );
				break;
			case PERSIST:
				cascade.append( "," ).append( "persist" );
				break;
			case MERGE:
				cascade.append( "," ).append( "merge" );
				break;
			case LOCK:
				cascade.append( "," ).append( "lock" );
				break;
			case REFRESH:
				cascade.append( "," ).append( "refresh" );
				break;
			case REPLICATE:
				cascade.append( "," ).append( "replicate" );
				break;
			case EVICT:
			case DETACH:
				cascade.append( "," ).append( "evict" );
				break;
			case DELETE:
				cascade.append( "," ).append( "delete" );
				break;
			case DELETE_ORPHAN:
				cascade.append( "," ).append( "delete-orphan" );
				break;
			case REMOVE:
				cascade.append( "," ).append( "delete" );
				break;
		}
	}
	return cascade.length() > 0 ?
			cascade.substring( 1 ) :
			"none";
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:66,代码来源:AnnotationBinder.java

示例12: parseFaces

import java.util.EnumSet; //导入方法依赖的package包/类
public boolean[] parseFaces(String p_parseFaces_1_, boolean[] p_parseFaces_2_)
{
    if (p_parseFaces_1_ == null)
    {
        return p_parseFaces_2_;
    }
    else
    {
        EnumSet enumset = EnumSet.allOf(EnumFacing.class);
        String[] astring = Config.tokenize(p_parseFaces_1_, " ,");

        for (int i = 0; i < astring.length; ++i)
        {
            String s = astring[i];

            if (s.equals("sides"))
            {
                enumset.add(EnumFacing.NORTH);
                enumset.add(EnumFacing.SOUTH);
                enumset.add(EnumFacing.WEST);
                enumset.add(EnumFacing.EAST);
            }
            else if (s.equals("all"))
            {
                enumset.addAll(Arrays.asList(EnumFacing.VALUES));
            }
            else
            {
                EnumFacing enumfacing = this.parseFace(s);

                if (enumfacing != null)
                {
                    enumset.add(enumfacing);
                }
            }
        }

        boolean[] aboolean = new boolean[EnumFacing.VALUES.length];

        for (int j = 0; j < aboolean.length; ++j)
        {
            aboolean[j] = enumset.contains(EnumFacing.VALUES[j]);
        }

        return aboolean;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:48,代码来源:ConnectedParser.java

示例13: substBounds

import java.util.EnumSet; //导入方法依赖的package包/类
/** replace types in all bounds - this might trigger listener notification */
public void substBounds(List<Type> from, List<Type> to, Types types) {
    List<Type> instVars = from.diff(to);
    //if set of instantiated ivars is empty, there's nothing to do!
    if (instVars.isEmpty()) return;
    final EnumSet<InferenceBound> boundsChanged = EnumSet.noneOf(InferenceBound.class);
    UndetVarListener prevListener = listener;
    try {
        //setup new listener for keeping track of changed bounds
        listener = new UndetVarListener() {
            public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
                boundsChanged.addAll(ibs);
            }
        };
        for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
            InferenceBound ib = _entry.getKey();
            List<Type> prevBounds = _entry.getValue();
            ListBuffer<Type> newBounds = new ListBuffer<>();
            ListBuffer<Type> deps = new ListBuffer<>();
            //step 1 - re-add bounds that are not dependent on ivars
            for (Type t : prevBounds) {
                if (!t.containsAny(instVars)) {
                    newBounds.append(t);
                } else {
                    deps.append(t);
                }
            }
            //step 2 - replace bounds
            bounds.put(ib, newBounds.toList());
            //step 3 - for each dependency, add new replaced bound
            for (Type dep : deps) {
                addBound(ib, types.subst(dep, from, to), types, true);
            }
        }
    } finally {
        listener = prevListener;
        if (!boundsChanged.isEmpty()) {
            notifyChange(boundsChanged);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:Type.java

示例14: UrlValue

import java.util.EnumSet; //导入方法依赖的package包/类
private UrlValue(UrlContext context, String originalUrlText) {
  this.context = context;
  this.originalUrlText = originalUrlText;

  EnumSet<CornerCase> extraCornerCases = EnumSet.noneOf(
      CornerCase.class);

  String refUrlText = originalUrlText;
  switch (context.microsoftPathStrategy) {
    case BACK_TO_FORWARD:
      int eos = Absolutizer.endOfScheme(refUrlText);
      @SuppressWarnings("hiding")
      Scheme scheme = null;
      if (eos >= 0) {
        scheme = context.absolutizer.schemes.schemeForName(
            refUrlText.substring(0, eos - 1 /* ':' */));
      }
      if (scheme == null || scheme.isHierarchical) {
        refUrlText = refUrlText.replace('\\', '/');
        if (!refUrlText.equals(originalUrlText)) {
          extraCornerCases.add(CornerCase.FLIPPED_SLASHES);
        }
      }
      break;
    case STANDARDS_COMPLIANT:
      break;
  }

  Absolutizer.Result abs = context.absolutizer.absolutize(refUrlText);
  this.scheme  = abs.scheme;
  this.urlText = abs.absUrlText;
  this.ranges = abs.absUrlRanges;
  if (ranges == null || ranges.authorityLeft == ranges.authorityRight) {
    this.rawAuthority = null;
    this.authority = null;
    this.inheritsPlaceholderAuthority = false;
  } else {
    this.rawAuthority = this.urlText.substring(
        this.ranges.authorityLeft, this.ranges.authorityRight);
    this.inheritsPlaceholderAuthority = this.ranges != null
        && abs.originalUrlRanges.authorityLeft < 0
        && UrlContext.PLACEHOLDER_AUTHORITY.equals(rawAuthority);
    this.authority = Authority.decode(this, Diagnostic.Receiver.NULL);
    if (this.authority != null) {
      if (!this.authority.hasValidHost()) {
        extraCornerCases.add(CornerCase.IDNA_INVALID_HOST);
      } else if (this.authority.hasTransitionalDifference()) {
        extraCornerCases.add(CornerCase.IDNA_TRANSITIONAL_DIFFERENCE);
      }
    }
  }

  ImmutableSet<CornerCase> allCornerCases = abs.cornerCases;
  if (!extraCornerCases.isEmpty()) {
    extraCornerCases.addAll(allCornerCases);
    allCornerCases = Sets.immutableEnumSet(extraCornerCases);
  }
  this.cornerCases = allCornerCases;
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:60,代码来源:UrlValue.java

示例15: toEnumSet

import java.util.EnumSet; //导入方法依赖的package包/类
static <E extends Enum<E>> EnumSet<E> toEnumSet(final Class<E> clazz,
    final E... values) {
  final EnumSet<E> set = EnumSet.noneOf(clazz);
  set.addAll(Arrays.asList(values));
  return set;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:EnumSetParam.java


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