org.eclipse.ocl.examples.xtext.base.scope
Class EnvironmentView

java.lang.Object
  extended by org.eclipse.ocl.examples.xtext.base.scope.EnvironmentView

public class EnvironmentView
extends java.lang.Object

An EnvironmentView provides a selective view of the environment visible at some CST node. The selection corresponds to an Environment lookup method as defined by the OCL specification computed in accordance with the the Inherited Attributes. The selective view is normally for just the single name required by the lookUp, but may be for all names when a Completion Assist is required. The EnvironmentView is computed on demand, rather than cached, since only small parts of the overall environment are needed and caches may not remain valid for long given the rapid recreation of CST nodes that occurs while editing.


Nested Class Summary
static interface EnvironmentView.Filter
           
 
Field Summary
protected  java.lang.String name
           
protected  org.eclipse.emf.ecore.EStructuralFeature reference
           
protected  TypeManager typeManager
           
 
Constructor Summary
EnvironmentView(TypeManager typeManager, org.eclipse.emf.ecore.EStructuralFeature reference, java.lang.String name)
           
 
Method Summary
 boolean accepts(org.eclipse.emf.ecore.EClass eClass)
           
 int addElement(java.lang.String elementName, org.eclipse.emf.ecore.EObject element)
          Add an element with an elementName to the view
 int addElement(java.lang.String elementName, Type forType, org.eclipse.emf.ecore.EObject element)
           
 int addElements(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)
           
 int addElements(Type forType, java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)
           
 void addElementsOfScope(Element element, ScopeView scopeView)
           
 void addElementsOfScope(ModelElementCS csElement, ScopeView scopeView)
           
 void addFilter(EnvironmentView.Filter filter)
           
 void addLibContents(Type libType, ScopeView scopeView)
           
 int addNamedElement(Nameable namedElement)
           
 int addNamedElement(Type forType, Nameable namedElement)
           
 int addNamedElements(java.lang.Iterable<? extends Nameable> namedElements)
           
 int addNamedElements(Type forType, java.lang.Iterable<? extends Nameable> namedElements)
           
 int computeLookups(ScopeView aScope)
           
 int computeLookups(Type type)
           
 org.eclipse.emf.ecore.EObject getContent()
           
 org.eclipse.xtext.resource.IEObjectDescription getDescription()
           
 java.util.List<org.eclipse.xtext.resource.IEObjectDescription> getDescriptions()
           
 java.lang.String getName()
           
 org.eclipse.emf.ecore.EStructuralFeature getReference()
           
 org.eclipse.emf.ecore.EClassifier getRequiredType()
           
 org.eclipse.emf.ecore.EObject getResolvedContent()
           
 int getSize()
           
 TypeManager getTypeManager()
           
 boolean hasFinalResult()
          Return true once the EnvironmentView has accumulated sufficient results to satisfy the lookup criterion for which it was created.
 void removeFilter(EnvironmentView.Filter filter)
           
 int resolveDuplicates()
           
 void setBindings(org.eclipse.emf.ecore.EObject eObject, java.util.Map<TemplateParameter,ParameterableElement> bindings)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

typeManager

protected final TypeManager typeManager

reference

protected final org.eclipse.emf.ecore.EStructuralFeature reference

name

protected final java.lang.String name
Constructor Detail

EnvironmentView

public EnvironmentView(TypeManager typeManager,
                       org.eclipse.emf.ecore.EStructuralFeature reference,
                       java.lang.String name)
Method Detail

accepts

public boolean accepts(org.eclipse.emf.ecore.EClass eClass)

addElement

public int addElement(java.lang.String elementName,
                      org.eclipse.emf.ecore.EObject element)
Add an element with an elementName to the view

Parameters:
elementName - name of element
element - the element
Returns:
the number of elements added; 1 if added, 0 if not

addElement

public int addElement(java.lang.String elementName,
                      Type forType,
                      org.eclipse.emf.ecore.EObject element)

addElements

public int addElements(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)

addElements

public int addElements(Type forType,
                       java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)

addElementsOfScope

public void addElementsOfScope(Element element,
                               ScopeView scopeView)

addElementsOfScope

public void addElementsOfScope(ModelElementCS csElement,
                               ScopeView scopeView)

addFilter

public void addFilter(EnvironmentView.Filter filter)

addLibContents

public void addLibContents(Type libType,
                           ScopeView scopeView)

addNamedElement

public int addNamedElement(Nameable namedElement)

addNamedElement

public int addNamedElement(Type forType,
                           Nameable namedElement)

addNamedElements

public int addNamedElements(java.lang.Iterable<? extends Nameable> namedElements)

addNamedElements

public int addNamedElements(Type forType,
                            java.lang.Iterable<? extends Nameable> namedElements)

computeLookups

public int computeLookups(Type type)

computeLookups

public int computeLookups(ScopeView aScope)

getContent

public org.eclipse.emf.ecore.EObject getContent()

getDescription

public org.eclipse.xtext.resource.IEObjectDescription getDescription()

getDescriptions

public java.util.List<org.eclipse.xtext.resource.IEObjectDescription> getDescriptions()

getName

public java.lang.String getName()

getReference

public org.eclipse.emf.ecore.EStructuralFeature getReference()

getRequiredType

public org.eclipse.emf.ecore.EClassifier getRequiredType()

getResolvedContent

public org.eclipse.emf.ecore.EObject getResolvedContent()

getSize

public int getSize()

getTypeManager

public TypeManager getTypeManager()

hasFinalResult

public boolean hasFinalResult()
Return true once the EnvironmentView has accumulated sufficient results to satisfy the lookup criterion for which it was created. i.e. any result for a non-null name, all results for a null name.


removeFilter

public void removeFilter(EnvironmentView.Filter filter)

resolveDuplicates

public int resolveDuplicates()

setBindings

public void setBindings(org.eclipse.emf.ecore.EObject eObject,
                        java.util.Map<TemplateParameter,ParameterableElement> bindings)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object