Class RegularPlanBuilder
- java.lang.Object
 - 
- jetbrains.mps.generator.impl.plan.RegularPlanBuilder
 
 
- 
- All Implemented Interfaces:
 GenerationPlanBuilder
public class RegularPlanBuilder extends Object implements GenerationPlanBuilder
XXX Now, I don't like the idea both plan builder and its client (GenPlanTranslator) need runtime information about deployed modules. I shall restrict API of this class to identity of generators/languages/MCs. Then, both present interpreted and future generated plan translation code could be simple and straightforward, without a need to figure out particular TemplateModule from a runtime registry it hardly has access to. XXX myEngagedGenerators are in use only during wrapUp. Perhaps, shall pass them at this moment, rather than at construction time? Though I hate the name as it doesn't tell anything, it's a plan builder for regular use, targeted for everyday scenarios like model make in IDE. Name alternatives are ScopedPlanBuilder, RestrictExtendsPB and others of the same degree of imperfection. Likely, we'll need different approaches to extension processing, and the name shall reflect the approach, but at the moment I can't come up with a better one. Supports all operations. IMPORTANT: Treats extensions to generators on a 'first come, first served basis'. Tries to consume as many extensions as possible for the first statement that calls for extensions. Extensions are looked up among generators denoted as 'engaged'. If generatorB extends generatorA, and there's 'apply with extensions generatorA', then generatorB would get into final transformation sequence only when it's listed among 'engaged' generators supplied at the builder's construction time. Note, this implementation use these generators to limit 'upper' boundary only, in the aforementioned example it doesn't matter whether list of 'engaged' includes generatorA, which gets into transformation sequence regardless of 'engaged' generators. Perhaps, this has to be changed (and ScopedPB would be more appropriate name then)- Since:
 - 2017.1
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface jetbrains.mps.generator.GenerationPlanBuilder
GenerationPlanBuilder.BuilderOption 
 - 
 
- 
Constructor Summary
Constructors Constructor Description RegularPlanBuilder(LanguageRegistry languageRegistry, Collection<TemplateModule> allEngagedGenerators)RegularPlanBuilder(LanguageRegistry languageRegistry, Collection<TemplateModule> allEngagedGenerators, IMessageHandler messageHandler) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(Collection<TemplateMappingConfiguration> tmc)IMPORTANT: USE OF THIS METHOD IS DISCOURAGED AS IT AFFECTS CONSISTENCY OF PLAN SPECIFICATION (namely, if applyGeneratorWithExtended() shall consider generators of explicit MCs for extensions).voidapplyGenerator(SModule... generators)Specified generators (exact set, unlikeGenerationPlanBuilder.applyGeneratorWithExtended(SModule...)no extended relation between generators is taken into account) applied as a single transformation step.voidapplyGenerators(Collection<SModuleReference> generators, GenerationPlanBuilder.BuilderOption... options)New approach to plan builder.voidapplyGeneratorWithExtended(SModule... generator)Specified generators and those extending them AND visible from scope applied as a single transformation step.GenerationPlanBuilderfork()Support for parallel branches of transformationsprotected List<jetbrains.mps.generator.impl.plan.RegularPlanBuilder.StepEntry>getEntries()voidrecordCheckpoint(CheckpointIdentity cp)Tells generator to record state of transformed model at the given moment and keep it with supplied identity.voidsynchronizeWithCheckpoint(CheckpointIdentity cp)Tells generator to synchronize references with a recorded model state, identified by supplied checkpoint.voidtransformLanguage(SLanguage... languages)Apply generators of languages specified to reduce their concepts.ModelGenerationPlanwrapUp(PlanIdentity planIdentity)CompletesModelGenerationPlaninstance with any state information build is aware of (e.g.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface jetbrains.mps.generator.GenerationPlanBuilder
declareCheckpoint 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
RegularPlanBuilder
public RegularPlanBuilder(@NotNull LanguageRegistry languageRegistry, Collection<TemplateModule> allEngagedGenerators)
 
- 
RegularPlanBuilder
public RegularPlanBuilder(@NotNull LanguageRegistry languageRegistry, Collection<TemplateModule> allEngagedGenerators, @Nullable IMessageHandler messageHandler)
 
 - 
 
- 
Method Detail
- 
transformLanguage
public void transformLanguage(@NotNull SLanguage... languages)
Description copied from interface:GenerationPlanBuilderApply generators of languages specified to reduce their concepts. FIXME It's unspecified at the moment what happens with generators that are extended or referenced from those involved (i.e. if they are part of the step).- Specified by:
 transformLanguagein interfaceGenerationPlanBuilder- Parameters:
 languages- languages to reduce
 
- 
applyGenerator
public void applyGenerator(@NotNull SModule... generators)
Description copied from interface:GenerationPlanBuilderSpecified generators (exact set, unlikeGenerationPlanBuilder.applyGeneratorWithExtended(SModule...)no extended relation between generators is taken into account) applied as a single transformation step. FIXME shall decide what happens if a generator references/extends another one, not mentioned.- Specified by:
 applyGeneratorin interfaceGenerationPlanBuilder- Parameters:
 generators- generator modules
 
- 
applyGeneratorWithExtended
public void applyGeneratorWithExtended(@NotNull SModule... generator)
Description copied from interface:GenerationPlanBuilderSpecified generators and those extending them AND visible from scope applied as a single transformation step. What constitutes this 'scope' is up to plan builder implementation. To respect generator priority rules of involved generators to address extensibility scenarios like that of lang.editor, considerGenerationPlanBuilder.applyGenerators(Collection, BuilderOption...)withGenerationPlanBuilder.BuilderOption.WithPriorityRulesandGenerationPlanBuilder.BuilderOption.WithExtendedGenerators.- Specified by:
 applyGeneratorWithExtendedin interfaceGenerationPlanBuilder- Parameters:
 generator- generator modules
 
- 
applyGenerators
public void applyGenerators(@NotNull Collection<SModuleReference> generators, @NotNull GenerationPlanBuilder.BuilderOption... options)
Description copied from interface:GenerationPlanBuilderNew approach to plan builder. As there's SLanguage for deployed language, there's SModuleReference to identify deployed generator, why would I need to get a module then?- Specified by:
 applyGeneratorsin interfaceGenerationPlanBuilder- Parameters:
 generators- deployed generator identities for the stepoptions- optional set of options to further specify processing ofgeneratorsset
 
- 
apply
public void apply(@NotNull Collection<TemplateMappingConfiguration> tmc)
Description copied from interface:GenerationPlanBuilderIMPORTANT: USE OF THIS METHOD IS DISCOURAGED AS IT AFFECTS CONSISTENCY OF PLAN SPECIFICATION (namely, if applyGeneratorWithExtended() shall consider generators of explicit MCs for extensions). IT'S INTENDED FOR PROTOTYPE AND MIGHT CEASE ONCE PROVISION PHASE IS OVER. USE AT YOUR OWN RISK. Specific MCs for a transformation step, applied together.- Specified by:
 applyin interfaceGenerationPlanBuilder- Parameters:
 tmc- MCs that constitute transformation step
 
- 
recordCheckpoint
public void recordCheckpoint(@NotNull CheckpointIdentity cp)
Description copied from interface:GenerationPlanBuilderTells generator to record state of transformed model at the given moment and keep it with supplied identity. Besides, also tells generator to synchronize external references with models of the specified checkpoint.- Specified by:
 recordCheckpointin interfaceGenerationPlanBuilder- Parameters:
 cp- checkpoint identity
 
- 
synchronizeWithCheckpoint
public void synchronizeWithCheckpoint(@NotNull CheckpointIdentity cp)
Description copied from interface:GenerationPlanBuilderTells generator to synchronize references with a recorded model state, identified by supplied checkpoint. State of the actual model being transformed is not recorded.- Specified by:
 synchronizeWithCheckpointin interfaceGenerationPlanBuilder- Parameters:
 cp- checkpoint identity
 
- 
wrapUp
@NotNull public ModelGenerationPlan wrapUp(@NotNull PlanIdentity planIdentity)
Description copied from interface:GenerationPlanBuilderCompletesModelGenerationPlaninstance with any state information build is aware of (e.g. build extends relation between generators foror respect priority rules of generators involved- Specified by:
 wrapUpin interfaceGenerationPlanBuilder- Parameters:
 planIdentity- identity of the plan to build- Returns:
 - plan instance ready to use
 
 
- 
fork
public GenerationPlanBuilder fork()
Description copied from interface:GenerationPlanBuilderSupport for parallel branches of transformations- Specified by:
 forkin interfaceGenerationPlanBuilder- Returns:
 - builder instance to handle separate branch of transformations
 
 
- 
getEntries
protected final List<jetbrains.mps.generator.impl.plan.RegularPlanBuilder.StepEntry> getEntries()
 
 - 
 
 -