本文整理汇总了Java中java.util.EnumSet.noneOf方法的典型用法代码示例。如果您正苦于以下问题:Java EnumSet.noneOf方法的具体用法?Java EnumSet.noneOf怎么用?Java EnumSet.noneOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.EnumSet
的用法示例。
在下文中一共展示了EnumSet.noneOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitRequires
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public void visitRequires(JCRequires tree) {
ModuleSymbol msym = lookupModule(tree.moduleName);
if (msym.kind != MDL) {
log.error(tree.moduleName.pos(), Errors.ModuleNotFound(msym));
warnedMissing.add(msym);
} else if (allRequires.contains(msym)) {
log.error(tree.moduleName.pos(), Errors.DuplicateRequires(msym));
} else {
allRequires.add(msym);
Set<RequiresFlag> flags = EnumSet.noneOf(RequiresFlag.class);
if (tree.isTransitive)
flags.add(RequiresFlag.TRANSITIVE);
if (tree.isStaticPhase)
flags.add(RequiresFlag.STATIC_PHASE);
RequiresDirective d = new RequiresDirective(msym, flags);
tree.directive = d;
sym.requires = sym.requires.prepend(d);
}
}
示例2: of
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Returns a new {@code Collector} described by the given {@code supplier},
* {@code accumulator}, {@code combiner}, and {@code finisher} functions.
*
* @param supplier The supplier function for the new collector
* @param accumulator The accumulator function for the new collector
* @param combiner The combiner function for the new collector
* @param finisher The finisher function for the new collector
* @param characteristics The collector characteristics for the new
* collector
* @param <T> The type of input elements for the new collector
* @param <A> The intermediate accumulation type of the new collector
* @param <R> The final result type of the new collector
* @throws NullPointerException if any argument is null
* @return the new {@code Collector}
*/
public static<T, A, R> Collector<T, A, R> of(Supplier<A> supplier,
BiConsumer<A, T> accumulator,
BinaryOperator<A> combiner,
Function<A, R> finisher,
Characteristics... characteristics) {
Objects.requireNonNull(supplier);
Objects.requireNonNull(accumulator);
Objects.requireNonNull(combiner);
Objects.requireNonNull(finisher);
Objects.requireNonNull(characteristics);
Set<Characteristics> cs = Collectors.CH_NOID;
if (characteristics.length > 0) {
cs = EnumSet.noneOf(Characteristics.class);
Collections.addAll(cs, characteristics);
cs = Collections.unmodifiableSet(cs);
}
return new Collectors.CollectorImpl<>(supplier, accumulator, combiner, finisher, cs);
}
示例3: func_178604_a
import java.util.EnumSet; //导入方法依赖的package包/类
private Set<EnumFacing> func_178604_a(int p_178604_1_)
{
Set<EnumFacing> set = EnumSet.<EnumFacing>noneOf(EnumFacing.class);
Queue<Integer> queue = Lists.<Integer>newLinkedList();
queue.add(IntegerCache.func_181756_a(p_178604_1_));
this.field_178612_d.set(p_178604_1_, true);
while (!((Queue)queue).isEmpty())
{
int i = ((Integer)queue.poll()).intValue();
this.func_178610_a(i, set);
for (EnumFacing enumfacing : EnumFacing.values())
{
int j = this.func_178603_a(i, enumfacing);
if (j >= 0 && !this.field_178612_d.get(j))
{
this.field_178612_d.set(j, true);
queue.add(IntegerCache.func_181756_a(j));
}
}
}
return set;
}
示例4: a
import java.util.EnumSet; //导入方法依赖的package包/类
private static Collection<Object> a(Class<?> cls, Type type) {
if (cls == AbstractCollection.class) {
return new ArrayList();
}
if (cls.isAssignableFrom(HashSet.class)) {
return new HashSet();
}
if (cls.isAssignableFrom(LinkedHashSet.class)) {
return new LinkedHashSet();
}
if (cls.isAssignableFrom(TreeSet.class)) {
return new TreeSet();
}
if (cls.isAssignableFrom(ArrayList.class)) {
return new ArrayList();
}
if (cls.isAssignableFrom(EnumSet.class)) {
return EnumSet.noneOf(type instanceof ParameterizedType ? ((ParameterizedType) type).getActualTypeArguments()[0] : Object.class);
}
try {
return (Collection) cls.newInstance();
} catch (Exception e) {
throw new IllegalArgumentException("create instane error, class " + cls.getName());
}
}
示例5: parseDecodeFormats
import java.util.EnumSet; //导入方法依赖的package包/类
private static Set<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats, String decodeMode) {
if (scanFormats != null) {
Set<BarcodeFormat> formats = EnumSet.noneOf(BarcodeFormat.class);
try {
for (String format : scanFormats) {
formats.add(BarcodeFormat.valueOf(format));
}
return formats;
} catch (IllegalArgumentException iae) {
// ignore it then
}
}
if (decodeMode != null) {
return FORMATS_FOR_MODE.get(decodeMode);
}
return null;
}
示例6: ImdbSearchCommand
import java.util.EnumSet; //导入方法依赖的package包/类
public ImdbSearchCommand() {
this.command = "IMDBSearch";
this.aliases = ImmutableSet.of("SearchIMDB", "SearchTV", "SearchMovies", "SearchMovie");
this.commandType = CommandType.API;
this.description = "Search's on imdb by args";
this.permissions = EnumSet.noneOf(UserPermissions.class);
}
示例7: main
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Bridge.init();
EnumSet<TestCase> tests = EnumSet.noneOf(TestCase.class);
for (String arg : args) {
tests.add(TestCase.valueOf(arg));
}
if (args.length == 0) {
tests = EnumSet.complementOf(EnumSet.of(TestCase.LoadingMain));
}
final EnumSet<TestCase> loadingTests =
EnumSet.of(TestCase.LoadingApplet, TestCase.LoadingMain);
int testrun = 0;
for (TestCase test : tests) {
if (loadingTests.contains(test)) {
if (testrun > 0) {
throw new UnsupportedOperationException("Test case "
+ test + " must be executed first!");
}
}
System.out.println("Testing "+ test+": ");
System.out.println(test.describe());
try {
test.test();
} catch (Exception x) {
throw new Error(String.valueOf(test)
+ (System.getSecurityManager() == null ? " without " : " with ")
+ "security failed: "+x+"\n "+"FAILED: "+test.describe()+"\n", x);
} finally {
testrun++;
}
Bridge.changeContext();
System.out.println("PASSED: "+ test);
}
}
示例8: visitRuleset
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public void visitRuleset(RulesetTree tree) {
Set<Combinations> combinations = EnumSet.noneOf(Combinations.class);
for (PropertyDeclarationTree propertyDeclarationTree : tree.block().propertyDeclarations()) {
PropertyTree propertyTree = propertyDeclarationTree.property();
if (isBoxSizing(propertyTree)) {
combinations.clear();
combinations.add(Combinations.IS_BOX_SIZING);
}
if (!combinations.contains(Combinations.IS_BOX_SIZING)) {
if (!combinations.contains(Combinations.WIDTH_FOUND) && isWidth(propertyTree)) {
combinations.add(Combinations.WIDTH_FOUND);
} else if (!combinations.contains(Combinations.HEIGHT_FOUND) && isHeight(propertyTree)) {
combinations.add(Combinations.HEIGHT_FOUND);
}
if (isWidthSizing(propertyDeclarationTree)) {
combinations.add(Combinations.WIDTH_SIZING);
}
if (isHeightSizing(propertyDeclarationTree)) {
combinations.add(Combinations.HEIGHT_SIZING);
}
}
}
if (combinations.containsAll(Arrays.asList(Combinations.WIDTH_FOUND, Combinations.WIDTH_SIZING))
|| combinations.containsAll(Arrays.asList(Combinations.HEIGHT_FOUND, Combinations.HEIGHT_SIZING))) {
addPreciseIssue(CheckUtils.rulesetIssueLocation(tree), "Check this potential box model size issue.");
}
super.visitRuleset(tree);
}
示例9: testPreserveNothingOnDirectory
import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testPreserveNothingOnDirectory() throws IOException {
FileSystem fs = FileSystem.get(config);
EnumSet<FileAttribute> attributes = EnumSet.noneOf(FileAttribute.class);
Path dst = new Path("/tmp/abc");
Path src = new Path("/tmp/src");
createDirectory(fs, src);
createDirectory(fs, dst);
fs.setPermission(src, fullPerm);
fs.setOwner(src, "somebody", "somebody-group");
fs.setTimes(src, 0, 0);
fs.setPermission(dst, noPerm);
fs.setOwner(dst, "nobody", "nobody-group");
fs.setTimes(dst, 100, 100);
CopyListingFileStatus srcStatus = new CopyListingFileStatus(fs.getFileStatus(src));
DistCpUtils.preserve(fs, dst, srcStatus, attributes, false);
CopyListingFileStatus dstStatus = new CopyListingFileStatus(fs.getFileStatus(dst));
// FileStatus.equals only compares path field, must explicitly compare all fields
Assert.assertFalse(srcStatus.getPermission().equals(dstStatus.getPermission()));
Assert.assertFalse(srcStatus.getOwner().equals(dstStatus.getOwner()));
Assert.assertFalse(srcStatus.getGroup().equals(dstStatus.getGroup()));
Assert.assertTrue(dstStatus.getAccessTime() == 100);
Assert.assertTrue(dstStatus.getModificationTime() == 100);
Assert.assertTrue(dstStatus.getReplication() == 0);
}
示例10: visitAnnotation
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public Void visitAnnotation(AnnotationTree tree, EnumSet<UseTypes> d) {
// System.err.println("tree.getType()= " + tree.toString());
// System.err.println("tree.getType()= " + tree.getClass());
//
TreePath tp = new TreePath(getCurrentPath(), tree.getAnnotationType());
handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
super.visitAnnotation(tree, EnumSet.noneOf(UseTypes.class));
//TODO: maybe should be considered
return null;
}
示例11: getPossibleFlowDirections
import java.util.EnumSet; //导入方法依赖的package包/类
private Set<EnumFacing> getPossibleFlowDirections(World worldIn, BlockPos pos) {
int i = 1000;
Set<EnumFacing> set = EnumSet.<EnumFacing> noneOf(EnumFacing.class);
for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
EnumFacing enumfacing = (EnumFacing) enumfacing0;
BlockPos blockpos = pos.offset(enumfacing);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
if (!this.isBlocked(worldIn, blockpos, iblockstate)
&& (iblockstate.getBlock().getMaterial() != this.blockMaterial
|| ((Integer) iblockstate.getValue(LEVEL)).intValue() > 0)) {
int j;
if (this.isBlocked(worldIn, blockpos.down(), worldIn.getBlockState(blockpos.down()))) {
j = this.func_176374_a(worldIn, blockpos, 1, enumfacing.getOpposite());
} else {
j = 0;
}
if (j < i) {
set.clear();
}
if (j <= i) {
set.add(enumfacing);
i = j;
}
}
}
return set;
}
示例12: testIllegalCreate
import java.util.EnumSet; //导入方法依赖的package包/类
public void testIllegalCreate() {
Collection<Color> empty = EnumSet.noneOf(Color.class);
try {
EnumMultiset.create(empty);
fail();
} catch (IllegalArgumentException expected) {}
}
示例13: 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();
}
示例14: get
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public Set<V> get() {
return EnumSet.noneOf(clazz);
}
示例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;
}