本文整理汇总了Java中com.google.common.collect.ImmutableSetMultimap.get方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSetMultimap.get方法的具体用法?Java ImmutableSetMultimap.get怎么用?Java ImmutableSetMultimap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableSetMultimap
的用法示例。
在下文中一共展示了ImmutableSetMultimap.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJarResolver
import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
private DefaultJavaLibrary.JarResolver createJarResolver(
final ImmutableMap<Path, String> classToSymbols) {
ImmutableSetMultimap.Builder<Path, String> resolveMapBuilder =
ImmutableSetMultimap.builder();
for (Map.Entry<Path, String> entry : classToSymbols.entrySet()) {
String fullyQualified = entry.getValue();
String packageName = fullyQualified.substring(0, fullyQualified.lastIndexOf('.'));
String className = fullyQualified.substring(fullyQualified.lastIndexOf('.'));
resolveMapBuilder.putAll(entry.getKey(), fullyQualified, packageName, className);
}
final ImmutableSetMultimap<Path, String> resolveMap = resolveMapBuilder.build();
return new DefaultJavaLibrary.JarResolver() {
@Override
public ImmutableSet<String> resolve(ProjectFilesystem filesystem, Path relativeClassPath) {
if (resolveMap.containsKey(relativeClassPath)) {
return resolveMap.get(relativeClassPath);
} else {
return ImmutableSet.of();
}
}
};
}
示例2: getNeededDependencies
import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
/**
* Using missing symbol events from the build and the JavaSymbolFinder class, build a list of
* missing dependencies for each broken target.
*/
public ImmutableSetMultimap<BuildTarget, BuildTarget> getNeededDependencies(
Collection<MissingSymbolEvent> missingSymbolEvents) throws InterruptedException {
ImmutableSetMultimap.Builder<BuildTarget, String> targetsMissingSymbolsBuilder =
ImmutableSetMultimap.builder();
for (MissingSymbolEvent event : missingSymbolEvents) {
if (event.getType() != MissingSymbolEvent.SymbolType.Java) {
throw new UnsupportedOperationException("Only implemented for Java.");
}
targetsMissingSymbolsBuilder.put(event.getTarget(), event.getSymbol());
}
ImmutableSetMultimap<BuildTarget, String> targetsMissingSymbols =
targetsMissingSymbolsBuilder.build();
ImmutableSetMultimap<String, BuildTarget> symbolProviders =
javaSymbolFinder.findTargetsForSymbols(ImmutableSet.copyOf(targetsMissingSymbols.values()));
ImmutableSetMultimap.Builder<BuildTarget, BuildTarget> neededDeps =
ImmutableSetMultimap.builder();
for (BuildTarget target: targetsMissingSymbols.keySet()) {
for (String symbol : targetsMissingSymbols.get(target)) {
// TODO(jacko): Properly handle symbols that are defined in more than one place.
// TODO(jacko): Properly handle target visibility.
neededDeps.putAll(target, ImmutableSortedSet.copyOf(symbolProviders.get(symbol)));
}
}
return neededDeps.build();
}
示例3: gatherEntryPointsFound
import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
private ImmutableSetMultimap<String, EntryPoint> gatherEntryPointsFound(
final ImmutableSet<Symbol> docIDsToScore, final File baseSystemDir,
final Set<String> systemsToUse, final ImmutableMap<Symbol, File> goldDocIDToFileMap,
final CoreNLPXMLLoader coreNLPXMLLoader,
final ImmutableMap<Symbol, File> coreNLPProcessedRawDocs) throws IOException {
final ImmutableSetMultimap.Builder<String, EntryPoint> entryPointsFoundBySystemB =
ImmutableSetMultimap.builder();
// we log the distribution of event types in the corpus for diagnostic purposes
final ImmutableMultiset.Builder<String> allEREEventTypes = ImmutableMultiset.builder();
for (Symbol docID : docIDsToScore) {
// EvalHack - 2016 dry run contains some files for which Serif spuriously adds this document ID
docID = Symbol.from(docID.asString().replace("-kbp", ""));
final EREDocument ereDoc = getEREDocument(docID, goldDocIDToFileMap);
final CoreNLPDocument coreNLPDoc =
coreNLPXMLLoader.loadFrom(coreNLPProcessedRawDocs.get(docID));
final EREAligner ereAligner = EREAligner.create(ereDoc, Optional.of(coreNLPDoc),
ontologyMapper);
// build an index of RoleAndIds to hoppers for lookup in the loop below
final ImmutableSetMultimap<RoleAndID, DocAndHopper> argsToDocEvents =
indexArgsToEventHopper(docID, ereDoc, allEREEventTypes);
for (final String system : systemsToUse) {
final File systemDir = new File(baseSystemDir, system);
try (final SystemOutputStore systemOutput = KBPEA2016OutputLayout.get().open(systemDir)) {
final ImmutableSet.Builder<RoleAndID> alignedEREArgs = ImmutableSet.builder();
// first, gather all document-level arguments which this system found which can
// be aligned to ERE
final Iterable<Response> responses = FluentIterable
.from(systemOutput.read(docID).arguments().responses())
.filter(BANNED_ROLES_FILTER)
.filter(Predicates.compose(not(in(BANNED_EVENTS)), type()));
for (final Response response : responses) {
final Optional<ScoringCorefID> argID =
ereAligner.argumentForResponse(response);
// query entry points can only be entities, not value fillers
if (argID.isPresent() && argID.get().scoringEntityType().isEntityType()) {
alignedEREArgs.add(RoleAndID.of(response.type().asString(), response.role().asString(),
argID.get().withinTypeID()));
}
}
// second, map these to document-level hoppers
for (final RoleAndID alignedArg : alignedEREArgs.build()) {
for (final DocAndHopper docAndHopper : argsToDocEvents.get(alignedArg)) {
entryPointsFoundBySystemB.put(system, EntryPoint.of(docAndHopper, alignedArg));
}
}
}
}
}
log.info("Distribution of event types in ERE: {}",
Multisets.copyHighestCountFirst(allEREEventTypes.build()));
return entryPointsFoundBySystemB.build();
}