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


Java ValueDifference.rightValue方法代码示例

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


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

示例1: describeMismatchSafely

import com.google.common.collect.MapDifference.ValueDifference; //导入方法依赖的package包/类
protected void describeMismatchSafely(String prefix, MapDifference<TestHistoryDifferenceKey, Collection<TestHistoryDifferenceDescription>> difference, Description mismatchDescription) {
	appendIfNonEmpty(mismatchDescription, prefix, "missing: ", difference.entriesOnlyOnLeft());
	appendIfNonEmpty(mismatchDescription, prefix, "unexpected: ", difference.entriesOnlyOnRight());
	for (Entry<TestHistoryDifferenceKey, ValueDifference<Collection<TestHistoryDifferenceDescription>>> entryDiffering : difference.entriesDiffering().entrySet()) {
		mismatchDescription.appendText(prefix).appendText("differing from expected: ")
				.appendValue(entryDiffering.getKey());
		ValueDifference<Collection<TestHistoryDifferenceDescription>> valueDifference = entryDiffering.getValue();
		Collection<TestHistoryDifferenceDescription> expectedCollection = valueDifference.leftValue();
		Collection<TestHistoryDifferenceDescription> actualCollection = valueDifference.rightValue();
		String newPrefix = prefix + "\t\t";
		if (expectedCollection.size() == 1 && actualCollection.size() == 1) {
			TestHistoryDifferenceDescription expected = Iterables.getOnlyElement(expectedCollection);
			TestHistoryDifferenceDescription actual = Iterables.getOnlyElement(actualCollection);
			describeMismatchSafely(newPrefix, expected, actual, mismatchDescription);
		} else {
			mismatchDescription.appendText(newPrefix).appendText("expected: ").appendValue(valueDifference.leftValue());
			mismatchDescription.appendText(newPrefix).appendText("actual: ").appendValue(valueDifference.rightValue());
		}
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:TestHistoryDifferenceCollectionMatcher.java

示例2: handleTepIpsUpdateEvent

import com.google.common.collect.MapDifference.ValueDifference; //导入方法依赖的package包/类
private void handleTepIpsUpdateEvent(OpenvswitchOtherConfigs origLocalIps,
        OpenvswitchOtherConfigs updatedLocalIps, String nodeId) {
    Map<String,
            String> origLocalIpMap = Optional
                    .ofNullable(bridgeMgr.getMultiValueMap(origLocalIps.getOtherConfigValue()))
                    .orElse(Collections.emptyMap());
    Map<String,
            String> updatedLocalIpMap = Optional
                    .ofNullable(bridgeMgr.getMultiValueMap(updatedLocalIps.getOtherConfigValue()))
                    .orElse(Collections.emptyMap());
    MapDifference<String, String> mapDiff = Maps.difference(origLocalIpMap, updatedLocalIpMap);

    // Handling only underlay network updates for existing for TEP ips
    // Added and removed TEP ips will be handled by
    // TunnelStateChangeListener
    Map<String, ValueDifference<String>> entriesDiffering = mapDiff.entriesDiffering();
    if (entriesDiffering == null || entriesDiffering.isEmpty()) {
        LOG.trace("No underlay network changes detected for for node {}", nodeId);
        return;
    }

    Optional<BigInteger> dpIdOpt = bridgeMgr.getDpIdFromManagerNodeId(nodeId);
    if (!dpIdOpt.isPresent()) {
        LOG.debug("Failed to get DPN id for node {}", nodeId);
        return;
    }

    BigInteger dpId = dpIdOpt.get();
    for (Entry<String, ValueDifference<String>> entry : entriesDiffering.entrySet()) {
        String srcTepIp = entry.getKey();
        ValueDifference<String> valueDiff = entry.getValue();
        String origUnderlayNetwork = valueDiff.leftValue();
        String updatedUnderlayNetwork = valueDiff.rightValue();
        handleTepIpChangeEvent(dpId, srcTepIp, origUnderlayNetwork, updatedUnderlayNetwork);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:37,代码来源:TunnelUnderlayNetworkChangeListener.java

示例3: sieveAlreadyLinkedTagRequests

import com.google.common.collect.MapDifference.ValueDifference; //导入方法依赖的package包/类
private Multimap<String, String> sieveAlreadyLinkedTagRequests(
        MapDifference<String, Collection<String>> linesDiff) {

    log.debug("linesDiff.equal?: {}", linesDiff.areEqual());
    log.trace("linesDiff.differences: {}", linesDiff.entriesDiffering());
    log.trace("linesDiff.left: {}", linesDiff.entriesOnlyOnLeft());
    log.trace("linesDiff.right: {}", linesDiff.entriesOnlyOnRight());
    log.trace("linesDiff.common: {}", linesDiff.entriesInCommon());

    Multimap<String, String> knownTagsForLinking = null;

    if (linesDiff.areEqual()) {
        // all requested tags have already been linked to the requested pojos
        // nothing to do
        log.info("All known tags already linked to requested pojos - no-op");
        knownTagsForLinking = HashMultimap.create();
    } else {
        log.info("Lines differ: {} differences, {} onLeft, {} onRight, {} common",
                  linesDiff.entriesDiffering().size(),
                  linesDiff.entriesOnlyOnLeft().size(),
                  linesDiff.entriesOnlyOnRight().size(),
                  linesDiff.entriesInCommon().size());

        // always keep the tags not linked yet from the requested lines - ie. the "on left" ones
        // (the "only in CSV" lines)
        Map<String, Collection<String>> retainedTags = linesDiff.entriesOnlyOnLeft();

        knownTagsForLinking = MultimapsUtil.forMap(retainedTags);
        log.debug("retaining leftSide: {}", retainedTags);

        // for entries which are present both in CSV and in the already linked associations:
        // further the filtering so as to exclude the entries already linked
        Map<String, ValueDifference<Collection<String>>> mapsDiff = linesDiff.entriesDiffering();
        log.debug("filtering mapsDiff: {}", mapsDiff);

        for (String tag : mapsDiff.keySet()) {
            ValueDifference<Collection<String>> differencesForTag = mapsDiff.get(tag);

            Collection<String> pojosOnlyInCsvForTag = differencesForTag.leftValue();
            Collection<String> pojosAlreadyLinkedForTag = differencesForTag.rightValue();

            Set<String> onlyInCsv = Sets.newHashSet(pojosOnlyInCsvForTag);
            Set<String> alreadyLinked = Sets.newHashSet(pojosAlreadyLinkedForTag);

            // keep the tags present in csv but not already linked in database
            Set<String> retainedPojosNames = Sets.difference(onlyInCsv, alreadyLinked);

            knownTagsForLinking.putAll(tag, retainedPojosNames);
        }

        log.info("Retained {} known tags not linked to requested pojos",
                 knownTagsForLinking.size());
    }

    log.debug("knownTagsForLinking: {} - {}", knownTagsForLinking.size(), knownTagsForLinking);

    return knownTagsForLinking;
}
 
开发者ID:imagopole,项目名称:omero-csv-tools,代码行数:59,代码来源:DefaultCsvAnnotationService.java


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