Package org.eclipse.xtext.scoping.impl
Class MapBasedScope
- java.lang.Object
-
- org.eclipse.xtext.scoping.impl.AbstractScope
-
- org.eclipse.xtext.scoping.impl.MapBasedScope
-
- All Implemented Interfaces:
IScope
public class MapBasedScope extends AbstractScope
A scope implemented using aMap
used for efficient lookup of ordinary namedEObjectDescriptions
. This implementation assumes, that the keys of theMap
correspond to the keys of the containedEObjectDescription
. Additionally it assumes, that those keys are equal todescription.getName().toLowerCase()
. When looking up elements usingAbstractScope.getElements(QualifiedName)
this implementation looks up the elements from the map, hence are much more efficient for manyIEObjectDescription
s.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.xtext.scoping.impl.AbstractScope
AbstractScope.ParentIterable
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapBasedScope(IScope parent, java.util.Map<QualifiedName,IEObjectDescription> elements, boolean ignoreCase)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IScope
createScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions)
static IScope
createScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions, boolean ignoreCase)
static IScope
createScope(IScope parent, java.util.Collection<IEObjectDescription> descriptions)
protected java.lang.Iterable<IEObjectDescription>
getAllLocalElements()
protected java.lang.Iterable<IEObjectDescription>
getLocalElementsByName(QualifiedName name)
protected boolean
isShadowed(IEObjectDescription fromParent)
Returnstrue
if the given descriptioninput
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
-
-
-
-
Constructor Detail
-
MapBasedScope
protected MapBasedScope(IScope parent, java.util.Map<QualifiedName,IEObjectDescription> elements, boolean ignoreCase)
-
-
Method Detail
-
createScope
public static IScope createScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions, boolean ignoreCase)
-
createScope
public static IScope createScope(IScope parent, java.util.Collection<IEObjectDescription> descriptions)
- Since:
- 2.3
-
createScope
public static IScope createScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions)
-
getAllLocalElements
protected java.lang.Iterable<IEObjectDescription> getAllLocalElements()
- Specified by:
getAllLocalElements
in classAbstractScope
-
getLocalElementsByName
protected java.lang.Iterable<IEObjectDescription> getLocalElementsByName(QualifiedName name)
- Overrides:
getLocalElementsByName
in classAbstractScope
-
isShadowed
protected boolean isShadowed(IEObjectDescription fromParent)
Description copied from class:AbstractScope
Returnstrue
if the given descriptioninput
from the parent scope is shadowed by local elements.- Overrides:
isShadowed
in classAbstractScope
- Returns:
true
if the given descriptioninput
from the parent scope is shadowed by local elements.
-
-