package jetbrains.mps.samples.Kaja.generator.template.main; /*Generated by MPS */ import jetbrains.mps.generator.runtime.Generated; import jetbrains.mps.generator.runtime.TemplateDeclarationBase; import org.jetbrains.mps.openapi.model.SNodeReference; import jetbrains.mps.smodel.SNodePointer; import org.jetbrains.mps.openapi.model.SNode; import org.jetbrains.annotations.NotNull; import jetbrains.mps.generator.runtime.TemplateContext; import jetbrains.mps.generator.runtime.GenerationException; import jetbrains.mps.generator.runtime.TemplateExecutionEnvironment; import org.jetbrains.mps.openapi.model.SNodeAccessUtil; import jetbrains.mps.generator.runtime.TemplateUtil; import jetbrains.mps.generator.template.PropertyMacroContext; import java.util.Collection; import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext; import jetbrains.mps.generator.runtime.NodeWeaveFacility; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.language.SConcept; import org.jetbrains.mps.openapi.language.SProperty; import org.jetbrains.mps.openapi.language.SReferenceLink; import org.jetbrains.mps.openapi.language.SContainmentLink; @Generated public class Template_reduce_Repeat extends TemplateDeclarationBase { public Template_reduce_Repeat() { } public SNodeReference getTemplateNode() { return new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "3308300503039660392"); } protected SNode applyPart0(@NotNull final TemplateContext context) throws GenerationException { final TemplateExecutionEnvironment environment = context.getEnvironment(); final SNode tnode1 = environment.createOutputNode(myConcepts[0]); try { TemplateContext context1 = context.subContext(); { final SNode tnode2 = environment.createOutputNode(myConcepts[1]); try { environment.nodeCopied(context1, tnode2, "tpl/r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185/3308300503039660399"); SNodeAccessUtil.setProperty(tnode2, myProperties[0], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_859008965969411038(new PropertyMacroContext(context1, "i", propertyMacro_9c7i7b_c0a0c0b0b0b0c0e)))); TemplateContext context2 = context1.subContext(); { final SNode tnode3 = environment.createOutputNode(myConcepts[2]); try { } finally { } tnode2.addChild(myAggregationLinks[0], tnode3); // TODO validate child } { final SNode tnode4 = environment.createOutputNode(myConcepts[3]); try { SNodeAccessUtil.setProperty(tnode4, myProperties[1], "0"); } finally { } tnode2.addChild(myAggregationLinks[1], tnode4); // TODO validate child } } finally { } tnode1.addChild(myAggregationLinks[2], tnode2); // TODO validate child } { final SNode tnode5 = environment.createOutputNode(myConcepts[4]); try { TemplateContext context3 = context1.subContext(); { Collection<SNode> tlist6 = null; final SNode copySrcInput6 = QueriesGenerated.sourceNodeQuery_3308300503039939727(new SourceSubstituteMacroNodeContext(context3, copySrcMacro_9c7i7b_b0a0c0b0b0c0c0e)); tlist6 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput6), copySrcMacro_9c7i7b_b0a0c0b0b0c0c0e, "tpl/r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185/3308300503039939717", context3); for (SNode child7 : TemplateUtil.asNotNull(tlist6)) { tnode5.addChild(myAggregationLinks[3], child7); } // TODO validate child } } finally { } tnode1.addChild(myAggregationLinks[4], tnode5); // TODO validate child } { final SNode tnode8 = environment.createOutputNode(myConcepts[5]); try { TemplateContext context4 = context1.subContext(); { final SNode tnode9 = environment.createOutputNode(myConcepts[3]); try { SNodeAccessUtil.setProperty(tnode9, myProperties[1], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_3308300503039660463(new PropertyMacroContext(context4, "10", propertyMacro_9c7i7b_c0a0c0a0b0b0b0d0c0e)))); } finally { } tnode8.addChild(myAggregationLinks[5], tnode9); // TODO validate child } { final SNode tnode10 = environment.createOutputNode(myConcepts[6]); try { environment.resolveInTemplateLater(tnode10, myAssociationLinks[0], templateNode_9c7i7b_c0a0a1a2a1a3a2a4, "tpl/r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185/3308300503039660399", "i", context4); } finally { } tnode8.addChild(myAggregationLinks[6], tnode10); // TODO validate child } } finally { } tnode1.addChild(myAggregationLinks[7], tnode8); // TODO validate child } { final SNode tnode11 = environment.createOutputNode(myConcepts[7]); try { TemplateContext context5 = context1.subContext(); { final SNode tnode12 = environment.createOutputNode(myConcepts[6]); try { environment.resolveInTemplateLater(tnode12, myAssociationLinks[0], templateNode_9c7i7b_c0a0a1a1a1a4a2a4, "tpl/r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185/3308300503039660399", "i", context5); } finally { } tnode11.addChild(myAggregationLinks[8], tnode12); // TODO validate child } } finally { } tnode1.addChild(myAggregationLinks[9], tnode11); // TODO validate child } } finally { } return tnode1; } @Override public Collection<SNode> apply(@NotNull TemplateExecutionEnvironment environment, @NotNull TemplateContext context) throws GenerationException { return TemplateUtil.singletonList(applyPart0(context)); } @Override public Collection<SNode> weave(@NotNull NodeWeaveFacility.WeaveContext weaveContext, @NotNull NodeWeaveFacility weaveSupport) throws GenerationException { final TemplateContext templateContext = weaveSupport.getTemplateContext(); SNode tnodepart0 = applyPart0(templateContext); weaveSupport.weaveNode(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement"), tnodepart0); return TemplateUtil.singletonList(tnodepart0); } @Override protected SConcept[] initConcepts() { SConcept[] rv = new SConcept[8]; rv[0] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x10a698082feL, "ForStatement"); rv[1] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc67c7efL, "LocalVariableDeclaration"); rv[2] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf940d22479L, "IntegerType"); rv[3] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc59b314L, "IntegerConstant"); rv[4] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc56b200L, "StatementList"); rv[5] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbced3b82aL, "LessThanExpression"); rv[6] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c77f1e98L, "VariableReference"); rv[7] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x11adecdb4f0L, "PostfixIncrementExpression"); return rv; } @Override protected SProperty[] initProperties() { SProperty[] rv = new SProperty[2]; rv[0] = MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"); rv[1] = MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"); return rv; } @Override protected SReferenceLink[] initAssociationLinks() { SReferenceLink[] rv = new SReferenceLink[1]; rv[0] = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c77f1e98L, 0xf8cc6bf960L, "variableDeclaration"); return rv; } @Override protected SContainmentLink[] initAggregationLinks() { SContainmentLink[] rv = new SContainmentLink[10]; rv[0] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"); rv[1] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"); rv[2] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a697996feL, 0x10a6979f36bL, "variable"); rv[3] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement"); rv[4] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body"); rv[5] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"); rv[6] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"); rv[7] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a69819132L, "condition"); rv[8] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x120a4c1f269L, 0x120a4c433a6L, "expression"); rv[9] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a6981b2c5L, "iteration"); return rv; } private static SNodePointer propertyMacro_9c7i7b_c0a0c0b0b0b0c0e = new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "859008965969411037"); private static SNodePointer copySrcMacro_9c7i7b_b0a0c0b0b0c0c0e = new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "3308300503039939724"); private static SNodePointer propertyMacro_9c7i7b_c0a0c0a0b0b0b0d0c0e = new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "3308300503039660460"); private static SNodePointer templateNode_9c7i7b_c0a0a1a2a1a3a2a4 = new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "4265636116363070570"); private static SNodePointer templateNode_9c7i7b_c0a0a1a1a1a4a2a4 = new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "4265636116363077196"); }