Class 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.
  • Field Details

    • elements

      protected org.eclipse.xtext.resource.IEObjectDescription[] elements
    • sliceManager

      protected IIndexSlicesManager sliceManager
    • allElementsByName

      protected volatile Map<String,Integer> allElementsByName
  • Constructor Details

    • 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 be null
      descriptions - IEObjectDescriptions for creating scope, can't be null
      ignoreCase - true if it's insensitive scope, false otherwise
      predicatesForSlices - collection of ISliceFilter defining slices of index elements, can't be null
    • 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 be null
      ignoreCase - whether name lookup and shadowing should be case insensitive or not.
      predicatesForSlices - collection of ISliceFilter defining slices of index elements, can't be null
  • Method Details

    • 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 interface ISlicedScope
      Parameters:
      name - the name of the to-be-found element. May not be null.
      slices - list of predicates corresponding to the index slices, can't be null
      Returns:
      the first element that matches the name. May be null.
    • getSingleElement

      public org.eclipse.xtext.resource.IEObjectDescription getSingleElement(org.eclipse.xtext.naming.QualifiedName name)
      Specified by:
      getSingleElement in interface org.eclipse.xtext.scoping.IScope
      Overrides:
      getSingleElement in class LightAbstractScope
    • 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 interface ISlicedScope
      Parameters:
      name - the name of the to-be-found elements. May not be null.
      slices - list of predicates corresponding to the index slices, can't be null
      Returns:
      all elements that match the name. Never null.
    • getElements

      public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getElements(org.eclipse.xtext.naming.QualifiedName name)
      Specified by:
      getElements in interface org.eclipse.xtext.scoping.IScope
      Overrides:
      getElements in class LightAbstractScope
    • 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 an UnsupportedOperationException if the scope cannot be enumerated.
      Specified by:
      getAllElements in interface ISlicedScope
      Parameters:
      slices - list of predicates corresponding to the index slices, can't be null
      Returns:
      all elements of the scope. Never null.
    • getAllElements

      public Iterable<org.eclipse.xtext.resource.IEObjectDescription> getAllElements()
      Specified by:
      getAllElements in interface org.eclipse.xtext.scoping.IScope
      Overrides:
      getAllElements in class LightAbstractScope
    • 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 interface ISlicedScope
      Parameters:
      object - the instance whose descriptions should be obtained. May not be null.
      slices - list of predicates corresponding to the index slices, can't be null
      Returns:
      all elements that match the instance. Never null.
    • getSingleLocalElementByName

      protected org.eclipse.xtext.resource.IEObjectDescription getSingleLocalElementByName(org.eclipse.xtext.naming.QualifiedName name)
      Overrides:
      getSingleLocalElementByName in class LightSimpleScope
    • isShadowed

      protected boolean isShadowed(org.eclipse.xtext.resource.IEObjectDescription fromParent)
      Description copied from class: LightAbstractScope
      Returns true if the given description input from the parent scope is shadowed by local elements.
      Overrides:
      isShadowed in class LightAbstractScope
      Returns:
      true if the given description input from the parent scope is shadowed by local elements.