List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:de.tu_berlin.dima.oligos.DenseSchema.java
public Set<String> columnsIn(final String schema, final String table) { Set<String> cols = Sets.newLinkedHashSet(); for (ColumnId column : columns) { if (column.getSchema().equals(schema) && column.getTable().equals(table)) { String col = column.getColumn(); cols.add(col);/*from w w w .j ava2s. c o m*/ } } return cols; }
From source file:org.eclipse.emf.ecoretools.design.service.LiveValidationTrigger.java
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { final Set<EObject> changedEcoreObjects = Sets.newLinkedHashSet(); for (Notification notif : notifications) { Object obj = notif.getNotifier(); if (obj instanceof EObject && ((EObject) obj).eClass() != null && ((EObject) obj).eClass().getEPackage() == EcorePackage.eINSTANCE) { changedEcoreObjects.add((EObject) obj); }/*www .jav a 2 s.c o m*/ } if (changedEcoreObjects.size() > 0) { Command revalidateEObjects = new RecordingCommand(domain) { @Override protected void doExecute() { Set<EObject> containers = Sets.newLinkedHashSet(); for (EObject eObj : changedEcoreObjects) { revalidate(eObj); EObject container = eObj.eContainer(); if (container != null) { containers.add(container); } } /* * When an Ecore object changes it is likely the container * might have a new validation error (or an error might be * gone) even if it has suffered no change itself. Example : * two EStructural features having the same name and * contained in the same EClass will trigger an error on * such EClass. This state should be updated when one of the * EStructuralFeature got renamed. */ for (EObject container : containers) { revalidate(container); } } protected void revalidate(EObject eObj) { DiagnosticAttachment diag = DiagnosticAttachment.getAttachment(eObj); /* * If the EObject had a validation marker, then we need to * update its state, otherwise nobody cared about its * validation status, no need to pre-compute it. */ if (diag != null) { try { /* * anything could happen within the validate. We * make sure we won't fail the whole post-process in * this case. */ Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObj); /* * We attach the result of the validation on the * EObject through the eAdapters list. It might be * consumed by some modelers to change colors or * update tooltips. */ diag.setDiagnostic(diagnostic); } catch (Throwable e) { /* * Anything which happens here might not be a * concern. */ } } } }; return Options.newSome(revalidateEObjects); } return Options.newNone(); }
From source file:org.eclipse.sirius.diagram.business.api.query.MappingBasedToolDescriptionQuery.java
/** * Returns all {@link RepresentationElementMapping}s associated to this * {@link MappingBasedToolDescription}./* ww w . ja v a 2s. co m*/ * * @return all {@link RepresentationElementMapping}s associated to this * {@link MappingBasedToolDescription} */ public Collection<RepresentationElementMapping> getMappings() { Collection<RepresentationElementMapping> mappings = Sets.newLinkedHashSet(); if (toolDescription instanceof ContainerCreationDescription) { ContainerCreationDescription ccd = (ContainerCreationDescription) toolDescription; mappings.addAll(ccd.getContainerMappings()); mappings.addAll(ccd.getExtraMappings()); } if (toolDescription instanceof ContainerDropDescription) { mappings.addAll(((ContainerDropDescription) toolDescription).getMappings()); } if (toolDescription instanceof DeleteElementDescription) { mappings.addAll(((DeleteElementDescription) toolDescription).getMappings()); } if (toolDescription instanceof DirectEditLabel) { mappings.addAll(((DirectEditLabel) toolDescription).getMapping()); } if (toolDescription instanceof DoubleClickDescription) { mappings.addAll(((DoubleClickDescription) toolDescription).getMappings()); } if (toolDescription instanceof EdgeCreationDescription) { EdgeCreationDescription ecd = (EdgeCreationDescription) toolDescription; mappings.addAll(ecd.getEdgeMappings()); mappings.addAll(ecd.getExtraSourceMappings()); } if (toolDescription instanceof NodeCreationDescription) { NodeCreationDescription ncd = (NodeCreationDescription) toolDescription; mappings.addAll(ncd.getNodeMappings()); mappings.addAll(ncd.getExtraMappings()); } if (toolDescription instanceof ReconnectEdgeDescription) { mappings.addAll(((ReconnectEdgeDescription) toolDescription).getMappings()); } return mappings; }
From source file:com.textocat.textokit.morph.commons.GramModelBasedTagMapper.java
public static Set<String> parseTag(String tag) { if (StringUtils.isEmpty(tag) || tag.equalsIgnoreCase("null")) { return Sets.newLinkedHashSet(); }// w w w.j a v a 2 s . co m return Sets.newLinkedHashSet(targetGramSplitter.split(tag)); }
From source file:org.gradle.api.internal.tasks.compile.incremental.ClassSetAnalysisUpdater.java
public void updateAnalysis(JavaCompileSpec spec) { Timer clock = Timers.startTimer(); Set<File> baseDirs = Sets.newLinkedHashSet(); baseDirs.add(spec.getDestinationDir()); Iterables.addAll(baseDirs, Iterables.filter(spec.getCompileClasspath(), IS_CLASS_DIRECTORY)); ClassFilesAnalyzer analyzer = new ClassFilesAnalyzer(this.analyzer, fileHasher); for (File baseDir : baseDirs) { fileOperations.fileTree(baseDir).visit(analyzer); }//from w w w . ja va 2 s. c o m ClassSetAnalysisData data = analyzer.getAnalysis(); stash.put(data); LOG.info("Class dependency analysis for incremental compilation took {}.", clock.getElapsed()); }
From source file:androiddb.internal.ShillelaghProcessor.java
@Override public Set<String> getSupportedAnnotationTypes() { Set<String> supportTypes = Sets.newLinkedHashSet(); supportTypes.add(Table.class.getCanonicalName()); return supportTypes; }
From source file:cc.recommenders.mining.calls.pbn.ExportMiner.java
private static Map<Set<UsageFeature>, Integer> count(List<List<UsageFeature>> features) { Map<Set<UsageFeature>, Integer> counts = Maps.newLinkedHashMap(); for (List<UsageFeature> usage : features) { Set<UsageFeature> su = Sets.newLinkedHashSet(); su.addAll(usage);/*from ww w .ja v a 2 s . c o m*/ int newVal; if (counts.containsKey(su)) { newVal = counts.get(su) + 1; } else { newVal = 1; } counts.put(su, newVal); } return counts; }
From source file:de.tu_berlin.dima.oligos.SparseSchema.java
public Set<String> columnsIn(final String schema, final String table) { if (tablesIn(schema).contains(table)) { return schemas.get(schema).get(table); } else {//from w w w .j av a 2s. c o m return Sets.newLinkedHashSet(); } }
From source file:org.eclipse.sirius.business.internal.extender.MetamodelDescriptorManagerImpl.java
/** * /*from ww w.ja v a 2s.com*/ * {@inheritDoc} */ public Collection<MetamodelDescriptor> provides(final Collection<Viewpoint> enabledViewpoints) { final Collection<MetamodelDescriptor> result = Sets.newLinkedHashSet(); for (MetamodelDescriptorProvider provider : Iterables.filter(providers, MetamodelDescriptorProvider.class)) { final Collection<MetamodelDescriptor> provided = provider.provides(enabledViewpoints); if (provided != null) { result.addAll(provided); } } return result; }
From source file:org.gradle.execution.TaskNameResolver.java
/** * Finds tasks that will have exactly the given name, without necessarily creating or configuring the tasks. Returns null if no such match found. *///from w ww .ja v a 2s . co m @Nullable public TaskSelectionResult selectWithName(final String taskName, final ProjectInternal project, boolean includeSubProjects) { if (includeSubProjects) { Set<Task> tasks = Sets.newLinkedHashSet(); new MultiProjectTaskSelectionResult(taskName, project).collectTasks(tasks); if (!tasks.isEmpty()) { return new FixedTaskSelectionResult(tasks); } } else { if (hasTask(taskName, project)) { return new TaskSelectionResult() { @Override public void collectTasks(Collection<? super Task> tasks) { tasks.add(getExistingTask(project, taskName)); } }; } } return null; }