List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:net.sourceforge.cilib.moo.archive.constrained.SetBasedConstrainedArchive.java
public SetBasedConstrainedArchive(SetBasedConstrainedArchive copy) { super(copy);/*from w ww.j av a 2 s . c o m*/ this.solutions = Sets.newLinkedHashSet(); for (OptimisationSolution solution : copy.solutions) { this.solutions.add(solution.getClone()); } this.pruningSelection = copy.pruningSelection; }
From source file:cc.recommenders.evaluation.distribution.calc.AbstractTaskProvider.java
protected Set<TTask> createTasks() { output.startEvaluation();//w ww . ja v a 2 s . c o m int numTasks = 0; Logger.log("## creating tasks"); Set<TTask> tasks = Sets.newLinkedHashSet(); for (ICoReTypeName type : store.getTypes()) { if (useType(type)) { if (store.isAvailable(type, getNumFolds())) { for (int foldNum = 0; foldNum < getNumFolds(); foldNum++) { TypeStore typeStore = createTypeStore(type); List<Usage> training = typeStore.getTrainingData(foldNum); List<Usage> validation = typeStore.getValidationData(foldNum); for (String app : getOptions().keySet()) { for (TTask task : createTasksFor(app, type, foldNum, training)) { Logger.log("%5d: %s", (++numTasks), task); tasks.add(task); output.count(type, foldNum, validation.size()); } } } } } } output.setNumTasks(tasks.size()); return tasks; }
From source file:at.molindo.esi4j.multi.impl.DefaultMultiIndexManager.java
@Override public Class<?>[] getTypes() { Set<Class<?>> types = Sets.newLinkedHashSet(); for (InternalIndex index : getIndex().getIndices().values()) { types.addAll(Arrays.asList(index.getIndexManager().getTypes())); }//from w ww. ja v a 2 s .co m return types.toArray(new Class<?>[types.size()]); }
From source file:org.eclipse.emf.compare.diagram.ide.ui.sirius.internal.SiriusTechnicalElementsFilter.java
/** * return a set containing all the compared EObject affected by the diff being from the left, right or * ancestor version./*www. java2 s .co m*/ * * @param diff * any difference. * @return a set containing all the known EObject affected by the diff being from the left, right or * ancestor version. */ private static Set<EObject> affectedEObjects(Diff diff) { Match match = diff.getMatch(); if (match != null) { return matchedEObjects(match); } return Sets.newLinkedHashSet(); }
From source file:de.tu_berlin.dima.oligos.profiler.SchemaProfiler.java
private Set<Table> getTables() { Set<Table> tables = Sets.newLinkedHashSet(); for (TableProfiler profiler : tableProfilers) { Table table = profiler.profile(); tables.add(table);// www .j a v a2 s .c om } return tables; }
From source file:org.terasology.world.block.loader.AutoBlockProvider.java
@Override public Set<Name> getModulesProviding(Name resourceName) { Set<Name> result = Sets.newLinkedHashSet(); assetManager.resolve(resourceName.toString(), BlockTile.class).stream() .map(urn -> assetManager.getAsset(urn, BlockTile.class).get()).filter(BlockTile::isAutoBlock) .forEach(tile -> result.add(tile.getUrn().getModuleName())); return result; }
From source file:uk.ac.ebi.atlas.solr.query.SuggestionService.java
public List<TermSourceSuggestion> fetchTopSuggestions(String query, @Nullable String species) { LOGGER.info(String.format("fetchTopSuggestions for query %s, species %s", query, species)); LinkedHashSet<TermSourceSuggestion> suggestions = Sets.newLinkedHashSet(); if (!CharMatcher.WHITESPACE.or(CharMatcher.is('-')).matchesAnyOf(query)) { suggestions.addAll(geneIdSuggestionService.fetchGeneIdSuggestionsInName(query, species)); if (suggestions.size() < MAX_NUMBER_OF_SUGGESTIONS) { suggestions.addAll(geneIdSuggestionService.fetchGeneIdSuggestionsInSynonym(query, species)); }/*from w ww.ja v a 2 s . c o m*/ if (suggestions.size() < MAX_NUMBER_OF_SUGGESTIONS) { suggestions.addAll(geneIdSuggestionService.fetchGeneIdSuggestionsInIdentifier(query, species)); } } if (suggestions.size() < MAX_NUMBER_OF_SUGGESTIONS) { List<TermSourceSuggestion> multiTermSuggestions = multiTermSuggestionService .fetchMultiTermSuggestions(query); suggestions.addAll(multiTermSuggestions); } List<TermSourceSuggestion> topSuggestions = Lists.newArrayList(suggestions); if (topSuggestions.size() > MAX_NUMBER_OF_SUGGESTIONS) { topSuggestions = topSuggestions.subList(0, MAX_NUMBER_OF_SUGGESTIONS); } return topSuggestions; }
From source file:org.jclouds.cloudwatch.xml.MetricHandler.java
/** * {@inheritDoc}/*from w ww.j a v a 2 s . c om*/ */ @Override public Metric getResult() { Metric metric = new Metric(metricName, namespace, dimensions); // Reset since this handler is created once but produces N results dimensions = Sets.newLinkedHashSet(); metricName = null; namespace = null; return metric; }
From source file:org.gradle.model.internal.type.ModelTypes.java
/** * Collect all types that make up the type hierarchy of the given types. *//*w w w .j a v a2s .c om*/ public static Set<ModelType<?>> collectHierarchy(Iterable<? extends ModelType<?>> types) { Queue<ModelType<?>> queue = new ArrayDeque<ModelType<?>>(Iterables.size(types) * 2); Iterables.addAll(queue, types); Set<ModelType<?>> seenTypes = Sets.newLinkedHashSet(); ModelType<?> type; while ((type = queue.poll()) != null) { // Do not process Object's or GroovyObject's methods Class<?> rawClass = type.getRawClass(); if (rawClass.equals(Object.class) || rawClass.equals(GroovyObject.class)) { continue; } // Do not reprocess if (!seenTypes.add(type)) { continue; } Class<?> superclass = rawClass.getSuperclass(); if (superclass != null) { ModelType<?> superType = ModelType.of(superclass); if (!seenTypes.contains(superType)) { queue.add(superType); } } for (Class<?> iface : rawClass.getInterfaces()) { ModelType<?> ifaceType = ModelType.of(iface); if (!seenTypes.contains(ifaceType)) { queue.add(ifaceType); } } } return seenTypes; }
From source file:org.eclipse.xtext.resource.containers.LiveShadowedAllContainerState.java
@Override public Collection<URI> getContainedURIs(String containerHandle) { Set<URI> result = Sets.newLinkedHashSet(); for (IResourceDescription descriptions : localDescriptions.getAllResourceDescriptions()) { String computedHandle = getContainerHandle(descriptions.getURI()); if (computedHandle != null && computedHandle.equals(containerHandle)) result.add(descriptions.getURI()); }/* www .ja va 2 s .co m*/ result.addAll(globalState.getContainedURIs(containerHandle)); return result; }