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 a Map
used for efficient lookup of ordinary named
EObjectDescriptions
.
This implementation assumes, that the keys of the Map
correspond to the keys of the contained EObjectDescription
.
Additionally it assumes, that those keys are equal to description.getName().toLowerCase()
.
When looking up elements using ISelector.SelectByName
this implementation looks up the the elements from the map, hence are much
more efficient for many IEObjectDescription
s.
- Author:
- Sven Efftinge - Initial contribution and API
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 |
MapBasedScope
protected MapBasedScope(IScope parent,
java.util.Map<QualifiedName,IEObjectDescription> elements,
boolean ignoreCase)
createScope
public static IScope createScope(IScope parent,
java.lang.Iterable<IEObjectDescription> descriptions,
boolean ignoreCase)
createScope
public static IScope createScope(IScope parent,
java.lang.Iterable<IEObjectDescription> descriptions)
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)
- Overrides:
isShadowed
in class AbstractScope