package jetbrains.mps.lang.behavior.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 java.util.Collection; 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 jetbrains.mps.generator.template.TemplateVarContext; import jetbrains.mps.smodel.SReference; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.generator.template.IfMacroContext; import jetbrains.mps.generator.impl.reference.RefResolver; import jetbrains.mps.generator.runtime.TemplateUtil; import java.util.List; import java.util.ArrayList; import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext; import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext; import org.jetbrains.mps.openapi.model.SNodeAccessUtil; import jetbrains.mps.generator.template.PropertyMacroContext; 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_LocalBehaviorMethodCall extends TemplateDeclarationBase { public Template_reduce_LocalBehaviorMethodCall() { } public SNodeReference getTemplateNode() { return new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "4731970554580093575"); } protected Collection<SNode> applyPart0(@NotNull final TemplateContext context) throws GenerationException { final TemplateExecutionEnvironment environment = context.getEnvironment(); Collection<SNode> tlist1 = null; final Object varValue1 = QueriesGenerated.insertMacro_varValue_360045928603465626(new TemplateVarContext(context, varMacroRef_p4fqpg_b0a0a2a4)); TemplateContext context1 = context.withVariable("var:methodDeclaration", varValue1); final SNode tnode2 = environment.createOutputNode(myConcepts[0]); try { TemplateContext context2 = context1.subContext(); { final SNode tnode3 = environment.createOutputNode(myConcepts[1]); try { tnode3.setReference(myAssociationLinks[0], SReference.create(myAssociationLinks[0], tnode3, PersistenceFacade.getInstance().createModelReference("d936855b-48da-4812-a8a0-2bfddd633ac5/java:jetbrains.mps.core.aspects.behaviour.api(jetbrains.mps.lang.behavior.api/)"), PersistenceFacade.getInstance().createNodeId("~SMethod.invoke(org.jetbrains.mps.openapi.model.SNode,java.lang.Object...):java.lang.Object"))); TemplateContext context3 = context2.subContext(); { Collection<SNode> tlist4 = null; if (QueriesGenerated.ifMacro_Condition_6133874814783379358(new IfMacroContext(context3, ifMacroRef_p4fqpg_b0a0b0c0b0b0f0e))) { final SNode tnode5 = environment.createOutputNode(myConcepts[2]); try { environment.resolve(new RefResolver(tnode5, myAssociationLinks[1], context3, new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "8228699960984014811"), "thisNode") { @Override public Object resolve() { return QueriesGenerated.referenceMacro_GetReferent_8228699960984014812(createQueryContext()); } }); } finally { } tlist4 = TemplateUtil.singletonList(tnode5); } else { Collection<SNode> tlist6 = null; if (QueriesGenerated.ifMacro_Condition_7977232384686803991(new IfMacroContext(context3, ifMacroRef_p4fqpg_b0a0b0a1a2a1a1a5a4))) { final SNode tnode7 = environment.createOutputNode(myConcepts[2]); try { environment.resolve(new RefResolver(tnode7, myAssociationLinks[1], context3, new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "6862765979525357275"), "thisConcept") { @Override public Object resolve() { return QueriesGenerated.referenceMacro_GetReferent_6862765979525357276(createQueryContext()); } }); } finally { } tlist6 = TemplateUtil.singletonList(tnode7); } else { final SNode tnode8 = environment.createOutputNode(myConcepts[0]); try { TemplateContext context4 = context3.subContext(); { final SNode tnode9 = environment.createOutputNode(myConcepts[2]); try { environment.resolve(new RefResolver(tnode9, myAssociationLinks[1], context4, new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "7043879193973092537"), "thisNode") { @Override public Object resolve() { return QueriesGenerated.referenceMacro_GetReferent_7043879193973092538(createQueryContext()); } }); } finally { } tnode8.addChild(myAggregationLinks[0], tnode9); // TODO validate child } { final SNode tnode10 = environment.createOutputNode(myConcepts[1]); try { tnode10.setReference(myAssociationLinks[0], SReference.create(myAssociationLinks[0], tnode10, PersistenceFacade.getInstance().createModelReference("8865b7a8-5271-43d3-884c-6fd1d9cfdd34/java:org.jetbrains.mps.openapi.model(MPS.OpenAPI/)"), PersistenceFacade.getInstance().createNodeId("~SNode.getConcept():org.jetbrains.mps.openapi.language.SConcept"))); } finally { } tnode8.addChild(myAggregationLinks[1], tnode10); // TODO validate child } } finally { } tlist6 = TemplateUtil.singletonList(tnode8); } tlist4 = tlist6; } for (SNode child11 : TemplateUtil.asNotNull(tlist4)) { tnode3.addChild(myAggregationLinks[2], child11); } // TODO validate child } { final List<SNode> tlist12 = new ArrayList<SNode>(); final Iterable<SNode> loopList12 = QueriesGenerated.sourceNodesQuery_360045928603427127(new SourceSubstituteMacroNodesContext(context3, loopMacroRef_p4fqpg_b0a0a1a3a1a1a5a4)); int loopIndex_argCounter_12 = 0; for (SNode itnode12 : loopList12) { if (itnode12 == null) { continue; } TemplateContext context5 = context3.subContext(itnode12); context5 = context5.withVariable("cv:argCounter", loopIndex_argCounter_12++); Collection<SNode> tlist13 = null; if (QueriesGenerated.ifMacro_Condition_360045928603427134(new IfMacroContext(context5, ifMacroRef_p4fqpg_b0a0e0d0d0b0b0f0e))) { Collection<SNode> tlist14 = null; final SNode copySrcInput14 = QueriesGenerated.sourceNodeQuery_360045928603427268(new SourceSubstituteMacroNodeContext(context5, copySrcMacro_p4fqpg_b0a0c0e0d0d0b0b0f0e)); tlist14 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput14), copySrcMacro_p4fqpg_b0a0c0e0d0d0b0b0f0e, "tpl/r:229ce18d-2bb0-4d5b-a7cd-cec65841e459/360045928603427125", context5); tlist13 = tlist14; } else { final SNode tnode15 = environment.createOutputNode(myConcepts[3]); try { TemplateContext context6 = context5.subContext(); { final SNode tnode16 = environment.createOutputNode(myConcepts[4]); try { TemplateContext context7 = context6.subContext(); { Collection<SNode> tlist17 = null; final SNode copySrcInput17 = QueriesGenerated.sourceNodeQuery_360045928603427201(new SourceSubstituteMacroNodeContext(context7, copySrcMacro_p4fqpg_b0a0c0b0b0b0b0a4a3a3a1a1a5a4)); tlist17 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput17), copySrcMacro_p4fqpg_b0a0c0b0b0b0b0a4a3a3a1a1a5a4, "tpl/r:229ce18d-2bb0-4d5b-a7cd-cec65841e459/360045928603427199", context7); for (SNode child18 : TemplateUtil.asNotNull(tlist17)) { tnode16.addChild(myAggregationLinks[3], child18); } // TODO validate child } { Collection<SNode> tlist19 = null; final SNode copySrcInput19 = QueriesGenerated.sourceNodeQuery_360045928603427207(new SourceSubstituteMacroNodeContext(context7, copySrcMacro_p4fqpg_b0a0c0c0b0b0b0a4a3a3a1a1a5a4)); tlist19 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput19), copySrcMacro_p4fqpg_b0a0c0c0b0b0b0a4a3a3a1a1a5a4, "tpl/r:229ce18d-2bb0-4d5b-a7cd-cec65841e459/360045928603427205", context7); for (SNode child20 : TemplateUtil.asNotNull(tlist19)) { tnode16.addChild(myAggregationLinks[4], child20); } // TODO validate child } } finally { } tnode15.addChild(myAggregationLinks[5], tnode16); // TODO validate child } } finally { } tlist13 = TemplateUtil.singletonList(tnode15); } if (tlist13 != null) { tlist12.addAll(tlist13); } } for (SNode child21 : TemplateUtil.asNotNull(tlist12)) { tnode3.addChild(myAggregationLinks[2], child21); } // TODO validate child } } finally { } tnode2.addChild(myAggregationLinks[1], tnode3); // TODO validate child } { final SNode tnode22 = environment.createOutputNode(myConcepts[5]); try { SNodeAccessUtil.setProperty(tnode22, myProperties[0], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_8228699960986687947(new PropertyMacroContext(context2, "A_BehaviorDescriptor", propertyMacro_p4fqpg_c0a0c0a0b0c0f0e)))); SNodeAccessUtil.setProperty(tnode22, myProperties[1], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_8228699960986694365(new PropertyMacroContext(context2, "fooMethod", propertyMacro_p4fqpg_c0a0c0b0b0c0f0e)))); TemplateContext context8 = context2.subContext(); { final SNode tnode23 = environment.createOutputNode(myConcepts[6]); try { tnode23.setReference(myAssociationLinks[2], SReference.create(myAssociationLinks[2], tnode23, PersistenceFacade.getInstance().createModelReference("d936855b-48da-4812-a8a0-2bfddd633ac5/java:jetbrains.mps.core.aspects.behaviour.api(jetbrains.mps.lang.behavior.api/)"), PersistenceFacade.getInstance().createNodeId("~SMethod"))); TemplateContext context9 = context8.subContext(); { Collection<SNode> tlist24 = null; final SNode copySrcInput24 = QueriesGenerated.sourceNodeQuery_8228699960986672584(new SourceSubstituteMacroNodeContext(context9, copySrcMacro_p4fqpg_b0a0c0c0b0d0b0c0f0e)); tlist24 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput24), copySrcMacro_p4fqpg_b0a0c0c0b0d0b0c0f0e, "tpl/r:229ce18d-2bb0-4d5b-a7cd-cec65841e459/8228699960986646353", context9); for (SNode child25 : TemplateUtil.asNotNull(tlist24)) { tnode23.addChild(myAggregationLinks[6], child25); } // TODO validate child } } finally { } tnode22.addChild(myAggregationLinks[7], tnode23); // TODO validate child } } finally { } tnode2.addChild(myAggregationLinks[0], tnode22); // TODO validate child } } finally { } tlist1 = TemplateUtil.singletonList(tnode2); return tlist1; } @Override public Collection<SNode> apply(@NotNull TemplateExecutionEnvironment environment, @NotNull TemplateContext context) throws GenerationException { return applyPart0(context); } @Override public Collection<SNode> weave(@NotNull NodeWeaveFacility.WeaveContext weaveContext, @NotNull NodeWeaveFacility weaveSupport) throws GenerationException { final TemplateContext templateContext = weaveSupport.getTemplateContext(); Collection<SNode> tlistpart0 = applyPart0(templateContext); for (SNode nodeToWeave : TemplateUtil.asNotNull(tlistpart0)) { weaveSupport.weaveNode(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b213L, 0xf8cc56b214L, "expression"), nodeToWeave); } return tlistpart0; } @Override protected SConcept[] initConcepts() { SConcept[] rv = new SConcept[7]; rv[0] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x116b46a08c4L, "DotExpression"); rv[1] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x118154a6332L, "InstanceMethodCallOperation"); rv[2] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c77f1e98L, "VariableReference"); rv[3] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfb4ed32b7fL, "ParenthesizedExpression"); rv[4] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf940dabe4aL, "CastExpression"); rv[5] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, "jetbrains.mps.baseLanguageInternal"), 0x7232370459dfc310L, "InternalTypedStaticFieldReference"); rv[6] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x101de48bf9eL, "ClassifierType"); return rv; } @Override protected SProperty[] initProperties() { SProperty[] rv = new SProperty[2]; rv[0] = MetaAdapterFactory.getProperty(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x11157912ec1L, 0x1115794e9f1L, "fqClassName"); rv[1] = MetaAdapterFactory.getProperty(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x11157912ec1L, 0x11157952fb6L, "fieldName"); return rv; } @Override protected SReferenceLink[] initAssociationLinks() { SReferenceLink[] rv = new SReferenceLink[3]; rv[0] = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"); rv[1] = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c77f1e98L, 0xf8cc6bf960L, "variableDeclaration"); rv[2] = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"); return rv; } @Override protected SContainmentLink[] initAggregationLinks() { SContainmentLink[] rv = new SContainmentLink[8]; rv[0] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46a4416L, "operand"); rv[1] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"); rv[2] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"); rv[3] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940dabe4aL, 0xf940dabe4cL, "expression"); rv[4] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940dabe4aL, 0xf940dabe4bL, "type"); rv[5] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, 0xfb4ed32b80L, "expression"); rv[6] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x102419671abL, "parameter"); rv[7] = MetaAdapterFactory.getContainmentLink(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x7232370459dfc310L, 0x7232370459dfd7b6L, "returnType"); return rv; } private static SNodePointer varMacroRef_p4fqpg_b0a0a2a4 = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "360045928603465624"); private static SNodePointer ifMacroRef_p4fqpg_b0a0b0c0b0b0f0e = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "6133874814783379356"); private static SNodePointer ifMacroRef_p4fqpg_b0a0b0a1a2a1a1a5a4 = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "7977232384686803989"); private static SNodePointer loopMacroRef_p4fqpg_b0a0a1a3a1a1a5a4 = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "360045928603427126"); private static SNodePointer copySrcMacro_p4fqpg_b0a0c0e0d0d0b0b0f0e = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "360045928603427267"); private static SNodePointer ifMacroRef_p4fqpg_b0a0e0d0d0b0b0f0e = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "360045928603427133"); private static SNodePointer copySrcMacro_p4fqpg_b0a0c0b0b0b0b0a4a3a3a1a1a5a4 = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "360045928603427200"); private static SNodePointer copySrcMacro_p4fqpg_b0a0c0c0b0b0b0a4a3a3a1a1a5a4 = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "360045928603427206"); private static SNodePointer propertyMacro_p4fqpg_c0a0c0a0b0c0f0e = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "8228699960986687946"); private static SNodePointer propertyMacro_p4fqpg_c0a0c0b0b0c0f0e = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "8228699960986694364"); private static SNodePointer copySrcMacro_p4fqpg_b0a0c0c0b0d0b0c0f0e = new SNodePointer("r:229ce18d-2bb0-4d5b-a7cd-cec65841e459(jetbrains.mps.lang.behavior.generator.template.main@generator)", "8228699960986672583"); }