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.SparseSchema.java
public Set<String> tablesIn(final String schema) { if (schemas().contains(schema)) { return schemas.get(schema).keySet(); } else {/* ww w. j a v a 2 s. c o m*/ return Sets.newLinkedHashSet(); } }
From source file:net.sourceforge.cilib.moo.archive.constrained.SetBasedConstrainedArchive.java
public SetBasedConstrainedArchive() { this.solutions = Sets.newLinkedHashSet(); this.pruningSelection = new RandomSelector<OptimisationSolution>(); }
From source file:org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions.java
protected Set<String> getFormValuesWithKeysPrefixedBy(final String prefix) { Set<String> values = Sets.newLinkedHashSet(); for (String key : Iterables.filter(formParameters.keySet(), new Predicate<String>() { public boolean apply(String input) { return input.startsWith(prefix); }/*from w w w . j a v a2 s .c o m*/ })) { values.add(formParameters.get(key).iterator().next()); } return values; }
From source file:cc.recommenders.usages.Query.java
public void resetCallsites() { Set<CallSite> sites = Sets.newLinkedHashSet(); setAllCallsites(sites); }
From source file:org.smartdeveloperhub.harvesters.it.frontend.testing.handlers.AllowedMethodsHandler.java
private AllowedMethodsHandler() { this.methods = Sets.newLinkedHashSet(); }
From source file:org.artifactory.search.property.PropertySearcher.java
@Override public ItemSearchResults<PropertySearchResult> doSearch(PropertySearchControls controls) { LinkedHashSet<PropertySearchResult> globalResults = Sets.newLinkedHashSet(); // TODO: [by FSI] Create a real full DB query aggregating properties conditions // Get all open property keys and search through them Set<String> openPropertyKeys = controls.getPropertyKeysByOpenness(PropertySearchControls.OPEN); long totalResultCount = executeOpenPropSearch(controls, openPropertyKeys, globalResults); // Get all closed property keys and search through them Set<String> closedPropertyKeys = controls.getPropertyKeysByOpenness(PropertySearchControls.CLOSED); totalResultCount += executeClosedPropSearch(controls, closedPropertyKeys, globalResults); //Return global results list return new ItemSearchResults<>(new ArrayList<>(globalResults), totalResultCount); }
From source file:org.smartdeveloperhub.harvesters.it.frontend.testing.handlers.ContentTypeConsumerHandler.java
private ContentTypeConsumerHandler() { this.mimes = Sets.newLinkedHashSet(); }
From source file:org.smartdeveloperhub.harvesters.it.backend.Contributor.java
public Contributor() { this.emails = Sets.newLinkedHashSet(); }
From source file:org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal.logical.view.PapyrusLMVHandler.java
/** * Retrieve the files associated with the given editor (via its {@link IWorkbenchPart}) or the given * selection./*from ww w.ja va2s . c o m*/ * * @param part * the {@link IWorkbenchPart}. * @param selection * the {@link ISelection}. * @return the files associated with the given editor or the given selection. */ @Override public Collection<IFile> getFiles(IWorkbenchPart part, ISelection selection) { final Set<IFile> files = Sets.newLinkedHashSet(); if (part instanceof IEditorPart) { IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); if (editorInput instanceof IFileEditorInput) { files.add(((IFileEditorInput) editorInput).getFile()); } } if (files.isEmpty() && selection instanceof TreeSelection) { Object element = ((TreeSelection) selection).getFirstElement(); if (element instanceof IPapyrusFile) { files.add(((IPapyrusFile) element).getMainFile()); } else if (element instanceof ISubResourceFile) { files.add(((ISubResourceFile) element).getFile()); } } return files; }
From source file:org.prebake.service.plan.RecipeMaker.java
/** * @param prods the required products.//from ww w.ja va2s . com */ public Recipe makeRecipe(final Set<BoundName> prods) throws DependencyCycleException, MissingProductException { { Set<BoundName> prodsNeeded = Sets.newLinkedHashSet(); for (BoundName prod : prods) { Product p = nodes.get(prod); if (p != null) { if (p.isConcrete()) { continue; } } else if (!prod.bindings.isEmpty()) { BoundName baseName = BoundName.fromString(prod.getRawIdent()); Product template = nodes.get(baseName); if (template != null && !template.isConcrete()) { nodes.put(prod, template.withParameterValues(prod.bindings)); continue; } prodsNeeded.add(prod); } } if (!prodsNeeded.isEmpty()) { throw new MissingProductException("Undefined products " + Joiner.on(", ").join(prodsNeeded)); } } // Now create a recipe from the subgraph, while keeping track of the // starting points. class IngredientProcesser { // Maps product names to the ingredient instance for that product. final Map<BoundName, IngredientBuilder> ingredients = Maps.newHashMap(); /** * The products we're processing so we can detect and report dependency * cycles. */ final Set<BoundName> processing = Sets.newLinkedHashSet(); /** The products that have no prerequisites. We start with these. */ final List<IngredientBuilder> startingPoints = Lists.newArrayList(); IngredientBuilder process(BoundName prodName) throws DependencyCycleException, MissingProductException { IngredientBuilder ingredient = ingredients.get(prodName); // Reuse if already processed. if (ingredient != null) { return ingredient; } // Check cycles. if (processing.contains(prodName)) { List<BoundName> cycle = Lists.newArrayList(processing); int index = cycle.indexOf(prodName); cycle.subList(0, index).clear(); cycle.add(prodName); throw new DependencyCycleException( "Cycle in product dependencies : " + Joiner.on(", ").join(cycle)); } processing.add(prodName); Product prod = nodes.get(prodName); ingredient = new IngredientBuilder(prodName); if (!processPreReqs(prod, ingredient)) { startingPoints.add(ingredient); } processing.remove(prodName); ingredients.put(prodName, ingredient); return ingredient; } private boolean processPreReqs(Product prod, IngredientBuilder ingredient) throws DependencyCycleException, MissingProductException { boolean hadPreReqs = false; for (BoundName preReqName : pg.edges.get(prod.name)) { hadPreReqs = true; Product preReq = nodes.get(preReqName); if (!preReq.isConcrete()) { Product derived = backPropagate(prod, preReq); Product existing = nodes.get(derived.name); if (existing == null) { preReq = derived; nodes.put(derived.name, derived); } else if (existing.isConcrete()) { // Template specialization, or the derived product has multiple // postRequisites in this recipe. preReq = existing; } else { throw new MissingProductException("Cannot derive concrete " + derived.name + " required by " + prod.name + " because there is an existing abstract product" + " with that name."); } preReqName = preReq.name; } ingredient.addPreRequisite(process(preReqName)); } if (prod.template == null) { return hadPreReqs; } return hadPreReqs | processPreReqs(prod.template, ingredient); } } IngredientProcesser w = new IngredientProcesser(); for (BoundName prod : prods) { w.process(prod); } ImmutableList.Builder<Ingredient> startingPoints = ImmutableList.builder(); for (IngredientBuilder startingPoint : w.startingPoints) { startingPoints.add(startingPoint.build(w.ingredients)); } return new Recipe(startingPoints.build()); }