org.eclipse.xtext.scoping.impl
Class MultimapBasedScope

java.lang.Object
  extended by org.eclipse.xtext.scoping.impl.AbstractScope
      extended by org.eclipse.xtext.scoping.impl.MultimapBasedScope
All Implemented Interfaces:
IScope

public class MultimapBasedScope
extends AbstractScope

A scope implemented using a Multimap. This implementation assumes, that the keys of the Multimap are the keys of the contained EObjectDescriptions as well as the name. When looking up elements using AbstractScope.getElements(QualifiedName) this implementation looks up the the elements from the map, hence are much more efficient for many IEObjectDescriptions.

Author:
Sven Efftinge - Initial contribution and API, Sebastian Zarnekow

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.xtext.scoping.impl.AbstractScope
AbstractScope.ParentIterable
 
Field Summary
 
Fields inherited from interface org.eclipse.xtext.scoping.IScope
NULLSCOPE
 
Constructor Summary
protected MultimapBasedScope(IScope parent, com.google.common.collect.Multimap<QualifiedName,IEObjectDescription> elements, boolean ignoreCase)
           
 
Method Summary
static IScope createScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions, boolean ignoreCase)
           
protected  java.lang.Iterable<IEObjectDescription> getAllLocalElements()
           
protected  java.lang.Iterable<IEObjectDescription> getLocalElementsByName(QualifiedName name)
           
protected  boolean isShadowed(IEObjectDescription fromParent)
          Returns true if the given description input from the parent scope is shadowed by local elements.
 
Methods inherited from class org.eclipse.xtext.scoping.impl.AbstractScope
getAllElements, getElements, getElements, getLocalElementsByEObject, getParent, getParentElements, getSingleElement, getSingleElement, getSingleLocalElementByName, isIgnoreCase, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultimapBasedScope

protected MultimapBasedScope(IScope parent,
                             com.google.common.collect.Multimap<QualifiedName,IEObjectDescription> elements,
                             boolean ignoreCase)
Method Detail

createScope

public static IScope createScope(IScope parent,
                                 java.lang.Iterable<IEObjectDescription> descriptions,
                                 boolean ignoreCase)

getAllLocalElements

protected java.lang.Iterable<IEObjectDescription> getAllLocalElements()
Specified by:
getAllLocalElements in class AbstractScope

getLocalElementsByName

protected java.lang.Iterable<IEObjectDescription> getLocalElementsByName(QualifiedName name)
Overrides:
getLocalElementsByName in class AbstractScope

isShadowed

protected boolean isShadowed(IEObjectDescription fromParent)
Description copied from class: AbstractScope
Returns true if the given description input from the parent scope is shadowed by local elements.

Overrides:
isShadowed in class AbstractScope
Returns:
true if the given description input from the parent scope is shadowed by local elements.