本文整理汇总了Java中java.util.EnumSet.remove方法的典型用法代码示例。如果您正苦于以下问题:Java EnumSet.remove方法的具体用法?Java EnumSet.remove怎么用?Java EnumSet.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.EnumSet
的用法示例。
在下文中一共展示了EnumSet.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFlagsSizedOrderedParallelCollect
import java.util.EnumSet; //导入方法依赖的package包/类
public void testFlagsSizedOrderedParallelCollect() {
EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED);
EnumSet<StreamOpFlag> serKnown = parKnown.clone();
List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>();
for (StreamOpFlag f : parKnown) {
ops.add(CollectorOps.collector());
ops.add(new ParSerTestFlagExpectedOp<>(f.clear(),
parKnown,
serKnown));
serKnown.remove(f);
}
ops.add(CollectorOps.collector());
ops.add(new ParSerTestFlagExpectedOp<>(0,
parKnown,
EnumSet.noneOf(StreamOpFlag.class)));
TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0]));
@SuppressWarnings("rawtypes")
IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]);
withData(data).ops(opsArray).exercise();
}
示例2: toEncrypted
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Get encrypted reference for clear text directory path.
*
* @param session Connection
* @param directoryId Directory ID or null to read directory id from metadata file
* @param directory Clear text
*/
public Path toEncrypted(final Session<?> session, final String directoryId, final Path directory) throws BackgroundException {
if(!directory.isDirectory()) {
throw new NotfoundException(directory.getAbsolute());
}
if(new SimplePathPredicate(directory).test(home) || directory.isChild(home)) {
final PathAttributes attributes = new PathAttributes(directory.attributes()).withVersionId(null);
// Remember random directory id for use in vault
final String id = this.toDirectoryId(session, directory, directoryId);
if(log.isDebugEnabled()) {
log.debug(String.format("Use directory ID '%s' for folder %s", id, directory));
}
attributes.setDirectoryId(id);
attributes.setDecrypted(directory);
final String directoryIdHash = cryptomator.getCryptor().fileNameCryptor().hashDirectoryId(id);
// Intermediate directory
final Path intermediate = new Path(dataRoot, directoryIdHash.substring(0, 2), dataRoot.getType());
// Add encrypted type
final EnumSet<AbstractPath.Type> type = EnumSet.copyOf(directory.getType());
type.add(Path.Type.encrypted);
type.remove(Path.Type.decrypted);
return new Path(intermediate, directoryIdHash.substring(2), type, attributes);
}
throw new NotfoundException(directory.getAbsolute());
}
示例3: optimizeMinimizeRegisters
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Runs the optimizer with a strategy to minimize the number of rop-form
* registers used by the end result. Dex bytecode does not have instruction
* forms that take register numbers larger than 15 for all instructions.
* If we've produced a method that uses more than 16 registers, try again
* with a different strategy to see if we can get under the bar. The end
* result will be much more efficient.
*
* @param rmeth method to process
* @param paramWidth the total width, in register-units, of this method's
* parameters
* @param isStatic true if this method has no 'this' pointer argument.
* @param steps set of optional optimization steps to run
* @return optimized method
*/
private static RopMethod optimizeMinimizeRegisters(RopMethod rmeth,
int paramWidth, boolean isStatic,
EnumSet<OptionalStep> steps) {
SsaMethod ssaMeth;
RopMethod resultMeth;
ssaMeth = SsaConverter.convertToSsaMethod(
rmeth, paramWidth, isStatic);
EnumSet<OptionalStep> newSteps = steps.clone();
/*
* CONST_COLLECTOR trades insns for registers, which is not an
* appropriate strategy here.
*/
newSteps.remove(OptionalStep.CONST_COLLECTOR);
runSsaFormSteps(ssaMeth, newSteps);
resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true);
return resultMeth;
}
示例4: 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;
}
示例5: getVerboseResolutionMode
import java.util.EnumSet; //导入方法依赖的package包/类
static EnumSet<VerboseResolutionMode> getVerboseResolutionMode(Options opts) {
String s = opts.get("debug.verboseResolution");
EnumSet<VerboseResolutionMode> res = EnumSet.noneOf(VerboseResolutionMode.class);
if (s == null) return res;
if (s.contains("all")) {
res = EnumSet.allOf(VerboseResolutionMode.class);
}
Collection<String> args = Arrays.asList(s.split(","));
for (VerboseResolutionMode mode : values()) {
if (args.contains(mode.opt)) {
res.add(mode);
} else if (args.contains("-" + mode.opt)) {
res.remove(mode);
}
}
return res;
}
示例6: testUnpackAttributes
import java.util.EnumSet; //导入方法依赖的package包/类
public void testUnpackAttributes() {
EnumSet<FileAttribute> attributes = EnumSet.allOf(FileAttribute.class);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("RCBUGPAXT"));
attributes.remove(FileAttribute.REPLICATION);
attributes.remove(FileAttribute.CHECKSUMTYPE);
attributes.remove(FileAttribute.ACL);
attributes.remove(FileAttribute.XATTR);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("BUGPT"));
attributes.remove(FileAttribute.TIMES);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("BUGP"));
attributes.remove(FileAttribute.BLOCKSIZE);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("UGP"));
attributes.remove(FileAttribute.GROUP);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("UP"));
attributes.remove(FileAttribute.USER);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes("P"));
attributes.remove(FileAttribute.PERMISSION);
Assert.assertEquals(attributes, DistCpUtils.unpackAttributes(""));
}
示例7: getDependenciesModes
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* This method is used to parse the {@code completionDeps} option.
* Possible modes are separated by colon; a mode can be excluded by
* prepending '-' to its name. Finally, the special mode 'all' can be used to
* add all modes to the resulting enum.
*/
static EnumSet<DependenciesMode> getDependenciesModes(String[] modes) {
EnumSet<DependenciesMode> res = EnumSet.noneOf(DependenciesMode.class);
Collection<String> args = Arrays.asList(modes);
if (args.contains("all")) {
res = EnumSet.allOf(DependenciesMode.class);
}
for (DependenciesMode mode : values()) {
if (args.contains(mode.opt)) {
res.add(mode);
} else if (args.contains("-" + mode.opt)) {
res.remove(mode);
}
}
return res;
}
示例8: compareOptimizerStep
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Compares the output of the optimizer run normally with a run skipping
* some optional steps. Results are printed to stderr.
*
* @param nonOptRmeth {@code non-null;} origional rop method
* @param paramSize {@code >= 0;} parameter size of method
* @param isStatic true if this method has no 'this' pointer argument.
* @param args {@code non-null;} translator arguments
* @param advice {@code non-null;} translation advice
* @param rmeth {@code non-null;} method with all optimization steps run.
*/
public static void compareOptimizerStep(RopMethod nonOptRmeth,
int paramSize, boolean isStatic, CfOptions args,
TranslationAdvice advice, RopMethod rmeth) {
EnumSet<Optimizer.OptionalStep> steps;
steps = EnumSet.allOf(Optimizer.OptionalStep.class);
// This is the step to skip.
steps.remove(Optimizer.OptionalStep.CONST_COLLECTOR);
RopMethod skipRopMethod
= Optimizer.optimize(nonOptRmeth,
paramSize, isStatic, args.localInfo, advice, steps);
int normalInsns
= rmeth.getBlocks().getEffectiveInstructionCount();
int skipInsns
= skipRopMethod.getBlocks().getEffectiveInstructionCount();
System.err.printf(
"optimize step regs:(%d/%d/%.2f%%)"
+ " insns:(%d/%d/%.2f%%)\n",
rmeth.getBlocks().getRegCount(),
skipRopMethod.getBlocks().getRegCount(),
100.0 * ((skipRopMethod.getBlocks().getRegCount()
- rmeth.getBlocks().getRegCount())
/ (float) skipRopMethod.getBlocks().getRegCount()),
normalInsns, skipInsns,
100.0 * ((skipInsns - normalInsns) / (float) skipInsns));
}
示例9: type
import java.util.EnumSet; //导入方法依赖的package包/类
protected String type() {
final EnumSet<Path.Type> types = EnumSet.copyOf(file.getType());
types.remove(Path.Type.placeholder);
types.remove(Path.Type.volume);
types.remove(Path.Type.encrypted);
types.remove(Path.Type.decrypted);
types.remove(Path.Type.vault);
types.remove(Path.Type.upload);
return String.valueOf(types);
}
示例10: findChangedFields
import java.util.EnumSet; //导入方法依赖的package包/类
protected EnumSet<DeviceField> findChangedFields(Device device,
Entity newEntity) {
EnumSet<DeviceField> changedFields =
EnumSet.of(DeviceField.IPV4,
DeviceField.VLAN,
DeviceField.SWITCH);
if (newEntity.getIpv4Address() == null)
changedFields.remove(DeviceField.IPV4);
if (newEntity.getVlan() == null)
changedFields.remove(DeviceField.VLAN);
if (newEntity.getSwitchDPID() == null ||
newEntity.getSwitchPort() == null)
changedFields.remove(DeviceField.SWITCH);
if (changedFields.size() == 0) return changedFields;
for (Entity entity : device.getEntities()) {
if (newEntity.getIpv4Address() == null ||
(entity.getIpv4Address() != null &&
entity.getIpv4Address().equals(newEntity.getIpv4Address())))
changedFields.remove(DeviceField.IPV4);
if (newEntity.getVlan() == null ||
(entity.getVlan() != null &&
entity.getVlan().equals(newEntity.getVlan())))
changedFields.remove(DeviceField.VLAN);
if (newEntity.getSwitchDPID() == null ||
newEntity.getSwitchPort() == null ||
(entity.getSwitchDPID() != null &&
entity.getSwitchPort() != null &&
entity.getSwitchDPID().equals(newEntity.getSwitchDPID()) &&
entity.getSwitchPort().equals(newEntity.getSwitchPort())))
changedFields.remove(DeviceField.SWITCH);
}
return changedFields;
}
示例11: testFlagsClearSequence
import java.util.EnumSet; //导入方法依赖的package包/类
protected void testFlagsClearSequence(Supplier<StatefulTestOp<Integer>> cf) {
EnumSet<StreamOpFlag> known = EnumSet.of(StreamOpFlag.ORDERED, StreamOpFlag.SIZED);
EnumSet<StreamOpFlag> preserve = EnumSet.of(StreamOpFlag.DISTINCT, StreamOpFlag.SORTED);
EnumSet<StreamOpFlag> notKnown = EnumSet.noneOf(StreamOpFlag.class);
List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>();
for (StreamOpFlag f : EnumSet.of(StreamOpFlag.ORDERED, StreamOpFlag.DISTINCT, StreamOpFlag.SORTED)) {
ops.add(cf.get());
ops.add(new TestFlagExpectedOp<>(f.clear(),
known.clone(),
preserve.clone(),
notKnown.clone()));
known.remove(f);
preserve.remove(f);
notKnown.add(f);
}
ops.add(cf.get());
ops.add(new TestFlagExpectedOp<>(0,
known.clone(),
preserve.clone(),
notKnown.clone()));
TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0]));
@SuppressWarnings("rawtypes")
IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]);
withData(data).ops(opsArray).
without(StreamTestScenario.CLEAR_SIZED_SCENARIOS).
exercise();
}
示例12: opt
import java.util.EnumSet; //导入方法依赖的package包/类
static EnumSet<EOpt> opt(boolean endTag, boolean inline, boolean pre) {
EnumSet<EOpt> opts = of(ENDTAG);
if (!endTag) opts.remove(ENDTAG);
if (inline) opts.add(INLINE);
if (pre) opts.add(PRE);
return opts;
}
示例13: rem
import java.util.EnumSet; //导入方法依赖的package包/类
public static <T extends Enum<T>> EnumSet<T> rem(Class<T> c,
EnumSet<T> set, String s) {
if (null != fullmap.get(c) && fullmap.get(c).get(s) != null) {
if (null == set) {
set = EnumSet.allOf(c);
}
set.remove(fullmap.get(c).get(s));
}
return set;
}
示例14: testFlagsSetSequence
import java.util.EnumSet; //导入方法依赖的package包/类
private void testFlagsSetSequence(Supplier<StatefulTestOp<Integer>> cf) {
EnumSet<StreamOpFlag> known = EnumSet.of(StreamOpFlag.ORDERED, StreamOpFlag.SIZED);
EnumSet<StreamOpFlag> preserve = EnumSet.of(StreamOpFlag.DISTINCT, StreamOpFlag.SORTED);
List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>();
for (StreamOpFlag f : EnumSet.of(StreamOpFlag.DISTINCT, StreamOpFlag.SORTED)) {
ops.add(cf.get());
ops.add(new TestFlagExpectedOp<>(f.set(),
known.clone(),
preserve.clone(),
EnumSet.noneOf(StreamOpFlag.class)));
known.add(f);
preserve.remove(f);
}
ops.add(cf.get());
ops.add(new TestFlagExpectedOp<>(0,
known.clone(),
preserve.clone(),
EnumSet.noneOf(StreamOpFlag.class)));
TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0]));
@SuppressWarnings("rawtypes")
IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]);
withData(data).ops(opsArray).
without(StreamTestScenario.CLEAR_SIZED_SCENARIOS).
exercise();
}
示例15: findChangedFields
import java.util.EnumSet; //导入方法依赖的package包/类
protected EnumSet<DeviceField> findChangedFields(Device device,
Entity newEntity) {
EnumSet<DeviceField> changedFields =
EnumSet.of(DeviceField.IPv4,
DeviceField.IPv6,
DeviceField.VLAN,
DeviceField.SWITCH);
/*
* Do we really need this here?
*
if (newEntity.getIpv4Address().equals(IPv4Address.NONE))
changedFields.remove(DeviceField.IPv4);
if (newEntity.getIpv6Address().equals(IPv6Address.NONE))
changedFields.remove(DeviceField.IPv6);
/*if (newEntity.getVlan().equals(VlanVid.ZERO)) TODO VLAN is ZERO here, since the actual Device and Entity must have some sort of VLAN, either untagged (ZERO) or some value
changedFields.remove(DeviceField.VLAN);
if (newEntity.getSwitchDPID().equals(DatapathId.NONE) ||
newEntity.getSwitchPort().equals(OFPort.ZERO))
changedFields.remove(DeviceField.SWITCH);
if (changedFields.size() == 0) return changedFields; */
for (Entity entity : device.getEntities()) {
if (newEntity.getIpv4Address().equals(IPv4Address.NONE) || /* NONE means 'not in this packet' */
entity.getIpv4Address().equals(newEntity.getIpv4Address())) /* these (below) might be defined and if they are and changed, then the device has changed */
changedFields.remove(DeviceField.IPv4);
if (newEntity.getIpv6Address().equals(IPv6Address.NONE) || /* NONE means 'not in this packet' */
entity.getIpv6Address().equals(newEntity.getIpv6Address()))
changedFields.remove(DeviceField.IPv6);
if (entity.getVlan().equals(newEntity.getVlan())) /* these (below) must be defined in each and every packet-in, and if different signal a device field change */
changedFields.remove(DeviceField.VLAN);
if (newEntity.getSwitchDPID().equals(DatapathId.NONE) ||
newEntity.getSwitchPort().equals(OFPort.ZERO) ||
(entity.getSwitchDPID().equals(newEntity.getSwitchDPID()) &&
entity.getSwitchPort().equals(newEntity.getSwitchPort())))
changedFields.remove(DeviceField.SWITCH);
}
if (changedFields.contains(DeviceField.SWITCH)) {
if (!isValidAttachmentPoint(newEntity.getSwitchDPID(), newEntity.getSwitchPort())) {
changedFields.remove(DeviceField.SWITCH);
}
}
return changedFields;
}