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


Java EnumSet.add方法代码示例

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


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

示例1: testDeviceIndex

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testDeviceIndex() throws Exception {
	EnumSet<IDeviceService.DeviceField> indexFields =
			EnumSet.noneOf(IDeviceService.DeviceField.class);
	indexFields.add(IDeviceService.DeviceField.IPv4);
	indexFields.add(IDeviceService.DeviceField.VLAN);
	deviceManager.addIndex(false, indexFields);

	indexFields = EnumSet.noneOf(IDeviceService.DeviceField.class);
	deviceManager.addIndex(false, indexFields);

	ITopologyService mockTopology = createMock(ITopologyService.class);
	deviceManager.topology = mockTopology;
	expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort()))).
			andReturn(true).anyTimes();
	expect(mockTopology.getOpenflowDomainId(DatapathId.of(EasyMock.anyLong()))).andReturn(DatapathId.of(1L)).anyTimes();
	replay(mockTopology);
	doTestDeviceQuery();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:DeviceManagerImplTest.java

示例2: findTimeZoneNames

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Returns a collection of time zone display name matches for the specified types in the
 * given text at the given offset. This method only finds matches from the TimeZoneNames
 * used by this object.
 * @param text the text
 * @param start the start offset in the text
 * @param types the set of name types.
 * @return A collection of match info.
 */
private Collection<MatchInfo> findTimeZoneNames(String text, int start, EnumSet<GenericNameType> types) {
    Collection<MatchInfo> tznamesMatches = null;

    // Check if the target name type is really in the TimeZoneNames
    EnumSet<NameType> nameTypes = EnumSet.noneOf(NameType.class);
    if (types.contains(GenericNameType.LONG)) {
        nameTypes.add(NameType.LONG_GENERIC);
        nameTypes.add(NameType.LONG_STANDARD);
    }
    if (types.contains(GenericNameType.SHORT)) {
        nameTypes.add(NameType.SHORT_GENERIC);
        nameTypes.add(NameType.SHORT_STANDARD);
    }

    if (!nameTypes.isEmpty()) {
        // Find matches in the TimeZoneNames
        tznamesMatches = _tznames.find(text, start, nameTypes);
    }
    return tznamesMatches;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:30,代码来源:TimeZoneGenericNames.java

示例3: 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:Dependencies.java

示例4: parseString

import java.util.EnumSet; //导入方法依赖的package包/类
public static EnumSet<Metric> parseString(String param, boolean ignoreUnknown) {
    String[] metrics = Strings.splitStringByCommaToArray(param);
    EnumSet<Metric> result = EnumSet.noneOf(Metric.class);
    for (String metric : metrics) {
        if ("_all".equals(metric)) {
            result = EnumSet.allOf(Metric.class);
            break;
        }
        Metric m = valueToEnum.get(metric);
        if (m == null) {
            if (!ignoreUnknown) {
                throw new IllegalArgumentException("Unknown metric [" + metric + "]");
            }
        } else {
            result.add(m);
        }
    }
    return result;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:ClusterState.java

示例5: getVerboseResolutionMode

import java.util.EnumSet; //导入方法依赖的package包/类
static EnumSet<VerboseResolutionMode> getVerboseResolutionMode(Options opts) {
    String s = opts.get("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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Resolve.java

示例6: initBarcodeReader

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Initialize the barcode decoder.
 */
private void initBarcodeReader(List<String> barCodeTypes) {
    EnumMap<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
    EnumSet<BarcodeFormat> decodeFormats = EnumSet.noneOf(BarcodeFormat.class);

    if (barCodeTypes != null) {
        for (String code : barCodeTypes) {
            BarcodeFormat format = parseBarCodeString(code);
            if (format != null) {
                decodeFormats.add(format);
            }
        }
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
    _multiFormatReader.setHints(hints);
}
 
开发者ID:entria,项目名称:react-native-camera-face-detector,代码行数:20,代码来源:RCTCameraViewFinder.java

示例7: getSelectedOptions

import java.util.EnumSet; //导入方法依赖的package包/类
private final EnumSet<DialogOption> getSelectedOptions() {
    EnumSet<DialogOption> selected = EnumSet.noneOf(DialogOption.class);
    for (Item item : mItems) {
        if (item.isSelected()) selected.add(item.getOption());
    }
    return selected;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:8,代码来源:ClearBrowsingDataPreferences.java

示例8: createModifierSet

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Creates a {@code Set} of {@code Modifier}s from the given list
 * of modifiers.
 * 
 * @param  modifiers  modifiers that should be contained in the set
 * @return  set containing exactly the given modifiers
 */
static Set<Modifier> createModifierSet(Modifier... modifiers) {
    EnumSet<Modifier> modifierSet = EnumSet.noneOf(Modifier.class);
    for (Modifier m : modifiers) {
        modifierSet.add(m);
    }
    return modifierSet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:AbstractTestGenerator.java

示例9: 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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:29,代码来源:FlagOpTest.java

示例10: setSessionPersistPolicies

import java.util.EnumSet; //导入方法依赖的package包/类
public void setSessionPersistPolicies(String sessionPersistPolicies) {
	String[] policyArray = sessionPersistPolicies.split(",");
	EnumSet<SessionPersistPolicy> policySet = EnumSet.of(SessionPersistPolicy.DEFAULT);
	for (String policyName : policyArray) {
		SessionPersistPolicy policy = SessionPersistPolicy.fromName(policyName);
		policySet.add(policy);
	}
	this.sessionPersistPoliciesSet = policySet;
}
 
开发者ID:appNG,项目名称:appng-tomcat-session,代码行数:10,代码来源:RedisSessionManager.java

示例11: convert

import java.util.EnumSet; //导入方法依赖的package包/类
public static EnumSet<XAttrSetFlag> convert(int flag) {
  EnumSet<XAttrSetFlag> result = 
      EnumSet.noneOf(XAttrSetFlag.class);
  if ((flag & XAttrSetFlagProto.XATTR_CREATE_VALUE) == 
      XAttrSetFlagProto.XATTR_CREATE_VALUE) {
    result.add(XAttrSetFlag.CREATE);
  }
  if ((flag & XAttrSetFlagProto.XATTR_REPLACE_VALUE) == 
      XAttrSetFlagProto.XATTR_REPLACE_VALUE) {
    result.add(XAttrSetFlag.REPLACE);
  }
  return result;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:PBHelper.java

示例12: create

import java.util.EnumSet; //导入方法依赖的package包/类
private <T extends Enum<T>> EnumSet<T> create(final Class<T> type, final String s) {
    final String[] enumValues = s.split(",");
    final EnumSet<T> set = EnumSet.noneOf(type);
    for (final String enumValue : enumValues) {
        if (enumValue.length() > 0) {
            final T value = Enum.valueOf(type, enumValue);
            set.add(value);
        }
    }
    return set;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:EnumSetConverter.java

示例13: convertCacheFlags

import java.util.EnumSet; //导入方法依赖的package包/类
public static EnumSet<CacheFlag> convertCacheFlags(int flags) {
  EnumSet<CacheFlag> result = EnumSet.noneOf(CacheFlag.class);
  if ((flags & CacheFlagProto.FORCE_VALUE) == CacheFlagProto.FORCE_VALUE) {
    result.add(CacheFlag.FORCE);
  }
  return result;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:PBHelper.java

示例14: 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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:38,代码来源:TestAppletLoggerContext.java

示例15: parsePlatformString

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Parse the platforms attribute returning the set of platform ids
 * 
 * @param platformStr String
 */
protected final EnumSet<Platform.Type> parsePlatformString(String platformStr)
{
    // Split the platform string and build up a set of platform types
  
    EnumSet<Platform.Type> platformTypes = EnumSet.noneOf(Platform.Type.class);
    if (platformStr == null || platformStr.length() == 0)
        return platformTypes;
  
    StringTokenizer token = new StringTokenizer(platformStr.toUpperCase(Locale.ENGLISH), ",");
    String typ = null;
  
    try
    {
        while (token.hasMoreTokens())
        {
  
            // Get the current platform type string and validate
  
            typ = token.nextToken().trim();
            Platform.Type platform = Platform.Type.valueOf(typ);
  
            if (platform != Platform.Type.Unknown)
                platformTypes.add(platform);
            else
                throw new AlfrescoRuntimeException("Invalid platform type, " + typ);
        }
    }
    catch (IllegalArgumentException ex)
    {
        throw new AlfrescoRuntimeException("Invalid platform type, " + typ);
    }
  
    // Return the platform types
  
    return platformTypes;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:AbstractServerConfigurationBean.java


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