List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:com.google.devtools.j2objc.types.Import.java
public static Set<Import> getImports(ITypeBinding binding, CompilationUnit unit) { Set<Import> result = Sets.newLinkedHashSet(); addImports(binding, result, unit);/*from www .j a v a 2s . c o m*/ return result; }
From source file:org.eclipse.sirius.synchronizer.MappingHiearchyTable.java
private Collection<? extends Mapping> getLeaves(Collection<? extends Mapping> mappings) { Set<Mapping> hasChildren = Sets.newLinkedHashSet(); for (Mapping mapping : mappings) { if (mapping.getSuper().some()) { hasChildren.add(mapping.getSuper().get()); }// www . j ava 2 s.c o m } return Sets.difference(Sets.newLinkedHashSet(mappings), hasChildren); }
From source file:org.jclouds.deltacloud.xml.DeltacloudCollectionHandler.java
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equalsIgnoreCase("link")) { this.realm = new DeltacloudCollection(href, rel, features); this.href = null; this.rel = null; this.features = Sets.newLinkedHashSet(); }//from ww w . ja va 2s. co m }
From source file:com.google.devtools.j2cpp.gen.HiddenFieldDetector.java
@Override public boolean visit(TypeDeclaration node) { if (!node.isInterface()) { Set<String> names = Sets.newLinkedHashSet(); ITypeBinding binding = Types.getTypeBinding(node); addFields(binding, true, names); fieldNameMap.put(binding.getBinaryName(), names); }//ww w.j av a 2s .c o m return super.visit(node); }
From source file:org.eclipse.sirius.ui.tools.internal.views.common.item.ProjectDependenciesItemImpl.java
/** * Get the children of this item./*from w w w .j a va 2 s . com*/ * * @return the children, never <code>null</code> */ @Override public Collection<?> getChildren() { Collection<Object> children = Sets.newLinkedHashSet(); Session session = project.getSession(); if (session != null) { /* * Retrieve all resources of the session not located directly in the * project */ Iterable<Resource> semanticDeps = session.getSemanticResources(); if (session instanceof DAnalysisSessionEObject) { semanticDeps = Iterables.concat(semanticDeps, ((DAnalysisSessionEObject) session).getControlledResources()); } children.addAll(extractProjectDependencies(semanticDeps)); Iterable<Resource> analysesDeps = extractProjectDependencies(session.getAllSessionResources()); for (Resource analysisRes : analysesDeps) { children.add(new AnalysisResourceItemImpl(session, analysisRes, this)); } } return children; }
From source file:exec.csharp.queries.RandomQueryBuilder.java
private List<Query> createRandomQueries(Usage end, int numToRemove) { Set<CallSite> allSites = end.getReceiverCallsites(); Set<Set<CallSite>> randomSelections = Sets.newLinkedHashSet(); int iterations = 0; while (randomSelections.size() < maxNumQueries && iterations++ < 100) { Set<CallSite> rndSelection = rndSelect(numToRemove, allSites); randomSelections.add(rndSelection); }/* ww w . j av a 2s . co m*/ List<Query> queries = Lists.newLinkedList(); for (Set<CallSite> sites : randomSelections) { Query q = Query.createAsCopyFrom(end); q.setAllCallsites(sites); queries.add(q); } return queries; }
From source file:com.google.gxp.testing.BaseErrorTestCase.java
@Override protected void compileSchemas(FileRef... schemaFiles) { super.compileSchemas(schemaFiles); // collect actualAlerts and reset expectedAlerts actualAlerts = alertSetBuilder.buildAndClear(); expectedAlerts = Sets.newLinkedHashSet(); }
From source file:com.fluidops.iwb.api.WidgetSelectorImpl.java
@Override public void selectWidgets(PageContext pc) { pc.widgets = Sets.newLinkedHashSet(); // we sort the widget configuration to reflect the priority in // which they are applied: // 1.) Apply instance-specific widget configs // 2.) Apply type-specific widget configs // 3.) Apply RDFS.RESOURCE special handling List<WidgetConfig> widgetConfig = new LinkedList<WidgetConfig>(getWidgets()); Collections.sort(widgetConfig, new Comparator<WidgetConfig>() { public int compare(WidgetConfig c1, WidgetConfig c2) { // lowest prio (=highest order number): RDFS.RESOURCE if (c1.value.equals(RDFS.RESOURCE)) if (c2.value.equals(RDFS.RESOURCE)) return 0; else return 1; else if (c2.value.equals(RDFS.RESOURCE)) return -1; // second lowest prio (second-highest order number): applyToInstances=false if (!c1.applyToInstances) if (!c2.applyToInstances) return 0; else return -1; else if (!c2.applyToInstances) return 1; // highest priority (lowest order number): applyToInstances=true // (which holds if we reach this piece of code) return !c2.applyToInstances ? -1 : 0; }//from ww w . j a v a 2 s .c om }); UserManager userManager = EndpointImpl.api().getUserManager(); ReadDataManager dm = EndpointImpl.api().getDataManager(); for (WidgetConfig wc : widgetConfig) { // filter out widgets that are blocked according to global system settings or ACLs if (!com.fluidops.iwb.util.Config.getConfig().getPivotActive() && (wc.widget.equals(PivotWidget.class))) continue; if (!userManager.hasUIComponentAccess(UIComponent.NAVIGATION_GRAPH, null) && (wc.widget.equals(GraphWidget.class))) continue; if (!userManager.hasUIComponentAccess(UIComponent.NAVIGATION_PIVOT, null) && (wc.widget.equals(PivotWidget.class))) continue; if (!userManager.hasUIComponentAccess(UIComponent.NAVIGATION_TABLE, null) && (wc.widget.equals(TripleEditorWidget.class))) continue; // (1) in case the widget applies to the resource directly... if (!wc.applyToInstances) { // ... add it if the resource addressed by the widget matches // the current pc.value (otherwise, we ignore the widget definition) if (wc.value.equals(pc.value)) { addWidget(wc, pc); continue; } } // (2) in case the widget applies to instances of the resource... if (wc.applyToInstances) { // ... the current resource must be of type Resource ... if (pc.value instanceof URI) { for (Value type : dm.getType((URI) pc.value)) { // ... and the widget must match one of its types if (!wc.value.equals(type)) continue; addWidget(wc, pc); continue; } } } // (3) in case the widget is of special type RDFS.RESOURCE, it // applies to every URI (if applyToInstances=true) if (pc.value instanceof URI && wc.value.equals(RDFS.RESOURCE) && wc.applyToInstances) { addWidget(wc, pc); continue; } } if (pc.value instanceof URI && userManager.hasUIComponentAccess(UIComponent.NAVIGATION_WIKI, null)) pc.widgets.add(new SemWikiWidget()); // TODO for now hardcoded for literals and blank node: Table View with default configuration // in configuration we set limitProperties=false (as we do for resources) if ((pc.value instanceof Literal || pc.value instanceof BNode) && userManager.hasUIComponentAccess(UIComponent.NAVIGATION_TABLE, null)) { TripleEditorWidget widget = new TripleEditorWidget(); TripleEditorWidget.Config config = new TripleEditorWidget.Config(); config.limitProperties = false; widget.setConfig(config); pc.widgets.add(widget); } }
From source file:org.eclipse.emf.ecoretools.design.service.AutosizeTrigger.java
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { final Collection<Node> toMakeAutosize = Sets.newLinkedHashSet(); for (Notification notif : notifications) { Node nd = (Node) notif.getNewValue(); if (nd.getElement() instanceof DSemanticDecorator) { EObject semanticObject = ((DSemanticDecorator) nd.getElement()).getTarget(); if (semanticObject instanceof EObject) { UnmodifiableIterator<Adapter> filter = Iterators.filter(semanticObject.eAdapters().iterator(), new Predicate<Adapter>() { public boolean apply(Adapter input) { return input == AUTO_SIZE_MARKER; }/* w w w.j av a 2s . c om*/ }); if (filter.hasNext()) { semanticObject.eAdapters().remove(filter.next()); toMakeAutosize.add(nd); } } } } if (toMakeAutosize.size() > 0) { Command result = new RecordingCommand(domain) { @Override protected void doExecute() { for (Node node : toMakeAutosize) { if (node.getLayoutConstraint() instanceof Bounds) { ((Bounds) node.getLayoutConstraint()).setWidth(-1); ((Bounds) node.getLayoutConstraint()).setHeight(-1); } } } }; return Options.newSome(result); } return Options.newNone(); }
From source file:org.splevo.ui.handler.vpm.CombineGroupsHandler.java
/** * Combine a set of variation point groups and update the enclosing resources. * * @param groupsToMerge//from w w w .j a v a2 s.c o m * The VPGs to merge. * @throws ExecutionException * if failed to combine the groups. */ private void combineGroups(Set<VariationPointGroup> groupsToMerge) throws ExecutionException { Set<Resource> resourcesToSave = Sets.newLinkedHashSet(); VariationPointGroup survivingGroup = groupsToMerge.iterator().next(); VariationPointModel vpm = survivingGroup.getModel(); for (VariationPointGroup vpg : groupsToMerge) { resourcesToSave.add(vpg.eResource()); combineGroup(survivingGroup, vpg, vpm); } updateResources(resourcesToSave); }