Package jetbrains.mps.generator.template
Class TemplateQueryContext
- java.lang.Object
 - 
- jetbrains.mps.generator.template.TemplateQueryContext
 
 
- 
- Direct Known Subclasses:
 IfMacroContext,InsertMacroContext,MappingScriptContext,MapSrcMacroContext,MapSrcMacroPostProcContext,PropertyMacroContext,ReferenceMacroContext,SourceSubstituteMacroNodeContext,SourceSubstituteMacroNodesContext,TemplateArgumentContext,TemplateQueryContextWithRule,TemplateVarContext,WeavingAnchorContext
public class TemplateQueryContext extends Object
Context for operations of genContext parameter in generator's concept functions. This is what generated code of template queries (like input nodes query, property and reference macro, etc) have access to. Igor Alshannikov Jul 21, 2008 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected TemplateContextmyContext 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedTemplateQueryContext()Cons for internal/tests use, generally subclasses shall not call it.protectedTemplateQueryContext(SNodeReference templateNode, TemplateContext context)TemplateQueryContext(SNodeReference templateNode, ITemplateGenerator generator)Context for queries when an input node is not known yet (queries of an MC or a script). 
- 
Method Summary
 
 - 
 
- 
- 
Field Detail
- 
myContext
protected TemplateContext myContext
 
 - 
 
- 
Constructor Detail
- 
TemplateQueryContext
public TemplateQueryContext(@NotNull SNodeReference templateNode, @NotNull ITemplateGenerator generator)
Context for queries when an input node is not known yet (queries of an MC or a script).- Since:
 - 3.3
 
 
- 
TemplateQueryContext
protected TemplateQueryContext(@NotNull SNodeReference templateNode, @NotNull TemplateContext context)
 
- 
TemplateQueryContext
protected TemplateQueryContext()
Cons for internal/tests use, generally subclasses shall not call it. 
 - 
 
- 
Method Detail
- 
getNode
public SNode getNode()
'node' mapping 
- 
getInputNode
public SNode getInputNode()
 
- 
getOutputNode
public SNode getOutputNode()
 
- 
getInputModel
public SModel getInputModel()
 
- 
getOutputModel
public SModel getOutputModel()
 
- 
getOriginalInputModel
public SModel getOriginalInputModel()
 
- 
getGenerator
public ITemplateGenerator getGenerator()
'generator' mapping 
- 
getOutputNodeByMappingLabel
@Nullable public SNode getOutputNodeByMappingLabel(String label, @Nullable SModel inputModel)
Find out conditional root with a given ML, created from specified model- Parameters:
 label- generally shall not be null, as it's required in GenerationContextOp_GetOutputByLabelinputModel- can be null, which indicates current input model. Otherwise, a model root was created from- Returns:
 - a node in a transient/checkpoint model if generator has any recorded.
 - Since:
 - 3.4
 
 
- 
getOutputNodeByInputNodeAndMappingLabel
public SNode getOutputNodeByInputNodeAndMappingLabel(SNode inputNode, String label)
 
- 
getAllOutputNodesByInputNodeAndMappingLabel
public List<SNode> getAllOutputNodesByInputNodeAndMappingLabel(SNode inputNode, String label)
 
- 
registerMappingLabel
public void registerMappingLabel(SNode inputNode, String mappingName, SNode outputNode)
 
- 
createUniqueName
public String createUniqueName(String baseName, SNode contextNode)
- Parameters:
 baseName- prefixcontextNode- optional extra context node. Contributes (if a named node) a name fragment to further distinguish names, holds used names (IOW, defines name visibility context). If nocontextNodeis specified, scope is global.- Returns:
 - value 
baseName[_hash(contextNode)][_hash(getInputNode())][_counter] 
 
- 
createIndexedName
public String createIndexedName(String baseName, SNode contextNode, boolean noIndexForFirst)
- Parameters:
 baseName- prefix the name sequence would sharecontextNode- optional context node to keep last used index forbaseName.nullmeans global (i.e. session) context.noIndexForFirst- iftrue, the first value returned would be "baseName", second "baseName1", etc. Whenfalse, all names would get index, starting from 0.- Returns:
 baseName[counter]
 
- 
getTemplateReference
@Nullable public final SNodeReference getTemplateReference()
- Returns:
 - context template node where the query is evaluated, if known.
 
 
- 
getTemplateNodeRef
@Nullable protected SNodeReference getTemplateNodeRef()
- Returns:
 - context template node where the query is evaluated
 
 
- 
getRuleNode
@Nullable protected SNodeReference getRuleNode()
- Returns:
 - context rule, where query is being evaluated, if available
 
 
 - 
 
 -