public abstract class AbstractScope extends java.lang.Object implements IScope
Base class for custom scope implementations. It supports nesting of scopes into each other, appropriate shadowing semantics and case sensitive and insensitive lookup.
Implementors have to provide getAllLocalElements()
. However, it is recommended
to customize getLocalElementsByEObject(EObject, URI)
and getLocalElementsByName(QualifiedName)
as well.
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractScope.ParentIterable
Lazy iterable with a reasonable
AbstractScope.ParentIterable.toString() implementation that supports
shadowing of parents elements by means of filtering. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractScope(IScope parent,
boolean ignoreCase)
Creates a new scope with a given parent.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<IEObjectDescription> |
getAllElements()
Obtain all elements from the scope.
|
protected abstract java.lang.Iterable<IEObjectDescription> |
getAllLocalElements() |
java.lang.Iterable<IEObjectDescription> |
getElements(org.eclipse.emf.ecore.EObject object)
Find all descriptions that match the given instance.
|
java.lang.Iterable<IEObjectDescription> |
getElements(QualifiedName name)
Find all descriptions that match the given name.
|
protected java.lang.Iterable<IEObjectDescription> |
getLocalElementsByEObject(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.common.util.URI uri) |
protected java.lang.Iterable<IEObjectDescription> |
getLocalElementsByName(QualifiedName name) |
IScope |
getParent() |
protected java.lang.Iterable<IEObjectDescription> |
getParentElements(com.google.inject.Provider<java.lang.Iterable<IEObjectDescription>> provider) |
IEObjectDescription |
getSingleElement(org.eclipse.emf.ecore.EObject object)
Find the first description that matches the given instance.
|
IEObjectDescription |
getSingleElement(QualifiedName name)
Find the first description that matches the given name.
|
protected IEObjectDescription |
getSingleLocalElementByName(QualifiedName name) |
boolean |
isIgnoreCase() |
protected boolean |
isShadowed(IEObjectDescription input)
Returns
true if the given description input from the parent scope is
shadowed by local elements. |
java.lang.String |
toString() |
public IScope getParent()
public boolean isIgnoreCase()
public IEObjectDescription getSingleElement(QualifiedName name)
IScope
getSingleElement
in interface IScope
name
- the name of the to-be-found element. May not be null
.name
. May be null
.protected IEObjectDescription getSingleLocalElementByName(QualifiedName name)
public java.lang.Iterable<IEObjectDescription> getAllElements()
IScope
UnsupportedOperationException
if the scope cannot be enumerated.getAllElements
in interface IScope
null
.public java.lang.Iterable<IEObjectDescription> getElements(QualifiedName name)
IScope
getElements
in interface IScope
name
- the name of the to-be-found elements. May not be null
.name
. Never null
.public IEObjectDescription getSingleElement(org.eclipse.emf.ecore.EObject object)
IScope
getSingleElement
in interface IScope
object
- the instance whose description should be obtained. May not be null
.instance
. May be null
.public java.lang.Iterable<IEObjectDescription> getElements(org.eclipse.emf.ecore.EObject object)
IScope
getElements
in interface IScope
object
- the instance whose descriptions should be obtained. May not be null
.instance
. Never null
.protected abstract java.lang.Iterable<IEObjectDescription> getAllLocalElements()
protected java.lang.Iterable<IEObjectDescription> getLocalElementsByName(QualifiedName name)
protected java.lang.Iterable<IEObjectDescription> getLocalElementsByEObject(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.common.util.URI uri)
protected java.lang.Iterable<IEObjectDescription> getParentElements(com.google.inject.Provider<java.lang.Iterable<IEObjectDescription>> provider)
protected boolean isShadowed(IEObjectDescription input)
true
if the given description input
from the parent scope is
shadowed by local elements.true
if the given description input
from the parent scope is
shadowed by local elements.public java.lang.String toString()
toString
in class java.lang.Object