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


Java EnumSet.complementOf方法代码示例

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


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

示例1: main

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Main routine for lambda forms garbage collection test.
 *
 * @param args Accepts no arguments.
 */
public static void main(String[] args) {
    // The "identity", "constant", "arrayElementGetter" and "arrayElementSetter"
    // methods should be removed from this test,
    // because their lambda forms are stored in a static field and are not GC'ed.
    // There can be only a finite number of such LFs for each method,
    // so no memory leak happens.
    EnumSet<TestMethods> testMethods = EnumSet.complementOf(EnumSet.of(
            TestMethods.IDENTITY,
            TestMethods.CONSTANT,
            TestMethods.ARRAY_ELEMENT_GETTER,
            TestMethods.ARRAY_ELEMENT_SETTER,
            TestMethods.EXACT_INVOKER,
            TestMethods.INVOKER));
    LambdaFormTestCase.runTests(LFGarbageCollectedTest::new, testMethods);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:LFGarbageCollectedTest.java

示例2: testBuildWithCountryDbAndCityFields

import java.util.EnumSet; //导入方法依赖的package包/类
public void testBuildWithCountryDbAndCityFields() throws Exception {
    GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders);
    Map<String, Object> config = new HashMap<>();
    config.put("field", "_field");
    config.put("database_file", "GeoLite2-Country.mmdb.gz");
    EnumSet<GeoIpProcessor.Property> cityOnlyProperties = EnumSet.complementOf(GeoIpProcessor.Property.ALL_COUNTRY_PROPERTIES);
    String cityProperty = RandomPicks.randomFrom(Randomness.get(), cityOnlyProperties).toString();
    config.put("properties", Collections.singletonList(cityProperty));
    try {
        factory.create(null, null, config);
        fail("Exception expected");
    } catch (ElasticsearchParseException e) {
        assertThat(e.getMessage(), equalTo("[properties] illegal property value [" + cityProperty +
                "]. valid values are [IP, COUNTRY_ISO_CODE, COUNTRY_NAME, CONTINENT_NAME]"));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:GeoIpProcessorFactoryTests.java

示例3: setNexusObjectProviders

import java.util.EnumSet; //导入方法依赖的package包/类
public void setNexusObjectProviders(Map<ScanRole, List<NexusObjectProvider<?>>> nexusObjectProviderMap) {
	EnumSet<ScanRole> deviceTypes = EnumSet.complementOf(EnumSet.of(ScanRole.MONITOR_PER_SCAN));
	List<NexusObjectProvider<?>> nexusObjectProviderList = nexusObjectProviderMap.entrySet().stream()
		.filter(e -> deviceTypes.contains(e.getKey())) // filter where key is in deviceType set
		.flatMap(e -> e.getValue().stream())  // concatenate value lists into a single stream
		.collect(Collectors.toList());  // collect in a list

	this.nexusObjectProviders = nexusObjectProviderList;

	final List<NexusObjectProvider<?>> detectors = nexusObjectProviderMap.get(ScanRole.DETECTOR);
	// we can write the unique key for each position on move if all detectors write their own unique key
	// TODO what about monitors?
	if (detectors != null) {
		writeAfterMovePerformed = detectors.stream().allMatch(n -> n.getPropertyValue(PROPERTY_NAME_UNIQUE_KEYS_PATH) != null);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:17,代码来源:SolsticeScanMonitor.java

示例4: targetStarted

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public void targetStarted(BuildEvent event) {
    EnumSet<Target> statusKinds = firstTarget ?
            EnumSet.allOf(Target.class) :
            EnumSet.complementOf(EnumSet.of(Target.ANY));

    String targetName = event.getTarget().getName();

    for (Target statusKind : statusKinds) {
        if (statusKind.matches(targetName)) {
            StatusEvent statusEvent = new StatusEvent(event, statusKind);
            statusEvents.push(statusEvent);
            logger.taskStarted(statusEvent);
            firstTarget = false;
            return;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:JdkIdeaAntLogger.java

示例5: main

import java.util.EnumSet; //导入方法依赖的package包/类
public static void main(String[] args) {
    Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
       root.setLevel(Level.INFO);
       
       RefDiffConfigImpl config = new RefDiffConfigImpl();
       config.setId("xfinal");
       config.setThreshold(RelationshipType.MOVE_TYPE, 0.1);
       config.setThreshold(RelationshipType.RENAME_TYPE, 0.4);
       config.setThreshold(RelationshipType.EXTRACT_SUPERTYPE, 0.3);
       config.setThreshold(RelationshipType.MOVE_METHOD, 0.4);
       config.setThreshold(RelationshipType.RENAME_METHOD, 0.3);
       config.setThreshold(RelationshipType.PULL_UP_METHOD, 0.4);
       config.setThreshold(RelationshipType.PUSH_DOWN_METHOD, 0.6);
       config.setThreshold(RelationshipType.EXTRACT_METHOD, 0.3);
       config.setThreshold(RelationshipType.INLINE_METHOD, 0.3);
       config.setThreshold(RelationshipType.MOVE_FIELD, 0.1);
       config.setThreshold(RelationshipType.PULL_UP_FIELD, 0.2);
       config.setThreshold(RelationshipType.PUSH_DOWN_FIELD, 0.2);
       
	CalibrationDataset dataset = new CalibrationDataset();
	ResultComparator rc = new ResultComparator();
	rc.expect(dataset.getExpected());
	rc.dontExpect(dataset.getNotExpected());
	
	RefDiff refdiff = new RefDiff(config);
	for (RefactoringSet commit : dataset.getExpected()) {
		rc.compareWith("refdiff", ResultComparator.collectRmResult(refdiff, commit.getProject(), commit.getRevision()));
	}
	EnumSet<RefactoringType> types = EnumSet.complementOf(EnumSet.of(RefactoringType.MOVE_RENAME_CLASS));
	rc.printSummary(System.out, types);
	rc.printDetails(System.out, types);
	
	CompareResult r = rc.getCompareResult("refdiff", types);
	printTable3(r);
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:36,代码来源:TestWithCalibrationDataset.java

示例6: getExpectedCount

import java.util.EnumSet; //导入方法依赖的package包/类
public int getExpectedCount(EnumSet<RefactoringType> refTypesToConsider) {
    int sum = 0;
    EnumSet<RefactoringType> ignore = EnumSet.complementOf(refTypesToConsider);
    for (RefactoringSet set : expectedMap.values()) {
        sum += set.ignoring(ignore).getRefactorings().size();
    }
    return sum;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:9,代码来源:ResultComparator.java

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

示例8: otherFilter

import java.util.EnumSet; //导入方法依赖的package包/类
private static Predicate<String> otherFilter() {
    return (s) -> {
        for (JcstressGroup g : EnumSet.complementOf(EnumSet.of(OTHER))) {
            if (g.filter.test(s)) {
                return false;
            }
        }
        return true;
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TestGenerator.java

示例9: RepositoryBrowserPanel

import java.util.EnumSet; //导入方法依赖的package包/类
public RepositoryBrowserPanel () {
    this(EnumSet.complementOf(EnumSet.of(Option.DISPLAY_REVISIONS, Option.EXPAND_BRANCHES, Option.EXPAND_TAGS)),
            null, new File[0], null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:RepositoryBrowserPanel.java

示例10: run

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public void run(CodeCacheCLITestCase.Description testCaseDescription,
        CodeCacheOptions options) throws Throwable {
    CodeCacheOptions expectedValues
            = testCaseDescription.expectedValues(options);

    String[] expectedMessages
            = testCaseDescription.involvedCodeHeaps.stream()
                    .map(heap -> CodeCacheInfoFormatter.forHeap(heap)
                            .withSize(expectedValues.sizeForHeap(heap)))
                    .map(CodeCacheInfoFormatter::getInfoString)
                    .toArray(String[]::new);

    EnumSet<BlobType> unexpectedHeapsSet
            = EnumSet.complementOf(testCaseDescription.involvedCodeHeaps);

    String[] unexpectedMessages = CodeCacheInfoFormatter.forHeaps(
            unexpectedHeapsSet.toArray(
                    new BlobType[unexpectedHeapsSet.size()]));

    String description = String.format("JVM output should contain entries "
            + "for following code heaps: [%s] and should not contain "
            + "entries for following code heaps: [%s].",
            testCaseDescription.involvedCodeHeaps.stream()
                    .map(BlobType::name)
                    .collect(Collectors.joining(", ")),
            unexpectedHeapsSet.stream()
                    .map(BlobType::name)
                    .collect(Collectors.joining(", ")));

    CommandLineOptionTest.verifySameJVMStartup(expectedMessages,
            unexpectedMessages, "JVM startup failure is not expected, "
            + "since all options have allowed values", description,
            ExitCode.OK,
            testCaseDescription.getTestOptions(options,
                    CommandLineOptionTest.prepareBooleanFlag(
                            "PrintCodeCache", printCodeCache),
                    // Do not use large pages to avoid large page
                    // alignment of code heaps affecting their size.
                    "-XX:-UseLargePages"));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:PrintCodeCacheRunner.java

示例11: boundsToCheck

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * The list of bound kinds to be checked.
 */
EnumSet<InferenceBound> boundsToCheck() {
    return (from == InferenceBound.EQ) ?
                    EnumSet.allOf(InferenceBound.class) :
                    EnumSet.complementOf(EnumSet.of(from));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Infer.java

示例12: forward

import java.util.EnumSet; //导入方法依赖的package包/类
EnumSet<InferenceBound> forward() {
    return (ib == InferenceBound.EQ) ?
            EnumSet.of(InferenceBound.EQ) : EnumSet.complementOf(EnumSet.of(ib));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:Infer.java

示例13: complementOf

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Creates an {@code EnumSet} consisting of all enum values that are not in
 * the specified collection. This is equivalent to
 * {@link EnumSet#complementOf}, but can act on any input collection, as long
 * as the elements are of enum type.
 *
 * @param collection the collection whose complement should be stored in the
 *     {@code EnumSet}
 * @param type the type of the elements in the set
 * @return a new, modifiable {@code EnumSet} initially containing all the
 *     values of the enum not present in the given collection
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(
    Collection<E> collection, Class<E> type) {
  checkNotNull(collection);
  return (collection instanceof EnumSet)
      ? EnumSet.complementOf((EnumSet<E>) collection)
      : makeComplementByHand(collection, type);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:Sets.java

示例14: complementOf

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Creates an {@code EnumSet} consisting of all enum values that are not in
 * the specified collection. If the collection is an {@link EnumSet}, this
 * method has the same behavior as {@link EnumSet#complementOf}. Otherwise,
 * the specified collection must contain at least one element, in order to
 * determine the element type. If the collection could be empty, use
 * {@link #complementOf(Collection, Class)} instead of this method.
 *
 * @param collection the collection whose complement should be stored in the
 *     enum set
 * @return a new, modifiable {@code EnumSet} containing all values of the enum
 *     that aren't present in the given collection
 * @throws IllegalArgumentException if {@code collection} is not an
 *     {@code EnumSet} instance and contains no elements
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(Collection<E> collection) {
  if (collection instanceof EnumSet) {
    return EnumSet.complementOf((EnumSet<E>) collection);
  }
  checkArgument(
      !collection.isEmpty(), "collection is empty; use the other version of this method");
  Class<E> type = collection.iterator().next().getDeclaringClass();
  return makeComplementByHand(collection, type);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:25,代码来源:Sets.java


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