Package jetbrains.mps.generator.impl
Class TransitionTrace
- java.lang.Object
 - 
- jetbrains.mps.generator.impl.TransitionTrace
 
 
- 
public final class TransitionTrace extends Object
Ensures we trace origin of node in a transient model, whether it's original input model or one of previous checkpoint steps. Keeps traces for each node in the model during transformation phase, and once the phase is over, this trace is used to populate label mappings information that will persist. Once mappings are ready, the trace is of no use and can be disposed (unless we decide to use it as a replacement forTracingUtiland navigation from transient models back to original one. ModelTransitions is the source of TransitionTrace, and keeps track of CP-CP transitions (similar to ModelCheckpoints->CheckpointState relation, just for the active transformation).TransitionTraceknows last checkpoint (if any), and doesn't know next one. Now it'sGenPlanActiveStepthat keeps track of the plan and actual position in there. Perhaps, that's not the most elegant approach. If a model M passes through a sequence of M1 -> CP1 -> M2 -> M3 -> CP2 -> M4, transition traces for the model are: TT(null), TT(CP1), TT(CP2). FIXME inputNode may not necessarily come from the input model, it might be arbitrary non-transient (or even perhaps checkpoint?!) model, thus saving nodeId is not sufficient. OTOH, don't want to save SNodeReference as it's superficial in most regular cases 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidderiveOrigin(SNode inputNode, SNode outputNode)Output node derives its origin from the given input node.voidderiveOrigin(SNode inputNode, TreeIterator<SNode> outputNodes)Initialize origin for a tree of nodes.ModelTransitionsgetModelTrace()SNodeIdgetOrigin(SNode node)booleanhasOrigin(SNode node) 
 - 
 
- 
- 
Method Detail
- 
getModelTrace
public ModelTransitions getModelTrace()
- Returns:
 - never 
null 
 
- 
deriveOrigin
public void deriveOrigin(@NotNull SNode inputNode, @NotNull SNode outputNode)
Output node derives its origin from the given input node. If output node already got an origin, it's preserved. If input node has no trace, output node gets none as well. No child of output node is processed. 
- 
deriveOrigin
public void deriveOrigin(@NotNull SNode inputNode, @NotNull TreeIterator<SNode> outputNodes)
Initialize origin for a tree of nodes. Output nodes get origin unless they already got one, in this case complete subtree is ignored (it's assumed the sub-tree already got origin assigned, no reason to override it) 
 - 
 
 -