Class CachedLightSimpleScope
- java.lang.Object
-
- com._1c.g5.modeling.xtext.scoping.LightAbstractScope
-
- com._1c.g5.modeling.xtext.scoping.LightSimpleScope
-
- com._1c.g5.modeling.xtext.scoping.CachedLightSimpleScope
-
- All Implemented Interfaces:
ISlicedScope
,org.eclipse.xtext.scoping.IScope
- Direct Known Subclasses:
PlatformSimpleScope
public class CachedLightSimpleScope extends LightSimpleScope implements ISlicedScope
Lightweight and cached implementation of the SimpleScope.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com._1c.g5.modeling.xtext.scoping.LightAbstractScope
LightAbstractScope.EObjectFilterPredicate, LightAbstractScope.ParentIterable
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Integer>
allElementsByName
protected org.eclipse.xtext.resource.IEObjectDescription[]
elements
protected IIndexSlicesManager
sliceManager
-
Fields inherited from class com._1c.g5.modeling.xtext.scoping.LightSimpleScope
descriptions
-
Fields inherited from interface com._1c.g5.modeling.xtext.scoping.ISlicedScope
NULLSCOPE
-
-
Constructor Summary
Constructors Constructor Description CachedLightSimpleScope(Iterable<org.eclipse.xtext.resource.IEObjectDescription> descriptions, boolean ignoreCase, Collection<ISliceFilter> predicatesForSlices)
ConstructorCachedLightSimpleScope(org.eclipse.xtext.scoping.IScope parent, Iterable<org.eclipse.xtext.resource.IEObjectDescription> descriptions, boolean ignoreCase, Collection<ISliceFilter> predicatesForSlices)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<org.eclipse.xtext.resource.IEObjectDescription>
getAllElements()
Iterable<org.eclipse.xtext.resource.IEObjectDescription>
getAllElements(Collection<ISliceFilter> slices)
Obtain all elements from the scope.Iterable<org.eclipse.xtext.resource.IEObjectDescription>
getElements(org.eclipse.emf.ecore.EObject object, Collection<ISliceFilter> slices)
Finds all descriptions that match the given instance.Iterable<org.eclipse.xtext.resource.IEObjectDescription>
getElements(org.eclipse.xtext.naming.QualifiedName name)
Iterable<org.eclipse.xtext.resource.IEObjectDescription>
getElements(org.eclipse.xtext.naming.QualifiedName name, Collection<ISliceFilter> slices)
Find all descriptions that match the given name.org.eclipse.xtext.resource.IEObjectDescription
getSingleElement(org.eclipse.xtext.naming.QualifiedName name)
org.eclipse.xtext.resource.IEObjectDescription
getSingleElement(org.eclipse.xtext.naming.QualifiedName name, Collection<ISliceFilter> slices)
Finds the first description that matches the given name.protected org.eclipse.xtext.resource.IEObjectDescription
getSingleLocalElementByName(org.eclipse.xtext.naming.QualifiedName name)
protected boolean
isShadowed(org.eclipse.xtext.resource.IEObjectDescription fromParent)
Returnstrue
if the given descriptioninput
from the parent scope is shadowed by local elements.-
Methods inherited from class com._1c.g5.modeling.xtext.scoping.LightSimpleScope
getAllLocalElements, getLocalElementsByEObject, getLocalElementsByName, getShadowingKey
-
Methods inherited from class com._1c.g5.modeling.xtext.scoping.LightAbstractScope
getElements, getParent, getParentElements, getSingleElement, isIgnoreCase, toString
-
-
-
-
Field Detail
-
elements
protected org.eclipse.xtext.resource.IEObjectDescription[] elements
-
sliceManager
protected IIndexSlicesManager sliceManager
-
-
Constructor Detail
-
CachedLightSimpleScope
public CachedLightSimpleScope(org.eclipse.xtext.scoping.IScope parent, Iterable<org.eclipse.xtext.resource.IEObjectDescription> descriptions, boolean ignoreCase, Collection<ISliceFilter> predicatesForSlices)
Constructor- Parameters:
parent
- parent scope, can't benull
descriptions
-IEObjectDescription
s for creating scope, can't benull
ignoreCase
-true
if it's insensitive scope,false
otherwisepredicatesForSlices
- collection ofISliceFilter
defining slices of index elements, can't benull
-
CachedLightSimpleScope
public CachedLightSimpleScope(Iterable<org.eclipse.xtext.resource.IEObjectDescription> descriptions, boolean ignoreCase, Collection<ISliceFilter> predicatesForSlices)
Constructor- Parameters:
descriptions
- all elements contained in scope, can't benull
ignoreCase
- whether name lookup and shadowing should be case insensitive or not.predicatesForSlices
- collection ofISliceFilter
defining slices of index elements, can't benull
-
-
Method Detail
-
getSingleElement
public org.eclipse.xtext.resource.IEObjectDescription getSingleElement(org.eclipse.xtext.naming.QualifiedName name, Collection<ISliceFilter> slices)
Description copied from interface:ISlicedScope
Finds the first description that matches the given name.- Specified by:
getSingleElement
in interfaceISlicedScope
- Parameters:
name
- the name of the to-be-found element. May not benull
.slices
- list of predicates corresponding to the index slices, can't benull
- Returns:
- the first element that matches the
name
. May benull
.
-
getSingleElement
public org.eclipse.xtext.resource.IEObjectDescription getSingleElement(org.eclipse.xtext.naming.QualifiedName name)
- Specified by:
getSingleElement
in interfaceorg.eclipse.xtext.scoping.IScope
- Overrides:
getSingleElement
in classLightAbstractScope
-
getElements
public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getElements(org.eclipse.xtext.naming.QualifiedName name, Collection<ISliceFilter> slices)
Description copied from interface:ISlicedScope
Find all descriptions that match the given name.- Specified by:
getElements
in interfaceISlicedScope
- Parameters:
name
- the name of the to-be-found elements. May not benull
.slices
- list of predicates corresponding to the index slices, can't benull
- Returns:
- all elements that match the
name
. Nevernull
.
-
getElements
public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getElements(org.eclipse.xtext.naming.QualifiedName name)
- Specified by:
getElements
in interfaceorg.eclipse.xtext.scoping.IScope
- Overrides:
getElements
in classLightAbstractScope
-
getAllElements
public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getAllElements(Collection<ISliceFilter> slices)
Description copied from interface:ISlicedScope
Obtain all elements from the scope. Implementors a free to throw anUnsupportedOperationException
if the scope cannot be enumerated.- Specified by:
getAllElements
in interfaceISlicedScope
- Parameters:
slices
- list of predicates corresponding to the index slices, can't benull
- Returns:
- all elements of the scope. Never
null
.
-
getAllElements
public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getAllElements()
- Specified by:
getAllElements
in interfaceorg.eclipse.xtext.scoping.IScope
- Overrides:
getAllElements
in classLightAbstractScope
-
getElements
public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getElements(org.eclipse.emf.ecore.EObject object, Collection<ISliceFilter> slices)
Description copied from interface:ISlicedScope
Finds all descriptions that match the given instance.- Specified by:
getElements
in interfaceISlicedScope
- Parameters:
object
- the instance whose descriptions should be obtained. May not benull
.slices
- list of predicates corresponding to the index slices, can't benull
- Returns:
- all elements that match the
instance
. Nevernull
.
-
getSingleLocalElementByName
protected org.eclipse.xtext.resource.IEObjectDescription getSingleLocalElementByName(org.eclipse.xtext.naming.QualifiedName name)
- Overrides:
getSingleLocalElementByName
in classLightSimpleScope
-
isShadowed
protected boolean isShadowed(org.eclipse.xtext.resource.IEObjectDescription fromParent)
Description copied from class:LightAbstractScope
Returnstrue
if the given descriptioninput
from the parent scope is shadowed by local elements.- Overrides:
isShadowed
in classLightAbstractScope
- Returns:
true
if the given descriptioninput
from the parent scope is shadowed by local elements.
-
-