List of usage examples for com.google.common.collect Multimap values
Collection<V> values();
From source file:org.drools.verifier.report.html.MissingRangesReportVisitor.java
public static Collection<String> visitRestrictionsCollection(String sourceFolder, Collection<Restriction> restrictions, Collection<MissingRange> causes) { Multimap<String, DataRow> dt = TreeMultimap.create(); Collection<String> stringRows = new ArrayList<String>(); for (MissingRange cause : causes) { dt.put(cause.getValueAsString(), new DataRow(null, null, cause.getOperator(), cause.getValueAsString())); }//from w w w . j a v a 2 s . co m for (Restriction r : restrictions) { if (r instanceof NumberRestriction) { try { NumberRestriction restriction = (NumberRestriction) r; dt.put(restriction.getValue().toString(), new DataRow(restriction.getRulePath(), restriction.getRuleName(), restriction.getOperator(), restriction.getValueAsString())); } catch (Exception e) { e.printStackTrace(); } } } DataRow previous = null; for (Iterator<DataRow> iterator = dt.values().iterator(); iterator.hasNext();) { DataRow current = iterator.next(); if (previous != null) { // Check if previous and current are from the same rule. if (previous.ruleId == null && current.ruleId == null && !previous.operator.equals(Operator.EQUAL) && !previous.operator.equals(Operator.NOT_EQUAL) && !current.operator.equals(Operator.EQUAL) && !current.operator.equals(Operator.NOT_EQUAL)) { // Combine these two. stringRows.add("Missing : " + previous + " .. " + current); if (iterator.hasNext()) current = iterator.next(); } else if (previous.ruleId != null && previous.ruleId.equals(current.ruleId)) { // Combine these two. stringRows.add(UrlFactory.getRuleUrl(sourceFolder, current.ruleId, current.ruleName) + " : " + previous.toString() + " " + current.toString()); if (iterator.hasNext()) current = iterator.next(); } else if (!iterator.hasNext()) { // If this is last row // Print previous and current if they were not merged. processRangeOutput(previous, stringRows, sourceFolder); processRangeOutput(current, stringRows, sourceFolder); } else { // If they are not from the same rule // Print previous. processRangeOutput(previous, stringRows, sourceFolder); } } else if (!iterator.hasNext()) { processRangeOutput(current, stringRows, sourceFolder); } // Set current as previous. previous = current; } return stringRows; }
From source file:com.google.devtools.build.lib.query2.AbstractUnfilteredTTVDTCVisitor.java
@Override protected Visit getVisitResult(Iterable<SkyKey> ttvKeys) throws InterruptedException { Multimap<SkyKey, SkyKey> deps = env.getUnfilteredDirectDepsOfSkyKeys(ttvKeys); return new Visit(/*keysToUseForResult=*/ deps.keySet(), /*keysToVisit=*/ deps.values().stream() .filter(SkyQueryEnvironment.IS_TTV).collect(ImmutableList.toImmutableList())); }
From source file:org.spongepowered.common.mixin.core.authlib.MixinPropertyMap.java
@Override public boolean putAll(Multimap<? extends String, ? extends ProfileProperty> multimap) { for (ProfileProperty property : multimap.values()) { this.sanityCheck(property); }/*from w ww. j a v a2 s . com*/ return this.delegate().putAll(multimap); }
From source file:org.deephacks.tools4j.config.internal.core.jpa.JpaBeanToBeanConverter.java
private Map<BeanId, Bean> convertBeans(Multimap<BeanId, JpaBean> refs) { Map<BeanId, Bean> beans = new HashMap<BeanId, Bean>(); for (JpaBean jpaBean : refs.values()) { if (beans.get(jpaBean.getId()) != null) { continue; }/*from w w w . ja v a 2s.c om*/ Bean bean = convertProperties(jpaBean); for (JpaRef ref : jpaBean.getReferences()) { bean.addReference(ref.getPropertyName(), ref.getTarget()); } beans.put(jpaBean.getId(), bean); } return beans; }
From source file:org.edna.datamodel.transformations.workflow.ReaderExt.java
@Override protected void populateResourceSet(ResourceSet set, Multimap<String, URI> uris) { Collection<URI> values = Sets.newHashSet(uris.values()); for (URI uri : values) { set.getResource(uri, true);/*from www.j a va2 s . co m*/ } ctx.set(resourceSetSlot, set); }
From source file:co.paralleluniverse.galaxy.core.NodeDeathLayer.java
@Override public void nodeRemoved(short node) { final Multimap<Long, LineMessage> mm = pending.get(node); for (LineMessage m : mm.values()) { final Message response = genResponse(m); if (response != null) cache.receive(shortCircuitMessage(m.getNode(), response)); }/*from ww w .j a v a 2 s . co m*/ pending.remove(node); }
From source file:org.apache.phoenix.hbase.index.write.LeaveIndexActiveFailurePolicy.java
@Override public void handleFailure(Multimap<HTableInterfaceReference, Mutation> attempted, Exception cause) throws IOException { // get timestamp of first cell long ts = attempted.values().iterator().next().getFamilyCellMap().values().iterator().next().get(0) .getTimestamp();/*from w w w.j a v a 2s . co m*/ throw ServerUtil.wrapInDoNotRetryIOException( "Unable to update the following indexes: " + attempted.keySet(), cause, ts); }
From source file:com.google.devtools.build.lib.query2.TransitiveTraversalValueDTCVisitor.java
@Override protected Visit getVisitResult(Iterable<SkyKey> ttvKeys) throws InterruptedException { Multimap<SkyKey, SkyKey> deps = env.getDirectDepsOfSkyKeys(ttvKeys); return new Visit(/*keysToUseForResult=*/ deps.keySet(), /*keysToVisit=*/ deps.values().stream() .filter(SkyQueryEnvironment.IS_TTV).collect(ImmutableList.toImmutableList())); }
From source file:org.sosy_lab.cpachecker.core.defaults.precision.ScopedRefinablePrecision.java
@Override public ScopedRefinablePrecision withIncrement(Multimap<CFANode, MemoryLocation> increment) { if (this.rawPrecision.containsAll(increment.values())) { return this; } else {/*from w w w. ja v a2 s . c om*/ SortedSet<MemoryLocation> refinedPrec = new TreeSet<>(rawPrecision); refinedPrec.addAll(increment.values()); return new ScopedRefinablePrecision(super.getBaseline(), ImmutableSortedSet.copyOf(refinedPrec)); } }
From source file:matteroverdrive.items.android.BionicPart.java
public void addDetails(ItemStack itemstack, EntityPlayer player, List infos) { super.addDetails(itemstack, player, infos); Multimap<String, AttributeModifier> multimap = getModifiers(AndroidPlayer.get(player), itemstack); if (multimap != null) { multimap.values().stream().forEach(modifier -> { switch (modifier.getOperation()) { case 0: infos.add(EnumChatFormatting.GREEN + String.format("%s: +%s", modifier.getName(), modifier.getAmount())); break; case 1: infos.add(EnumChatFormatting.GREEN + String.format("%s: %s", modifier.getName(), (modifier.getAmount() >= 0 ? "+" : "") + DecimalFormat.getPercentInstance().format(modifier.getAmount()))); break; default: infos.add(EnumChatFormatting.GREEN + String.format("%s: %s", modifier.getName(), DecimalFormat.getPercentInstance().format(modifier.getAmount() + 1))); }//w w w . j ava 2s . c o m }); } }