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 aMapused for efficient lookup of ordinary namedEObjectDescriptions. This implementation assumes, that the keys of theMapcorrespond 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 manyIEObjectDescriptions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.xtext.scoping.impl.AbstractScope
AbstractScope.ParentIterable
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapBasedScope(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 IScopecreateScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions)static IScopecreateScope(IScope parent, java.lang.Iterable<IEObjectDescription> descriptions, boolean ignoreCase)static IScopecreateScope(IScope parent, java.util.Collection<IEObjectDescription> descriptions)protected java.lang.Iterable<IEObjectDescription>getAllLocalElements()protected java.lang.Iterable<IEObjectDescription>getLocalElementsByName(QualifiedName name)protected booleanisShadowed(IEObjectDescription fromParent)Returnstrueif the given descriptioninputfrom 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:
getAllLocalElementsin classAbstractScope
-
getLocalElementsByName
protected java.lang.Iterable<IEObjectDescription> getLocalElementsByName(QualifiedName name)
- Overrides:
getLocalElementsByNamein classAbstractScope
-
isShadowed
protected boolean isShadowed(IEObjectDescription fromParent)
Description copied from class:AbstractScopeReturnstrueif the given descriptioninputfrom the parent scope is shadowed by local elements.- Overrides:
isShadowedin classAbstractScope- Returns:
trueif the given descriptioninputfrom the parent scope is shadowed by local elements.
-
-