本文整理汇总了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());
}
}
}
示例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);
}
}
示例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;
}