Example usage for com.google.common.collect Multimaps unmodifiableSetMultimap

List of usage examples for com.google.common.collect Multimaps unmodifiableSetMultimap

Introduction

In this page you can find the example usage for com.google.common.collect Multimaps unmodifiableSetMultimap.

Prototype

@Deprecated
public static <K, V> SetMultimap<K, V> unmodifiableSetMultimap(ImmutableSetMultimap<K, V> delegate) 

Source Link

Document

Simply returns its argument.

Usage

From source file:org.n52.iceland.coding.AbstractCodingRepository.java

public SetMultimap<K, Producer<C>> getComponentProvidersByKey() {
    return Multimaps.unmodifiableSetMultimap(componentsByKey);
}

From source file:org.opencms.util.CmsManyToOneMap.java

/**
 * Gets the multimap from values to keys.<p>
 *
 * @return the multimap from values to keys
 */
Multimap<V, K> getReverseMap() {

    return Multimaps.unmodifiableSetMultimap(m_reverseMap);
}

From source file:com.continuuity.weave.internal.DefaultResourceReport.java

/**
 * Get all the run resources being used across all runnables.
 *
 * @return all run resources used by all instances of all runnables.
 *///from  w  w  w  . j a  v a2s  .c om
@Override
public Map<String, Collection<WeaveRunResources>> getResources() {
    return Multimaps.unmodifiableSetMultimap(usedResources).asMap();
}

From source file:org.apache.twill.internal.DefaultResourceReport.java

/**
 * Get all the run resources being used across all runnables.
 *
 * @return all run resources used by all instances of all runnables.
 *///  w  w w . java  2  s .  co m
@Override
public Map<String, Collection<TwillRunResources>> getResources() {
    return Multimaps.unmodifiableSetMultimap(usedResources).asMap();
}

From source file:eu.esdihumboldt.hale.common.align.model.transformation.tree.impl.TargetNodeImpl.java

/**
 * Create a target node that is populated with assignments and children
 * according to the given parameters./*from   www  .ja v a2s. c o  m*/
 * 
 * @param entity the associated definition
 * @param cells the cells associated with this node or its children
 * @param parentType the type representing the root
 * @param depth the depth down from the root node
 * @param parent the parent node
 */
public TargetNodeImpl(EntityDefinition entity, Collection<CellNode> cells, TypeDefinition parentType, int depth,
        GroupNode parent) {
    super(parent);
    this.entity = entity;

    // partition cells by child
    ListMultimap<EntityDefinition, CellNode> childCells = ArrayListMultimap.create();
    // ... and for this node
    SetMultimap<CellNode, String> assignSet = HashMultimap.create();
    for (CellNode cell : cells) {
        for (Entry<String, ?> entry : cell.getCell().getTarget().asMap().entrySet()) {
            String name = entry.getKey();
            @SuppressWarnings("unchecked")
            Collection<? extends Entity> entities = (Collection<? extends Entity>) entry.getValue();

            for (Entity target : entities) {
                if (target.getDefinition().getType().equals(parentType)) {
                    List<ChildContext> path = target.getDefinition().getPropertyPath();
                    if (path.get(depth - 1).getChild().equals(entity.getDefinition())) {
                        if (path.size() <= depth) {
                            // this cell belongs to this node
                            assignSet.put(cell, name);
                            cell.addTarget(this);
                        } else {
                            // this cell belongs to a child node
                            childCells.put(AlignmentUtil.deriveEntity(target.getDefinition(), depth + 1), cell);
                        }
                    }
                }
            }
        }
    }

    assignments = Multimaps.unmodifiableSetMultimap(assignSet);

    // create child cells
    List<TargetNode> childList = new ArrayList<TargetNode>();
    for (Entry<EntityDefinition, Collection<CellNode>> childEntry : childCells.asMap().entrySet()) {
        TargetNode childNode = new TargetNodeImpl(childEntry.getKey(), childEntry.getValue(), parentType,
                depth + 1, this);
        childList.add(childNode);
    }

    children = Collections.unmodifiableList(childList);
}

From source file:org.eclipse.gef4.mvc.parts.AbstractContentPart.java

/**
 * {@inheritDoc}//from w ww.j  av  a  2s  . co  m
 * <p>
 * Delegates to {@link #doAttachToContentAnchorage(Object, String)}, which
 * is to be overwritten by subclasses.
 */
@Override
public final void attachToContentAnchorage(Object contentAnchorage, String role) {
    SetMultimap<Object, String> oldContentAnchorages = HashMultimap.create(getContentAnchorages());
    if (oldContentAnchorages.containsEntry(contentAnchorage, role)) {
        throw new IllegalArgumentException(
                "Already attached to anchorage " + contentAnchorage + " in role '" + role + "'.");
    }
    doAttachToContentAnchorage(contentAnchorage, role);
    // check doAttachToContentAnchorage(Object, String) does not violate
    // postconditions
    if (!getContentAnchorages().containsEntry(contentAnchorage, role)) {
        throw new IllegalArgumentException("doAttachToContentAnchorage did not properly attach to "
                + contentAnchorage + " with role '" + role + "'.");
    }
    pcs.firePropertyChange(CONTENT_ANCHORAGES_PROPERTY, oldContentAnchorages,
            Multimaps.unmodifiableSetMultimap(getContentAnchorages()));
}

From source file:com.googlecode.blaisemath.graph.OptimizedGraph.java

/**
 * Get copy of neighbors.
 * @return neighbors
 */
public Multimap<V, V> getNeighbors() {
    return Multimaps.unmodifiableSetMultimap(neighbors);
}

From source file:org.eclipse.gef4.mvc.parts.AbstractContentPart.java

/**
 * {@inheritDoc}/*from   www  .j  a  v a  2 s  .  c o m*/
 * <p>
 * Delegates to {@link #doDetachFromContentAnchorage(Object, String)}, which
 * is to be overwritten by subclasses.
 */
@Override
public final void detachFromContentAnchorage(Object contentAnchorage, String role) {
    SetMultimap<Object, String> oldContentAnchorages = HashMultimap.create(getContentAnchorages());
    if (!oldContentAnchorages.containsEntry(contentAnchorage, role)) {
        throw new IllegalArgumentException(
                "Not attached to content anchorage " + contentAnchorage + " with role '" + role + "'.");
    }
    doDetachFromContentAnchorage(contentAnchorage, role);
    // check postconditions for doDetachFromContentAnchorage(Object, String)
    if (getContentAnchorages().containsEntry(contentAnchorage, role)) {
        throw new IllegalArgumentException("doDetachFromContentAnchorage did not properly detach from "
                + contentAnchorage + " with role '" + role + "'.");
    }
    pcs.firePropertyChange(CONTENT_ANCHORAGES_PROPERTY, oldContentAnchorages,
            Multimaps.unmodifiableSetMultimap(getContentAnchorages()));
}

From source file:ch.raffael.util.binding.PresentationModel.java

public SetMultimap<Object, Message> getValidationMessages() {
    return Multimaps.unmodifiableSetMultimap(validationMessages);
}

From source file:org.eclipse.gef4.mvc.parts.AbstractVisualPart.java

@Override
public SetMultimap<IVisualPart<VR, ? extends VR>, String> getAnchorages() {
    if (anchorages == null) {
        return Multimaps.unmodifiableSetMultimap(HashMultimap.<IVisualPart<VR, ? extends VR>, String>create());
    }//from   w  w  w. j  a  va 2 s .co m
    return Multimaps.unmodifiableSetMultimap(anchorages);
}