public static PluginManager createPluginManager(String pluginFileName) {
try {
SetMultimap<String, Class<?>> info = LinkedHashMultimap.create();
Enumeration<URL> resourcesFiles = PluginManager.class.getClassLoader().getResources(pluginFileName);
while (resourcesFiles.hasMoreElements()) {
URL url = resourcesFiles.nextElement();
Properties properties = new Properties();
loadProperties(url, properties);
buildPluginNames(info, properties);
}
return new PluginManager(info);
} catch (IOException e) {
throw new GenerationException(e);
}
}
java类com.google.common.collect.LinkedHashMultimap的实例源码
PluginManager.java 文件源码
项目:raml-java-tools
阅读 39
收藏 0
点赞 0
评论 0
NullAway.java 文件源码
项目:NullAway
阅读 36
收藏 0
点赞 0
评论 0
/**
* @param entities field init info
* @param state visitor state
* @return a map from each constructor C to the nonnull fields that C does *not* initialize
*/
private SetMultimap<MethodTree, Symbol> checkConstructorInitialization(
FieldInitEntities entities, VisitorState state) {
SetMultimap<MethodTree, Symbol> result = LinkedHashMultimap.create();
Set<Symbol> nonnullInstanceFields = entities.nonnullInstanceFields();
Trees trees = Trees.instance(JavacProcessingEnvironment.instance(state.context));
for (MethodTree constructor : entities.constructors()) {
if (constructorInvokesAnother(constructor, state)) {
continue;
}
Set<Element> guaranteedNonNull =
guaranteedNonNullForConstructor(entities, state, trees, constructor);
for (Symbol fieldSymbol : nonnullInstanceFields) {
if (!guaranteedNonNull.contains(fieldSymbol)) {
result.put(constructor, fieldSymbol);
}
}
}
return result;
}
Loader.java 文件源码
项目:CustomWorldGen
阅读 49
收藏 0
点赞 0
评论 0
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
for (ModContainer mc : mods)
{
if (mc.getSource() != null)
{
dupsearch.put(mc, mc.getSource());
}
}
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet())
{
if (e.getCount() > 1)
{
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
SemevalReader.java 文件源码
项目:clearwsd
阅读 30
收藏 0
点赞 0
评论 0
/**
* Read Semeval keys file.
*
* @param path path to keys file
* @return map from sense IDs onto senses
*/
private static SetMultimap<String, String> readKeys(String path) {
try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
SetMultimap<String, String> keys = LinkedHashMultimap.create();
String line;
while ((line = reader.readLine()) != null) {
if (line.isEmpty()) {
continue;
}
String[] fields = line.split(" ");
for (int i = 1; i < fields.length; ++i) {
keys.put(fields[0], fields[i]);
}
}
return keys;
} catch (IOException e) {
throw new RuntimeException("Error reading sense keys file", e);
}
}
ResolvedFeatures.java 文件源码
项目:xtext-extras
阅读 42
收藏 0
点赞 0
评论 0
protected List<IResolvedOperation> computeAllOperations() {
JvmType rawType = getRawType();
if (!(rawType instanceof JvmDeclaredType)) {
return Collections.emptyList();
}
Multimap<String, AbstractResolvedOperation> processedOperations = LinkedHashMultimap.create();
for (IResolvedOperation resolvedOperation : getDeclaredOperations()) {
processedOperations.put(resolvedOperation.getDeclaration().getSimpleName(), (AbstractResolvedOperation) resolvedOperation);
}
if (targetVersion.isAtLeast(JavaVersion.JAVA8)) {
computeAllOperationsFromSortedSuperTypes((JvmDeclaredType) rawType, processedOperations);
} else {
Set<JvmType> processedTypes = Sets.newHashSet(rawType);
computeAllOperationsFromSuperTypes((JvmDeclaredType) rawType, processedOperations, processedTypes);
}
// make sure the declared operations are the first in the list
List<IResolvedOperation> result = new ArrayList<IResolvedOperation>(processedOperations.size());
result.addAll(getDeclaredOperations());
for (AbstractResolvedOperation operation : processedOperations.values()) {
if (operation.getDeclaration().getDeclaringType() != rawType) {
result.add(operation);
}
}
return Collections.unmodifiableList(result);
}
StaticImplicitMethodsFeatureForTypeProvider.java 文件源码
项目:xtext-extras
阅读 30
收藏 0
点赞 0
评论 0
protected Map<String, Collection<String>> denormalize(Multimap<Class<?>, Class<?>> classMapping) {
Multimap<String, String> result = LinkedHashMultimap.create();
for(Map.Entry<Class<?>, Class<?>> entry: classMapping.entries()) {
Class<?> key = entry.getKey();
Class<?> keyObjectType = ReflectionUtil.getObjectType(key);
Class<?> value = entry.getValue();
for(Method method: value.getDeclaredMethods()) {
if (Modifier.isStatic(method.getModifiers()) && method.getParameterTypes().length > 0) {
Class<?> paramType = method.getParameterTypes()[0];
Class<?> paramObjectType = ReflectionUtil.getObjectType(paramType);
if (keyObjectType.isAssignableFrom(paramObjectType)) {
result.put(paramObjectType.getCanonicalName(), value.getCanonicalName());
}
}
}
}
return ImmutableMultimap.copyOf(result).asMap();
}
EObjectDescriptionBasedStubGenerator.java 文件源码
项目:xtext-extras
阅读 25
收藏 0
点赞 0
评论 0
public String getJavaStubSource(IEObjectDescription description, IResourceDescription resourceDescription) {
if(isNestedType(description) || !isJvmDeclaredType(description)) {
return null;
}
Multimap<QualifiedName, IEObjectDescription> owner2nested = LinkedHashMultimap.create();
for(IEObjectDescription other: resourceDescription.getExportedObjects()) {
if(isJvmDeclaredType(other) && isNestedType(other))
owner2nested.put(getOwnerClassName(other.getQualifiedName()), other);
}
StringBuilder classSignatureBuilder = new StringBuilder();
QualifiedName qualifiedName = description.getQualifiedName();
if (qualifiedName.getSegments().size() > 1) {
String string = qualifiedName.toString();
classSignatureBuilder.append("package " + string.substring(0, string.lastIndexOf('.')) + ";");
}
appendType(description, owner2nested, classSignatureBuilder);
return classSignatureBuilder.toString();
}
Loader.java 文件源码
项目:TRHS_Club_Mod_2016
阅读 41
收藏 0
点赞 0
评论 0
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
for (ModContainer mc : mods)
{
if (mc.getSource() != null)
{
dupsearch.put(mc, mc.getSource());
}
}
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet())
{
if (e.getCount() > 1)
{
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
ImportScope.java 文件源码
项目:xtext-core
阅读 35
收藏 0
点赞 0
评论 0
protected Iterable<IEObjectDescription> getAliasedElements(Iterable<IEObjectDescription> candidates) {
Multimap<QualifiedName, IEObjectDescription> keyToDescription = LinkedHashMultimap.create();
Multimap<QualifiedName, ImportNormalizer> keyToNormalizer = HashMultimap.create();
for (IEObjectDescription imported : candidates) {
QualifiedName fullyQualifiedName = imported.getName();
for (ImportNormalizer normalizer : normalizers) {
QualifiedName alias = normalizer.deresolve(fullyQualifiedName);
if (alias != null) {
QualifiedName key = alias;
if (isIgnoreCase()) {
key = key.toLowerCase();
}
keyToDescription.put(key, new AliasedEObjectDescription(alias, imported));
keyToNormalizer.put(key, normalizer);
}
}
}
for (QualifiedName name : keyToNormalizer.keySet()) {
if (keyToNormalizer.get(name).size() > 1)
keyToDescription.removeAll(name);
}
return keyToDescription.values();
}
BaseInternalContentAssistParser.java 文件源码
项目:xtext-core
阅读 30
收藏 0
点赞 0
评论 0
public void after(EObject grammarElement) {
EObject foundGrammarElement = removeLast(grammarElements);
if (grammarElement != foundGrammarElement)
throw new IllegalStateException(
"expected element: '" + grammarElement + "', but was: '" + foundGrammarElement + "'");
if (grammarElement instanceof UnorderedGroup && indexToHandledElements != null) {
indexToHandledElements.removeAll(grammarElements.size());
} else if (!grammarElements.isEmpty()) {
int index = grammarElements.size() - 1;
if (grammarElements.get(index) instanceof UnorderedGroup) {
if (indexToHandledElements == null) {
indexToHandledElements = LinkedHashMultimap.create();
}
indexToHandledElements.put(index, (AbstractElement) grammarElement);
}
}
}
YoLemmaPostProcessor.java 文件源码
项目:textokit-core
阅读 26
收藏 0
点赞 0
评论 0
/**
* {@inheritDoc}
*/
@Override
public boolean process(MorphDictionary dict, Lemma.Builder lemmaBuilder,
Multimap<String, Wordform> wfMap) {
Multimap<String, Wordform> additionalWfs = LinkedHashMultimap.create();
for (String wfStr : wfMap.keySet()) {
// alternative wordform string
String altStr = StringUtils.replaceChars(wfStr, YO_CHARS, YO_REPLACEMENTS);
if (Objects.equal(wfStr, altStr)) {
continue;
} // else wfStr contains 'yo'
if (wfMap.containsKey(altStr)) {
// the wordform multimap already contains string without 'yo'
continue;
}
additionalWfs.putAll(altStr, wfMap.get(wfStr));
}
wfMap.putAll(additionalWfs);
return true;
}
AbstractInternalContentAssistParser.java 文件源码
项目:bts
阅读 36
收藏 0
点赞 0
评论 0
public void after(EObject grammarElement) {
EObject foundGrammarElement = grammarElements.remove(grammarElements.size() - 1);
if (grammarElement != foundGrammarElement)
throw new IllegalStateException("expected element: '" + grammarElement + "', but was: '"
+ foundGrammarElement + "'");
if (grammarElement instanceof UnorderedGroup && indexToHandledElements != null) {
indexToHandledElements.removeAll(grammarElements.size());
} else if (!grammarElements.isEmpty()) {
int index = grammarElements.size() - 1;
if (grammarElements.get(index) instanceof UnorderedGroup) {
if (indexToHandledElements == null) {
indexToHandledElements = LinkedHashMultimap.create();
}
indexToHandledElements.put(index, (AbstractElement) grammarElement);
}
}
}
DefaultReferenceFinder.java 文件源码
项目:bts
阅读 34
收藏 0
点赞 0
评论 0
protected void findLocalReferences(Iterable<URI> localTargets, ILocalResourceAccess localResourceAccess,
final IAcceptor<IReferenceDescription> acceptor, IProgressMonitor monitor) {
if ((monitor != null && monitor.isCanceled()))
return;
final Multimap<URI, URI> resource2target = LinkedHashMultimap.create();
for (URI targetURI : localTargets) {
resource2target.put(targetURI.trimFragment(), targetURI);
}
final SubMonitor subMonitor = SubMonitor.convert(monitor, resource2target.keySet().size());
for (final URI resourceURI : resource2target.keySet()) {
if (subMonitor.isCanceled())
return;
localResourceAccess.readOnly(resourceURI, new IUnitOfWork.Void<ResourceSet>() {
@Override
public void process(ResourceSet resourceSet) throws Exception {
Resource resource = resourceSet.getResource(resourceURI, true);
findLocalReferencesInResource(resource2target.get(resourceURI), resource, acceptor);
}
});
subMonitor.worked(1);
}
}
MethodFinder.java 文件源码
项目:FreeBuilder
阅读 44
收藏 0
点赞 0
评论 0
/**
* Returns all methods, declared and inherited, on {@code type}, except those specified by
* {@link Object}.
*
* <p>If method B overrides method A, only method B will be included in the return set.
* Additionally, if methods A and B have the same signature, but are on unrelated interfaces,
* one will be arbitrarily picked to be returned.
*/
public static ImmutableSet<ExecutableElement> methodsOn(TypeElement type, Elements elements)
throws CannotGenerateCodeException {
TypeElement objectType = elements.getTypeElement(Object.class.getCanonicalName());
SetMultimap<Signature, ExecutableElement> methods = LinkedHashMultimap.create();
for (TypeElement supertype : getSupertypes(type)) {
for (ExecutableElement method : methodsIn(supertype.getEnclosedElements())) {
if (method.getEnclosingElement().equals(objectType)) {
continue; // Skip methods specified by Object.
}
Signature signature = new Signature(method);
Iterator<ExecutableElement> iterator = methods.get(signature).iterator();
while (iterator.hasNext()) {
ExecutableElement otherMethod = iterator.next();
if (elements.overrides(method, otherMethod, type)
|| method.getParameters().equals(otherMethod.getParameters())) {
iterator.remove();
}
}
methods.put(signature, method);
}
}
return ImmutableSet.copyOf(methods.values());
}
Loader.java 文件源码
项目:CauldronGit
阅读 38
收藏 0
点赞 0
评论 0
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
for (ModContainer mc : mods)
{
if (mc.getSource() != null)
{
dupsearch.put(mc, mc.getSource());
}
}
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet())
{
if (e.getCount() > 1)
{
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
RegexUtils.java 文件源码
项目:swagger2markup
阅读 25
收藏 0
点赞 0
评论 0
/**
* Groups the operations by regex group. The key of the Multimap is the group name.
* The value of the Multimap is a PathOperation
*
* @param allOperations all operations
* @param headerPattern regex pattern used for determining headers
* @return Operations grouped by regex
*/
public static Multimap<String, PathOperation> groupOperationsByRegex(List<PathOperation> allOperations, Pattern headerPattern) {
Multimap<String, PathOperation> operationsGroupedByRegex = LinkedHashMultimap.create();
for (PathOperation operation : allOperations) {
String path = operation.getPath();
Matcher m = headerPattern.matcher(path);
if (m.matches() && m.group(1) != null) {
if (logger.isDebugEnabled()) {
logger.debug("Added path operation '{}' to header '{}'", operation, m.group(1));
}
operationsGroupedByRegex.put(m.group(1), operation);
} else {
if(logger.isWarnEnabled()) {
logger.warn("Operation '{}' does not match regex '{}' and will not be included in output", operation, headerPattern.toString());
}
}
}
return operationsGroupedByRegex;
}
TagUtils.java 文件源码
项目:swagger2markup
阅读 53
收藏 0
点赞 0
评论 0
/**
* Groups the operations by tag. The key of the Multimap is the tag name.
* The value of the Multimap is a PathOperation
*
* @param allOperations all operations
* @param operationOrdering comparator for operations, for a given tag
* @return Operations grouped by Tag
*/
public static Multimap<String, PathOperation> groupOperationsByTag(List<PathOperation> allOperations, Comparator<PathOperation> operationOrdering) {
Multimap<String, PathOperation> operationsGroupedByTag;
if (operationOrdering == null) {
operationsGroupedByTag = LinkedHashMultimap.create();
} else {
operationsGroupedByTag = MultimapBuilder.linkedHashKeys().treeSetValues(operationOrdering).build();
}
for (PathOperation operation : allOperations) {
List<String> tags = operation.getOperation().getTags();
Validate.notEmpty(tags, "Can't GroupBy.TAGS. Operation '%s' has no tags", operation);
for (String tag : tags) {
if (logger.isDebugEnabled()) {
logger.debug("Added path operation '{}' to tag '{}'", operation, tag);
}
operationsGroupedByTag.put(tag, operation);
}
}
return operationsGroupedByTag;
}
ExtensibleTelemetry.java 文件源码
项目:TeamClutch2016
阅读 21
收藏 0
点赞 0
评论 0
public ExtensibleTelemetry(int dataPointsToSend, @NotNull Telemetry telemetry) {
checkArgument(dataPointsToSend < MAX_DATA_MAX);
this.parent = telemetry;
this.dataPointsToSend = dataPointsToSend;
cache = CacheBuilder.newBuilder().
concurrencyLevel(4).
expireAfterAccess(250, TimeUnit.MILLISECONDS).
maximumSize(dataPointsToSend).build();
dataCache = EvictingQueue.create((int) (dataPointsToSend * .75));
data = LinkedHashMultimap.create();
log = new LinkedList<>();
try {
logcat = Runtime.getRuntime().exec(new String[] {"logcat", "*:I"});
reader = new BufferedReader(new InputStreamReader(logcat.getInputStream()));
} catch (IOException e) {
Log.e(TAG, "Cannot start logcat monitor", e);
}
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleAtFixedRate(new SendDataRunnable(), 250, 250, TimeUnit.MILLISECONDS);
}
AbstractModuleComponentResolveMetaData.java 文件源码
项目:Pushjet-Android
阅读 45
收藏 0
点赞 0
评论 0
private void populateArtifactsFromDescriptor() {
Map<Artifact, ModuleComponentArtifactMetaData> artifactToMetaData = Maps.newLinkedHashMap();
for (Artifact descriptorArtifact : getDescriptor().getAllArtifacts()) {
ModuleComponentArtifactMetaData artifact = artifact(descriptorArtifact);
artifactToMetaData.put(descriptorArtifact, artifact);
}
artifacts = Sets.newLinkedHashSet(artifactToMetaData.values());
this.artifactsByConfig = LinkedHashMultimap.create();
for (String configuration : getDescriptor().getConfigurationsNames()) {
Artifact[] configArtifacts = getDescriptor().getArtifacts(configuration);
for (Artifact configArtifact : configArtifacts) {
artifactsByConfig.put(configuration, artifactToMetaData.get(configArtifact));
}
}
}
IdeDependenciesExtractor.java 文件源码
项目:Pushjet-Android
阅读 28
收藏 0
点赞 0
评论 0
public Collection<IdeExtendedRepoFileDependency> extractRepoFileDependencies(DependencyHandler dependencyHandler, Collection<Configuration> plusConfigurations, Collection<Configuration> minusConfigurations, boolean downloadSources, boolean downloadJavadoc) {
// can have multiple IDE dependencies with same component identifier (see GRADLE-1622)
Multimap<ComponentIdentifier, IdeExtendedRepoFileDependency> resolvedDependenciesComponentMap = LinkedHashMultimap.create();
for (IdeExtendedRepoFileDependency dep : resolvedExternalDependencies(plusConfigurations, minusConfigurations)) {
resolvedDependenciesComponentMap.put(toComponentIdentifier(dep.getId()), dep);
}
List<Class<? extends Artifact>> artifactTypes = new ArrayList<Class<? extends Artifact>>(2);
if (downloadSources) {
artifactTypes.add(SourcesArtifact.class);
}
if (downloadJavadoc) {
artifactTypes.add(JavadocArtifact.class);
}
downloadAuxiliaryArtifacts(dependencyHandler, resolvedDependenciesComponentMap, artifactTypes);
Collection<UnresolvedIdeRepoFileDependency> unresolvedDependencies = unresolvedExternalDependencies(plusConfigurations, minusConfigurations);
Collection<IdeExtendedRepoFileDependency> resolvedDependencies = resolvedDependenciesComponentMap.values();
Collection<IdeExtendedRepoFileDependency> resolvedAndUnresolved = new ArrayList<IdeExtendedRepoFileDependency>(unresolvedDependencies.size() + resolvedDependencies.size());
resolvedAndUnresolved.addAll(resolvedDependencies);
resolvedAndUnresolved.addAll(unresolvedDependencies);
return resolvedAndUnresolved;
}
AbstractModuleComponentResolveMetaData.java 文件源码
项目:net.akehurst.build.gradle
阅读 63
收藏 0
点赞 0
评论 0
private void populateArtifactsFromDescriptor() {
Map<Artifact, ModuleComponentArtifactMetaData> artifactToMetaData = Maps.newLinkedHashMap();
for (Artifact descriptorArtifact : getDescriptor().getAllArtifacts()) {
IvyArtifactName artifactName = DefaultIvyArtifactName.forIvyArtifact(descriptorArtifact);
ModuleComponentArtifactMetaData artifact = new DefaultModuleComponentArtifactMetaData(getComponentId(), artifactName);
artifactToMetaData.put(descriptorArtifact, artifact);
}
this.artifactsByConfig = LinkedHashMultimap.create();
for (String configuration : getDescriptor().getConfigurationsNames()) {
Artifact[] configArtifacts = getDescriptor().getArtifacts(configuration);
for (Artifact configArtifact : configArtifacts) {
artifactsByConfig.put(configuration, artifactToMetaData.get(configArtifact));
}
}
}
GamlResource.java 文件源码
项目:gama
阅读 32
收藏 0
点赞 0
评论 0
public ModelDescription buildCompleteDescription() {
if (MEMOIZE_DESCRIPTION && description != null)
return description;
final LinkedHashMultimap<String, GamlResource> imports = GamlResourceIndexer.validateImportsOf(this);
if (hasErrors() || hasSemanticErrors()) {
setDescription(null);
return null;
}
final ModelDescription model = buildModelDescription(imports);
// If, for whatever reason, the description is null, we stop the
// semantic validation
if (model == null) {
invalidate(this, "Impossible to validate " + URI.decode(getURI().lastSegment()) + " (check the logs)");
}
setDescription(model);
return model;
}
GamlResourceIndexer.java 文件源码
项目:gama
阅读 20
收藏 0
点赞 0
评论 0
public static LinkedHashMultimap<String, GamlResource> validateImportsOf(final GamlResource resource) {
final TOrderedHashMap<URI, String> uris = allLabeledImportsOf(resource);
uris.remove(GamlResourceServices.properlyEncodedURI(resource.getURI()));
if (!uris.isEmpty()) {
final LinkedHashMultimap<String, GamlResource> imports = LinkedHashMultimap.create();
if (uris.forEachEntry((a, b) -> {
final GamlResource r = (GamlResource) resource.getResourceSet().getResource(a, true);
if (r.hasErrors()) {
resource.invalidate(r, "Errors detected");
return false;
}
imports.put(b, r);
return true;
}))
return imports;
}
return null;
}
CorrelatedEventsGrouper.java 文件源码
项目:streamline
阅读 27
收藏 0
点赞 0
评论 0
/**
* Returns the group of correlated events per source where the group of related source events
* produces the same downstream events
*
* @param sources the set of source component names
* @return the group of correlated events per source
*/
public List<Set<String>> groupByRelatedSourceEvents(Set<String> sources) {
Multimap<Set<String>, String> allEventsToSourceEvents = LinkedHashMultimap.create();
Stream<String> rootEventIds = events.stream().filter(e -> e != null && e.getRootIds().isEmpty())
.map(EventInformation::getEventId);
rootEventIds.forEach(rootEventId -> {
Map<String, EventInformation> allRelatedEvents = buildRelatedEventsMap(rootEventId);
allEventsToSourceEvents.put(allRelatedEvents.keySet(), rootEventId);
});
List<Set<String>> result = new ArrayList<>();
allEventsToSourceEvents.asMap().values().forEach(v ->
result.add(new HashSet<>(v))
);
return result;
}
TableService.java 文件源码
项目:kylin
阅读 25
收藏 0
点赞 0
评论 0
private List<Pair<TableDesc, TableExtDesc>> getAllMeta(String[] tables, String project) throws Exception {
// de-dup
SetMultimap<String, String> db2tables = LinkedHashMultimap.create();
for (String fullTableName : tables) {
String[] parts = HadoopUtil.parseHiveTableName(fullTableName);
db2tables.put(parts[0], parts[1]);
}
// load all tables first
List<Pair<TableDesc, TableExtDesc>> allMeta = Lists.newArrayList();
ISourceMetadataExplorer explr = SourceFactory.getDefaultSource().getSourceMetadataExplorer();
for (Map.Entry<String, String> entry : db2tables.entries()) {
Pair<TableDesc, TableExtDesc> pair = explr.loadTableMetadata(entry.getKey(), entry.getValue(), project);
TableDesc tableDesc = pair.getFirst();
Preconditions.checkState(tableDesc.getDatabase().equals(entry.getKey().toUpperCase()));
Preconditions.checkState(tableDesc.getName().equals(entry.getValue().toUpperCase()));
Preconditions.checkState(tableDesc.getIdentity().equals(entry.getKey().toUpperCase() + "." + entry
.getValue().toUpperCase()));
TableExtDesc extDesc = pair.getSecond();
Preconditions.checkState(tableDesc.getIdentity().equals(extDesc.getIdentity()));
allMeta.add(pair);
}
return allMeta;
}
DuplicateImportScope.java 文件源码
项目:CooperateModelingEnvironment
阅读 36
收藏 0
点赞 0
评论 0
@Override
protected Iterable<IEObjectDescription> getAliasedElements(Iterable<IEObjectDescription> candidates) {
Multimap<QualifiedName, IEObjectDescription> keyToDescription = LinkedHashMultimap.create();
Multimap<QualifiedName, ImportNormalizer> keyToNormalizer = HashMultimap.create();
for (IEObjectDescription imported : candidates) {
QualifiedName fullyQualifiedName = imported.getName();
for (ImportNormalizer normalizer : normalizers) {
QualifiedName alias = normalizer.deresolve(fullyQualifiedName);
if (alias != null) {
QualifiedName key = alias;
if (isIgnoreCase()) {
key = key.toLowerCase();
}
keyToDescription.put(key, new AliasedEObjectDescription(alias, imported));
keyToNormalizer.put(key, normalizer);
}
}
}
return keyToDescription.values();
}
DOIPrefixMapper.java 文件源码
项目:orcid-update-java
阅读 37
收藏 0
点赞 0
评论 0
private ImmutableMultimap<String, String> loadPublisherMap(String file) {
// todo make sortedsetmultimap
Multimap<String, String> temp = LinkedHashMultimap.create();
CsvMapper mapper = new CsvMapper();
mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
try {
MappingIterator<Object[]> it = mapper.reader(Object[].class).readValues(
getClass().getResourceAsStream(file));
while (it.hasNext()) {
Object[] row = it.next();
if (row.length > 1 && (row[0] != null && row[1] != null)
&& (!row[0].toString().isEmpty() && !row[1].toString().isEmpty())) {
temp.put(row[1].toString().trim(), row[0].toString().trim());
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return ImmutableMultimap.copyOf(temp);
}
FullFormEvent.java 文件源码
项目:modules
阅读 30
收藏 0
点赞 0
评论 0
private static Multimap<String, Map<String, Object>> convertToMap(Multimap<String, FormValueElement> subElements) {
Multimap<String, Map<String, Object>> elements = LinkedHashMultimap.create();
for (Map.Entry<String, FormValueElement> entry : subElements.entries()) {
Map<String, Object> elementAsMap = new HashMap<>(4); // NO CHECKSTYLE MagicNumber
FormValueElement formValueElement = entry.getValue();
elementAsMap.put(ELEMENT_NAME, formValueElement.getElementName());
elementAsMap.put(SUB_ELEMENTS, convertToMap(formValueElement.getSubElements()));
elementAsMap.put(ATTRIBUTES, formValueElement.getAttributes());
elementAsMap.put(VALUE, formValueElement.getValue());
elements.put(entry.getKey(), elementAsMap);
}
return elements;
}
JSType.java 文件源码
项目:closure-compiler
阅读 25
收藏 0
点赞 0
评论 0
@Override
public JSType getInstantiatedTypeArgument(TypeI supertype) {
RawNominalType rawType =
((JSType) supertype).getNominalTypeIfSingletonObj().getRawNominalType();
List<String> typeParameters = rawType.getTypeParameters();
checkState(typeParameters.size() == 1);
String param = typeParameters.get(0);
Map<String, JSType> typeMap = new LinkedHashMap<>();
typeMap.put(param, JSType.fromTypeVar(this.commonTypes, param));
JSType reinstantiated = rawType.getInstanceAsJSType().substituteGenerics(typeMap);
Multimap<String, JSType> typeMultimap = LinkedHashMultimap.create();
reinstantiated.unifyWith(this, typeParameters, typeMultimap);
return joinManyTypes(this.commonTypes, typeMultimap.get(param));
}
DisambiguateProperties.java 文件源码
项目:closure-compiler
阅读 29
收藏 0
点赞 0
评论 0
DisambiguateProperties(
AbstractCompiler compiler, Map<String, CheckLevel> propertiesToErrorFor) {
this.compiler = compiler;
this.registry = compiler.getTypeIRegistry();
this.BOTTOM_OBJECT =
this.registry.getNativeType(JSTypeNative.NO_OBJECT_TYPE).toMaybeObjectType();
this.propertiesToErrorFor = propertiesToErrorFor;
this.invalidationMap =
propertiesToErrorFor.isEmpty()
? null
: LinkedHashMultimap.<TypeI, Supplier<JSError>>create();
this.invalidatingTypes = new InvalidatingTypes.Builder(registry)
.recordInvalidations(this.invalidationMap)
.addTypesInvalidForPropertyRenaming()
.addAllTypeMismatches(compiler.getTypeMismatches())
.addAllTypeMismatches(compiler.getImplicitInterfaceUses())
.allowEnumsAndScalars()
.build();
}