Example usage for com.google.common.collect Sets newLinkedHashSet

List of usage examples for com.google.common.collect Sets newLinkedHashSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newLinkedHashSet.

Prototype

public static <E> LinkedHashSet<E> newLinkedHashSet() 

Source Link

Document

Creates a mutable, empty LinkedHashSet instance.

Usage

From source file:de.monticore.generating.templateengine.reporting.reporter.VariablesReporter.java

private void writeContent() {
    Set<String> allKeys = Sets.newLinkedHashSet();
    allKeys.addAll(var2adds.keySet());
    allKeys.addAll(var2asmt.keySet());
    for (String key : allKeys) {
        String adds = getNumber(var2adds, key);
        String asmts = getNumber(var2asmt, key);

        writeLine(asmts + Layouter.getSpaceString(7 - asmts.length()) + adds
                + Layouter.getSpaceString(7 - adds.length()) + key);
    }//from  w  w  w .  ja v  a  2 s. c o  m
}

From source file:org.eclipse.emf.compare.diagram.ide.ui.sirius.internal.SiriusTechnicalElementsFilter.java

/**
 * return a set containing all the known EObject affected by the match being from the left, right or
 * ancestor version./*from   www  .  j av a  2 s.  c  om*/
 * 
 * @param match
 *            any match..
 * @return a set containing all the known EObject affected by the match being from the left, right or
 *         ancestor version.
 */
private static Set<EObject> matchedEObjects(Match match) {
    Set<EObject> affectedEObjects = Sets.newLinkedHashSet();
    if (match.getLeft() != null) {
        affectedEObjects.add(match.getLeft());
    }
    if (match.getRight() != null) {
        affectedEObjects.add(match.getRight());
    }
    if (match.getOrigin() != null) {
        affectedEObjects.add(match.getOrigin());
    }
    return affectedEObjects;
}

From source file:org.obeonetwork.dsl.uml2.core.internal.services.StereotypeServices.java

/**
 * Apply Profiles.//ww w .j a  v a2s. co  m
 *
 * @param pkg
 *            Package
 * @param profilesToApply
 *            list of profile to apply to package
 * @return The element on which profiles are applied
 */
public Package applyAllProfiles(Package pkg, List<Profile> profilesToApply) {
    final Session session = SessionManager.INSTANCE.getSession(pkg);
    final List<Profile> alreadyAppliedProfiles = pkg.getAppliedProfiles();
    for (final Profile profile : profilesToApply) {
        if (!alreadyAppliedProfiles.contains(profile)) {
            pkg.applyProfile(profile);
            // Register metamodel
            for (final ProfileApplication profileApplication : profile.getAllProfileApplications()) {
                final Set<MetamodelDescriptor> descriptorsForInterpreter = Sets.newLinkedHashSet();
                descriptorsForInterpreter
                        .add(new EcoreMetamodelDescriptor(profileApplication.getAppliedDefinition()));
                session.getInterpreter().activateMetamodels(descriptorsForInterpreter);
            }
        }
    }
    return pkg;
}

From source file:org.eclipse.sirius.tools.internal.command.listener.ChangeListener.java

private void init() {
    deletedElements = Sets.newLinkedHashSet();
    createdElements = Sets.newLinkedHashSet();
    modifiedElements = Sets.newLinkedHashSet();
}

From source file:org.obeonetwork.dsl.uml2.design.services.internal.RelatedCompositeStructureElementsSwitch.java

public List<EObject> getRelatedElements(EObject ctx) {
    Session sess = SessionManager.INSTANCE.getSession(ctx);
    relateds = Sets.newLinkedHashSet();
    if (sess != null) {
        xRefs = sess.getSemanticCrossReferencer().getInverseReferences(ctx);
    } else if (referencer != null) {
        xRefs = referencer.getInverseReferences(ctx);
    }//  w w w.j a  va2s  .  c  o  m
    doSwitch(ctx);
    relateds.remove(ctx);
    // hack to prevent some null element in relateds for a unknown reason.
    relateds.remove(null);

    return ImmutableList.copyOf(relateds);
}

From source file:org.apache.brooklyn.entity.software.base.SameServerDriverLifecycleEffectorTasks.java

/**
 * @return the ports that this entity wants to use, aggregated for all its child entities.
 * @see InboundPortsUtils#getRequiredOpenPorts(Entity, Boolean, String)
 *///w w w.j a va2  s  .  co  m
protected Collection<Integer> getRequiredOpenPorts() {
    Set<Integer> result = Sets.newLinkedHashSet();
    result.addAll(getRequiredOpenPorts(entity()));
    LOG.debug("getRequiredOpenPorts detected aggregated default {} for {}", result, this);
    return result;
}

From source file:org.eclipse.sirius.diagram.editor.tools.internal.menu.initializer.InitializerMenu.java

private Collection generateInitializerActions(final Viewpoint viewpoint, final IEditorPart editor) {

    // We first build all candidate Actions
    Set<Action> allActions = Sets.newLinkedHashSet();
    allActions.add(new InitializerOpenWizardAction(editor, viewpoint));
    return allActions;
}

From source file:org.jasig.ssp.factory.AbstractTOFactory.java

public Set<TObject> asTOSetOrdered(final Collection<M> models) {
    final Set<TObject> tos = Sets.newLinkedHashSet();
    for (M model : models) {
        tos.add(from(model));/*from ww w  .j a v  a2s . c om*/
    }
    return tos;
}

From source file:org.eclipse.sirius.ui.tools.internal.views.common.FileSessionFinder.java

/**
 * Get session linked to an aird or transient session linked to its semantic
 * resource.//from w ww  .ja v  a  2 s . c  om
 */
private static Collection<Session> getSessionFromFile(IFile file, boolean lookFromSemanticAndControlled) {
    Collection<Session> sessions = Sets.newLinkedHashSet();
    boolean lookForTransientSession = !SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(file.getFileExtension());
    URI fileURI = getFileUri(file);
    for (Session session : SessionManager.INSTANCE.getSessions()) {
        if (checkedSession(session, file, fileURI, lookForTransientSession, lookFromSemanticAndControlled)) {
            sessions.add(session);
        }
    }
    return sessions;
}

From source file:org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtils.java

@NotNull
public static Collection<KotlinProjectConfigurator> getAbleToRunConfigurators(@NotNull Project project) {
    Collection<Module> modules = getModulesWithKotlinFiles(project);

    Set<KotlinProjectConfigurator> canRunConfigurators = Sets.newLinkedHashSet();
    for (KotlinProjectConfigurator configurator : Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)) {
        for (Module module : modules) {
            if (configurator.isApplicable(module) && !configurator.isConfigured(module)) {
                canRunConfigurators.add(configurator);
                break;
            }/*from  www.ja va2  s  . c  om*/
        }
    }

    return canRunConfigurators;
}