List of usage examples for com.google.common.collect Multimap values
Collection<V> values();
From source file:org.eclipse.andmore.internal.wizards.exportgradle.FinalPage.java
@Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { mStatus = mBuilder.getStatus();//from ww w. j a va 2 s. com mBuilder.setCanFinish(!mStatus.hasError()); mBuilder.setCanGenerate(false); StringBuilder sb = new StringBuilder(); if (mStatus.hasError()) { sb.append("There was an error!").append("\n\n"); String errorMsg = mStatus.getErrorMessage(); if (errorMsg != null) { sb.append(errorMsg); } Multimap<FileStatus, File> fileStatusMap = mStatus.getFileStatus(); Collection<File> files = fileStatusMap.values(); if (files != null) { sb.append("\n\n").append("Error on files:").append('\n'); for (File file : files) { sb.append("\n").append(file.getAbsolutePath()); } } } else { sb.append("Export successful.\n\n"); int count = mBuilder.getModuleCount(); if (count > 1) { sb.append(String.format("Exported %s modules", count)).append('\n'); sb.append(String.format("Root folder: %s", mBuilder.getCommonRoot().toOSString())); } else { sb.append("Exported project: ").append(mBuilder.getCommonRoot().toOSString()); } sb.append("\n\n").append("Choose 'import project' in Android Studio").append('\n'); sb.append("and select the following file:").append("\n\t"); File bGradle = new File(mBuilder.getCommonRoot().toFile(), BuildFileCreator.BUILD_FILE); sb.append(bGradle.getAbsolutePath()); sb.append("\n\n").append("Do NOT import the Eclipse project itself!"); } mText.setText(sb.toString()); } }
From source file:com.android.ide.eclipse.adt.internal.wizards.exportgradle.FinalPage.java
@Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { mStatus = mBuilder.getStatus();//from w ww. j a v a2s .com mBuilder.setCanFinish(!mStatus.hasError()); mBuilder.setCanGenerate(false); StringBuilder sb = new StringBuilder(); if (mStatus.hasError()) { sb.append("There was an error!").append("\n\n"); String errorMsg = mStatus.getErrorMessage(); if (errorMsg != null) { sb.append(errorMsg); } Multimap<FileStatus, File> fileStatusMap = mStatus.getFileStatus(); Collection<File> files = fileStatusMap.values(); if (files != null) { sb.append("\n\n").append("Error on files:").append('\n'); for (File file : files) { sb.append("\n").append(file.getAbsolutePath()); } } } else { sb.append("Export successful.\n\n"); int count = mBuilder.getModuleCount(); if (count > 1) { sb.append(String.format("Exported %s modules", count)).append('\n'); sb.append(String.format("Root folder: %s", mBuilder.getCommonRoot().toOSString())); } else { sb.append("Exported project: ").append(mBuilder.getCommonRoot().toOSString()); } sb.append("\n\n").append("Choose 'Import Non-Android Studio project' in Android Studio") .append('\n'); sb.append("and select the following file:").append("\n\t"); File bGradle = new File(mBuilder.getCommonRoot().toFile(), BuildFileCreator.BUILD_FILE); sb.append(bGradle.getAbsolutePath()); sb.append("\n\n").append("Do NOT import the Eclipse project itself!"); } mText.setText(sb.toString()); } }
From source file:org.sonar.plugins.groovy.codenarc.CodeNarcSourceAnalyzer.java
@Override public Results analyze(RuleSet ruleSet) { Multimap<File, FileResults> resultsByFileByDirectory = processFiles(ruleSet); DirectoryResults directoryResults = new DirectoryResults("."); for (FileResults fileResults : resultsByFileByDirectory.values()) { directoryResults.addChild(fileResults); }//from ww w. j av a2s . c o m return directoryResults; }
From source file:io.crate.planner.ReaderAllocations.java
ReaderAllocations(TreeMap<String, Integer> bases, Map<String, Map<Integer, String>> shardNodes, Multimap<TableIdent, String> tableIndices) { this.bases = bases; this.tableIndices = tableIndices; this.indicesToIdents = new HashMap<>(tableIndices.values().size()); for (Map.Entry<TableIdent, String> entry : tableIndices.entries()) { indicesToIdents.put(entry.getValue(), entry.getKey()); }/* ww w .jav a 2 s . c o m*/ for (Map.Entry<String, Integer> entry : bases.entrySet()) { readerIndices.put(entry.getValue(), entry.getKey()); } for (Map.Entry<String, Map<Integer, String>> entry : shardNodes.entrySet()) { Integer base = bases.get(entry.getKey()); if (base == null) { continue; } for (Map.Entry<Integer, String> nodeEntries : entry.getValue().entrySet()) { int readerId = base + nodeEntries.getKey(); IntSet readerIds = nodeReaders.get(nodeEntries.getValue()); if (readerIds == null) { readerIds = new IntHashSet(); nodeReaders.put(nodeEntries.getValue(), readerIds); } readerIds.add(readerId); } } }
From source file:org.eclipse.xtext.mwe.Reader.java
protected void populateResourceSet(ResourceSet set, Multimap<String, URI> uris) { Collection<URI> values = Sets.newHashSet(uris.values()); for (URI uri : values) { set.createResource(uri);/* ww w .j a v a 2s. c o m*/ } }
From source file:springfox.documentation.swagger2.mappers.ServiceModelToSwagger2Mapper.java
protected Map<String, Path> mapApiListings(Multimap<String, ApiListing> apiListings) { Map<String, Path> paths = newHashMap(); for (ApiListing each : apiListings.values()) { for (ApiDescription api : each.getApis()) { paths.put(api.getPath(), mapOperations(api, Optional.fromNullable(paths.get(api.getPath())))); }// w w w . j ava 2s . c om } return paths; }
From source file:eu.esdihumboldt.hale.common.core.service.cleanup.impl.CleanupServiceImpl.java
private <T> Collection<T> take(CleanupContext context, Multimap<CleanupContext, T> elements) { switch (context) { case APPLICATION: // all elements Collection<T> res1 = new ArrayList<T>(elements.values()); elements.clear();/* w w w . jav a2 s.c o m*/ return res1; default: Collection<T> res2 = new ArrayList<T>(elements.get(context)); elements.removeAll(context); return res2; } }
From source file:eu.interedition.collatex.medite.Matches.java
public static Matches between(VariantGraph.Vertex[][] vertices, SuffixTree<Token> suffixTree, Function<SortedSet<VertexMatch.WithTokenIndex>, Integer> matchEvaluator) { final Multimap<Integer, MatchThreadElement> matchThreads = HashMultimap.create(); for (int rank = 0; rank < vertices.length; rank++) { for (VariantGraph.Vertex vertex : vertices[rank]) { final MatchThreadElement matchThreadElement = new MatchThreadElement(suffixTree).advance(vertex, rank);//from w ww. j av a 2s. co m if (matchThreadElement != null) { matchThreads.put(rank, matchThreadElement); } } for (MatchThreadElement matchThreadElement : matchThreads.get(rank - 1)) { for (VariantGraph.Vertex vertex : vertices[rank]) { final MatchThreadElement advanced = matchThreadElement.advance(vertex, rank); if (advanced != null) { matchThreads.put(rank, advanced); } } } } final Matches matches = new Matches(matchThreads.size()); for (MatchThreadElement matchThreadElement : matchThreads.values()) { final List<SortedSet<VertexMatch.WithTokenIndex>> threadPhrases = Lists.newArrayList(); boolean firstElement = true; for (MatchThreadElement threadElement : matchThreadElement.thread()) { final SuffixTree<Token>.EquivalenceClass equivalenceClass = threadElement.cursor.matchedClass(); for (int mc = 0; mc < equivalenceClass.length; mc++) { final int tokenCandidate = equivalenceClass.members[mc]; if (firstElement) { final SortedSet<VertexMatch.WithTokenIndex> phrase = new TreeSet<VertexMatch.WithTokenIndex>(); phrase.add(new VertexMatch.WithTokenIndex(threadElement.vertex, threadElement.vertexRank, tokenCandidate)); threadPhrases.add(phrase); } else { for (SortedSet<VertexMatch.WithTokenIndex> phrase : threadPhrases) { if ((phrase.last().token + 1) == tokenCandidate) { phrase.add(new VertexMatch.WithTokenIndex(threadElement.vertex, threadElement.vertexRank, tokenCandidate)); } } } } firstElement = false; } matches.addAll(threadPhrases); } Collections.sort(matches, maximalUniqueMatchOrdering(matchEvaluator)); return matches; }
From source file:fr.jcgay.maven.plugin.buildplan.ListPhaseMojo.java
public void execute() throws MojoExecutionException, MojoFailureException { Multimap<String, MojoExecution> phases = Groups.ByPhase.of(calculateExecutionPlan().getMojoExecutions(), phase);/*ww w.ja va 2 s . c o m*/ if (!phases.isEmpty()) { TableDescriptor descriptor = ListPhaseTableDescriptor.of(phases.values()); for (Map.Entry<String, Collection<MojoExecution>> currentPhase : phases.asMap().entrySet()) { getLog().info(phaseTitleLine(descriptor, currentPhase.getKey())); for (MojoExecution execution : currentPhase.getValue()) { getLog().info(line(descriptor.rowFormat(), execution)); } } } else { getLog().warn("No plugin execution found within phase: " + phase); } }
From source file:org.eclipse.sirius.business.internal.session.SessionEventBrokerImpl.java
private void removeListenerFromMap(ModelChangeTrigger listenerToRemove, Multimap<?, ModelChangeTrigger> map) { Iterator<ModelChangeTrigger> it = map.values().iterator(); while (it.hasNext()) { ModelChangeTrigger cur = it.next(); if (cur == listenerToRemove) { it.remove();/* www.j a v a 2 s. com*/ } } }