Package jetbrains.mps.scope
Class Scope
- java.lang.Object
 - 
- jetbrains.mps.scope.Scope
 
 
- 
- Direct Known Subclasses:
 CompositeScope,ConceptAndSuperConceptsScope,DelegatingScope,EmptyScope,FilteringByNameScope,ListScope,ModelsScope,SimpleRoleScope
public abstract class Scope extends Object
 
- 
- 
Constructor Summary
Constructors Constructor Description Scope() 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancontains(SNode node)Returns true if this scope contains the specified element.abstract Iterable<SNode>getAvailableElements(String prefix)Returns all available elements in the scope.abstract StringgetReferenceText(SNode contextNode, SNode node)Creates textual reference for scope element.static ScopegetScope(SNode node, SContainmentLink link, int index, SAbstractConcept kind)Get scope for smart reference, when node doesn't exist yetstatic ScopegetScope(SNode node, SNode fromChild, SAbstractConcept kind)Get scope for existing node.static SNodeparent(SNode n)Scope-friendly traversal of an ancestor hierarchy with respect to attribute nodesabstract SNoderesolve(SNode contextNode, String refText)Resolves element by reference text. 
 - 
 
- 
- 
Method Detail
- 
getAvailableElements
public abstract Iterable<SNode> getAvailableElements(@Nullable String prefix)
Returns all available elements in the scope.- Parameters:
 prefix- (if not null) filters out elements whose reference text doesn't start with prefix- Returns:
 - list of nodes in the scope
 
 
- 
contains
public boolean contains(SNode node)
Returns true if this scope contains the specified element. Invariant: contains(node) == getAvailableElements(null).contains(node)- Parameters:
 node- element to check presence for- Returns:
 - true if this scope contains the specified element
 
 
- 
resolve
@Nullable public abstract SNode resolve(SNode contextNode, @NotNull String refText)
Resolves element by reference text. Invariant: getReferenceText(contextNode, resolve(contextNode, refText)) == refText- Parameters:
 contextNode- source node for the reference, or its nearest parent node (if source node is unavailable)refText- reference text- Returns:
 - resolved element when reference text unambiguously identifies element, null otherwise
 
 
- 
getReferenceText
@Nullable public abstract String getReferenceText(SNode contextNode, @NotNull SNode node)
Creates textual reference for scope element. If element has no textual representation for the reference, returns null. Invariant: resolve(contextNode, getReferenceText(contextNode, node)) == node- Parameters:
 contextNode- source node for the reference, or its nearest parent node (if source node is unavailable)node- element from the current scope (contains(node) == true)- Returns:
 - reference text for the node element in the current scope
 
 
- 
getScope
public static Scope getScope(SNode node, SNode fromChild, SAbstractConcept kind)
Get scope for existing node. 
- 
getScope
public static Scope getScope(SNode node, SContainmentLink link, int index, SAbstractConcept kind)
Get scope for smart reference, when node doesn't exist yet 
 - 
 
 -