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:org.jclouds.deltacloud.xml.HardwarePropertyHandler.java

/**
 * resets state of the handler when called.
 * /*  w w w  . ja  v  a  2s .  c om*/
 * @return property or null
 */
public HardwareProperty getResult() {
    try {
        switch (kind) {
        case FIXED:
            return new FixedHardwareProperty(name, unit, value);
        case ENUM:
            return new EnumHardwareProperty(name, unit, value, param, availableValues);
        case RANGE:
            return new RangeHardwareProperty(name, unit, (Number) value, param, first, last);
        default:
            return null;
        }
    } finally {
        this.kind = null;
        this.name = null;
        this.unit = null;
        this.value = null;
        this.param = null;
        this.availableValues = Sets.newLinkedHashSet();
        this.first = null;
        this.last = null;
    }
}

From source file:org.napile.compiler.lang.resolve.scopes.WriteThroughScope.java

@Override
@NotNull/*  ww  w.  j a  v a2 s  . c o  m*/
public Collection<MethodDescriptor> getMethods(@NotNull Name name) {
    checkMayRead();

    Set<MethodDescriptor> result = Sets.newLinkedHashSet();

    result.addAll(writableWorker.getMethods(name));

    result.addAll(getWorkerScope().getMethods(name));

    result.addAll(super.getMethods(name)); // Imports

    return result;
}

From source file:org.eclipse.sirius.diagram.ui.tools.internal.actions.delete.DeleteWithHookAction.java

private Collection<DSemanticDecorator> computeSelections() {

    final Set<DSemanticDecorator> diagramElements = Sets.newLinkedHashSet();

    for (final Object selectedObject : getSelectedObjects()) {
        if (selectedObject instanceof IGraphicalEditPart) {
            final IGraphicalEditPart gEditPart = (IGraphicalEditPart) selectedObject;
            final View view = (View) gEditPart.getModel();
            final EObject element = ViewUtil.resolveSemanticElement(view);
            if (element instanceof DSemanticDecorator) {
                diagramElements.add((DSemanticDecorator) element);
            }/* w  w  w. j a v a2  s .  co  m*/
        }
    }
    return diagramElements;
}

From source file:org.obeonetwork.dsl.uml2.design.internal.triggers.AutosizeTrigger.java

public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) {
    final Collection<Node> toMakeAutosize = Sets.newLinkedHashSet();
    for (final Notification notif : notifications) {
        final Node nd = (Node) notif.getNewValue();
        if (nd.getElement() instanceof DSemanticDecorator) {
            final EObject semanticObject = ((DSemanticDecorator) nd.getElement()).getTarget();
            final 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  a  v  a 2  s.c o  m*/
                    });

            if (filter.hasNext()) {
                semanticObject.eAdapters().remove(filter.next());
                toMakeAutosize.add(nd);
            }

        }
    }
    if (toMakeAutosize.size() > 0) {
        final Command result = new RecordingCommand(domain) {

            @Override
            protected void doExecute() {
                for (final 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:exec.validate_evaluation.streaks.EditStreakGenerationIo.java

public Set<EditStreak> readEditStreaks(String zip) {
    Set<EditStreak> streaks = Sets.newLinkedHashSet();
    Directory dir = new Directory(dirOut);
    try (IReadingArchive ra = dir.getReadingArchive(zip)) {
        while (ra.hasNext()) {
            EditStreak es = ra.getNext(EditStreak.class);
            streaks.add(es);//  w  w w  .  ja v a2s .  c  o  m
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    return streaks;
}

From source file:it.anyplace.sync.discovery.utils.AddressRanker.java

private List<DeviceAddress> preprocessDeviceAddresses(List<DeviceAddress> list) {
    Set<DeviceAddress> res = Sets.newLinkedHashSet();
    for (DeviceAddress deviceAddress : list) {
        logger.debug("preprocess address = {}", deviceAddress.getAddress());
        if (equal(deviceAddress.getType(), AddressType.RELAY)
                && deviceAddress.containsUriParamValue("httpUrl")) {
            String httpUrl = deviceAddress.getUriParam("httpUrl");
            DeviceAddress httpRelayAddress = deviceAddress.copyBuilder().setAddress("relay-" + httpUrl).build();
            logger.debug("extracted http relay address = {}", httpRelayAddress.getAddress());
            res.add(httpRelayAddress);/*w w w.j av  a2 s.  com*/
        }
        res.add(deviceAddress);
    }
    return Lists.newArrayList(res);
}

From source file:org.terasology.world.propagation.BatchPropagator.java

public BatchPropagator(PropagationRules rules, PropagatorWorldView world) {
    this.world = world;
    this.rules = rules;

    for (Side side : Side.values()) {
        Vector3i delta = new Vector3i(side.getVector3i());
        if (delta.x < 0) {
            delta.x += ChunkConstants.SIZE_X;
        } else if (delta.x > 0) {
            delta.x -= ChunkConstants.SIZE_X;
        }/*w w w .j av a  2  s .  c o  m*/
        if (delta.y < 0) {
            delta.y += ChunkConstants.SIZE_Y;
        } else if (delta.y > 0) {
            delta.y -= ChunkConstants.SIZE_Y;
        }
        if (delta.z < 0) {
            delta.z += ChunkConstants.SIZE_Z;
        } else if (delta.z > 0) {
            delta.z -= ChunkConstants.SIZE_Z;
        }
        chunkEdgeDeltas.put(side, delta);
    }

    increaseQueues = new Set[rules.getMaxValue()];
    reduceQueues = new Set[rules.getMaxValue()];
    for (int i = 0; i < rules.getMaxValue(); ++i) {
        increaseQueues[i] = Sets.newLinkedHashSet();
        reduceQueues[i] = Sets.newLinkedHashSet();
    }

}

From source file:org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry.java

public AbstractClasspathEntry(String path) {
    Preconditions.checkNotNull(path);/*from   w w  w . j av a  2  s  .  c o  m*/
    this.path = normalizePath(path);
    this.exported = false;
    this.accessRules = Sets.newLinkedHashSet();
    this.entryAttributes = Maps.newLinkedHashMap();
}

From source file:org.sonar.server.component.DefaultComponentFinder.java

private static Collection<? extends Component> pagedComponents(Collection<? extends Component> components,
        Paging paging) {/*www.  j  a v a  2s  .  c  om*/
    Set<Component> pagedComponents = Sets.newLinkedHashSet();
    int index = 0;
    for (Component component : components) {
        if (index >= paging.offset() && pagedComponents.size() < paging.pageSize()) {
            pagedComponents.add(component);
        } else if (pagedComponents.size() >= paging.pageSize()) {
            break;
        }
        index++;
    }
    return pagedComponents;
}

From source file:com.google.devtools.j2objc.translate.SuperMethodInvocationRewriter.java

@Override
public boolean visit(CompilationUnit unit) {
    superMethods = Sets.newLinkedHashSet();
    typeMap = Maps.newHashMap();
    return true;
}