项目:raml-java-tools
文件:PluginManager.java
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);
}
}
项目:NullAway
文件:NullAway.java
/**
* @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;
}
项目:CustomWorldGen
文件:Loader.java
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);
}
}
项目:clearwsd
文件:SemevalReader.java
/**
* 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);
}
}
项目:xtext-extras
文件:ResolvedFeatures.java
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);
}
项目:xtext-extras
文件:StaticImplicitMethodsFeatureForTypeProvider.java
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();
}
项目:xtext-extras
文件:EObjectDescriptionBasedStubGenerator.java
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();
}
项目:TRHS_Club_Mod_2016
文件:Loader.java
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer,dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
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();
}
项目:xtext-core
文件:BaseInternalContentAssistParser.java
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);
}
}
}
/**
* {@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;
}
项目:bts
文件:AbstractInternalContentAssistParser.java
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);
}
}
}
项目:bts
文件:DefaultReferenceFinder.java
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);
}
}
项目:FreeBuilder
文件:MethodFinder.java
/**
* 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());
}
项目:CauldronGit
文件:Loader.java
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer,dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
项目:swagger2markup
文件:RegexUtils.java
/**
* 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",headerPattern.toString());
}
}
}
return operationsGroupedByRegex;
}
项目:swagger2markup
文件:TagUtils.java
/**
* 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 '{}'",tag);
}
operationsGroupedByTag.put(tag,operation);
}
}
return operationsGroupedByTag;
}
项目:TeamClutch2016
文件:ExtensibleTelemetry.java
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,TimeUnit.MILLISECONDS);
}
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));
}
}
}
项目:Pushjet-Android
文件:IdeDependenciesExtractor.java
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;
}
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));
}
}
}
项目:gama
文件:GamlResource.java
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;
}
项目:gama
文件:GamlResourceIndexer.java
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;
}
项目:streamline
文件:correlatedEventsGrouper.java
/**
* 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(Event@R_739_4045@ion::getEventId);
rootEventIds.forEach(rootEventId -> {
Map<String,Event@R_739_4045@ion> 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;
}
项目:kylin
文件:TableService.java
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;
}
项目:orcid-update-java
文件:DOIPrefixMapper.java
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);
}
项目:modules
文件:FullFormEvent.java
private static Multimap<String,Map<String,Object>> convertToMap(Multimap<String,FormValueElement> subElements) {
Multimap<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;
}
项目:closure-compiler
文件:JSType.java
@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(
AbstractCompiler compiler,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();
}
项目:SPLevo
文件:MergeVPMAnalyzerResultsIntoGraphJob.java
/**
* Get a string containing the degrees of identified subgraphs and how many subgraphs exist for
* a specific degree.
*
* @param vpmGraph
* The graph to analyze the subgraphs for.
* @return The formated string of degree statistics [Size:SubGraphCount].
*/
private String getNodedegrees(VPMGraph vpmGraph) {
LinkedHashMultimap<Integer,Node> degreestatistics = LinkedHashMultimap.create();
for (Node node : vpmGraph.getNodeSet()) {
degreestatistics.get(node.getDegree()).add(node);
}
StringBuilder degreePrint = new StringBuilder();
List<Integer> degrees = Lists.newLinkedList(degreestatistics.keySet());
Collections.sort(degrees);
for (Integer degree : degrees) {
if (degreePrint.length() > 0) {
degreePrint.append("|");
}
degreePrint.append(degree + ":" + degreestatistics.get(degree).size());
}
return degreePrint.toString();
}
@Override
public IndirectParamsInfo exec(SoyNode node) {
Preconditions.checkArgument(node instanceof TemplateNode);
isstartOfPass = true;
visitedCallSituations = Sets.newHashSet();
currTemplate = null;
callerStack = new arraydeque<>();
callerStack.add(
new CallerFrame(null,ImmutableSet.<TemplateNode>of(),ImmutableSet.<String>of()));
indirectParams = Maps.newHashMap();
paramKeyToCalleesMultimap = HashMultimap.create();
indirectParamTypes = LinkedHashMultimap.create();
mayHaveIndirectParamsInExternalCalls = false;
mayHaveIndirectParamsInExternalDelCalls = false;
visit(node);
return new IndirectParamsInfo(
ImmutableSortedMap.copyOf(indirectParams),paramKeyToCalleesMultimap,ImmutableMultimap.copyOf(indirectParamTypes),mayHaveIndirectParamsInExternalCalls,mayHaveIndirectParamsInExternalDelCalls);
}
项目:Cauldron
文件:Loader.java
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer,dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
public Metadata() {
mIdentifiers = Lists.newArrayList();
mTitles = Lists.newArrayList();
mLanguages = Lists.newArrayList();
mContributors = Lists.newArrayList();
mAuthors = Lists.newArrayList();
mCoverages = Lists.newArrayList();
mDescriptions = Lists.newArrayList();
mFormats = Lists.newArrayList();
mpublishers = Lists.newArrayList();
mRelations = Lists.newArrayList();
mRightses = Lists.newArrayList();
mSubjects = Lists.newArrayList();
mLinks = Lists.newArrayList();
mMetas = LinkedHashMultimap.create();
mMeta20s = Lists.newArrayList();
}
项目:org.pshdl
文件:HDLResolver.java
public Optional<? extends Iterable<HDLFunction>> resolveFunctionCall(HDLFunctionCall call,HDLQualifiedname funcName) {
if (funcCache == null) {
synchronized (this) {
final HDLFunction[] funcDecl = resolveto.getAllObjectsOf(HDLFunction.class,false);
funcCache = LinkedHashMultimap.create();
for (final HDLFunction hdlfuncDeclaration : funcDecl) {
funcCache.put(fullNameOf(hdlfuncDeclaration),hdlfuncDeclaration);
}
}
}
// XXX Check if the qualifier does either match the pkg name,or is not
// existant
final Iterable<HDLFunction> checkCache = checkCache(funcName,funcCache);
if ((checkCache != null) && checkCache.iterator().hasNext()) {
return Optional.of(checkCache);
}
if ((resolveContainer == null) || !descent) {
return Optional.absent();
}
return scopingExtension.INST.resolveFunctionCall(resolveContainer,call,funcName);
}
项目:preferanser
文件:PlayerTest.java
@Test
public void testMakeTurn_OtherSuitInsteadOfTrump() throws Exception {
handCardMultimap = LinkedHashMultimap.create();
handCardMultimap.put(SOUTH,CLUB_ACE);
handCardMultimap.put(WEST,HEART_JACK);
handCardMultimap.put(WEST,SPADE_ACE);
player = buildplayer(name,description,Players.THREE,widow,handContractMap,SOUTH,handCardMultimap);
player.makeTurn(CLUB_ACE);
try {
player.makeTurn(HEART_JACK);
fail("IllegalSuitException must have been thrown!");
} catch (IllegalSuitException e) {
assertthat(e.getActualSuit(),equalTo(Suit.HEART));
assertthat(e.getExpectedSuit(),equalTo(Suit.SPADE));
}
}
项目:preferanser
文件:PlayerTest.java
@Test
public void testMakeTurn_OtherSuitWhenNoTrumpGame() throws Exception {
handContractMap = ImmutableMap.of(
EAST,Contract.PASS,Contract.SIX_NO_TRUMP,WEST,Contract.WHIST
);
handCardMultimap = LinkedHashMultimap.create();
handCardMultimap.put(SOUTH,handCardMultimap);
player.makeTurn(CLUB_ACE);
player.makeTurn(HEART_JACK);
}
项目:preferanser
文件:PlayerTest.java
private LinkedHashMultimap<Hand,Card> buildHandCardMultimap() {
LinkedHashMultimap<Hand,Card> multimap = LinkedHashMultimap.create();
multimap.put(EAST,CLUB_8);
multimap.put(EAST,SPADE_8);
multimap.put(EAST,DIAMOND_7);
multimap.put(EAST,DIAMOND_8);
multimap.put(SOUTH,CLUB_ACE);
multimap.put(SOUTH,CLUB_KING);
multimap.put(SOUTH,DIAMOND_9);
multimap.put(SOUTH,DIAMOND_10);
multimap.put(WEST,CLUB_JACK);
multimap.put(WEST,CLUB_9);
multimap.put(WEST,HEART_JACK);
multimap.put(WEST,DIAMOND_JACK);
multimap.put(WEST,DIAMOND_QUEEN);
return multimap;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。