package jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main;
/*Generated by MPS */
import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.runtime.TemplateDeclarationBase;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.mps.openapi.model.SNodeReference;
import jetbrains.mps.smodel.SNodePointer;
import java.util.Map;
import jetbrains.mps.internal.collections.runtime.MapSequence;
import java.util.HashMap;
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_processStatement extends TemplateDeclarationBase {
private String myName;
private String myName2;
private SNode myExpr;
private int myI;
private boolean myB;
public Template_processStatement(String name, String name2, SNode expr, int i, boolean b) {
this.myName = name;
this.myName2 = name2;
this.myExpr = expr;
this.myI = i;
this.myB = b;
}
public SNodeReference getTemplateNode() {
return new SNodePointer("r:00000000-0000-4000-0000-011c89590606(jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main@generator)", "2681305894288695007");
}
private Map<String, Object> getParametersAsMap() {
Map<String, Object> result = MapSequence.fromMap(new HashMap<String, Object>());
MapSequence.fromMap(result).put("name", myName);
MapSequence.fromMap(result).put("name2", myName2);
MapSequence.fromMap(result).put("expr", myExpr);
MapSequence.fromMap(result).put("i", myI);
MapSequence.fromMap(result).put("b", myB);
return result;
}
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 {
TemplateContext context2 = context1.subContext();
{
final SNode tnode3 = environment.createOutputNode(myConcepts[2]);
try {
TemplateContext context3 = context2.subContext();
{
final SNode tnode4 = environment.createOutputNode(myConcepts[3]);
try {
SNodeAccessUtil.setProperty(tnode4, myProperties[0], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_2681305894288695070(new PropertyMacroContext(context3, "aa", propertyMacro_iblz6q_c0a0c0a0b0b0b0b0b0b0c0k))));
} finally {
}
tnode3.addChild(myAggregationLinks[0], tnode4);
// TODO validate child
}
{
final SNode tnode5 = environment.createOutputNode(myConcepts[3]);
try {
SNodeAccessUtil.setProperty(tnode5, myProperties[0], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_2163819695913280744(new PropertyMacroContext(context3, "ss", propertyMacro_iblz6q_c0a0c0a0b0c0b0b0b0b0c0k))));
} finally {
}
tnode3.addChild(myAggregationLinks[0], tnode5);
// TODO validate child
}
} finally {
}
tnode2.addChild(myAggregationLinks[1], tnode3);
// TODO validate child
}
{
final SNode tnode6 = environment.createOutputNode(myConcepts[4]);
try {
TemplateContext context4 = context2.subContext();
{
final SNode tnode7 = environment.createOutputNode(myConcepts[5]);
try {
SNodeAccessUtil.setProperty(tnode7, myProperties[1], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_2681305894288695040(new PropertyMacroContext(context4, "nvar", propertyMacro_iblz6q_c0a0c0a0b0b0b0c0b0b0c0k))));
TemplateContext context5 = context4.subContext();
{
final SNode tnode8 = environment.createOutputNode(myConcepts[6]);
try {
} finally {
}
tnode7.addChild(myAggregationLinks[2], tnode8);
// TODO validate child
}
{
Collection<SNode> tlist9 = null;
final SNode copySrcInput9 = QueriesGenerated.sourceNodeQuery_2681305894288695056(new SourceSubstituteMacroNodeContext(context5, copySrcMacro_iblz6q_b0a0c0d0b0b0b0c0b0b0c0k));
tlist9 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput9), copySrcMacro_iblz6q_b0a0c0d0b0b0b0c0b0b0c0k, "tpl/r:00000000-0000-4000-0000-011c89590606/2681305894288695053", context5);
for (SNode child10 : TemplateUtil.asNotNull(tlist9)) {
tnode7.addChild(myAggregationLinks[3], child10);
}
// TODO validate child
}
} finally {
}
tnode6.addChild(myAggregationLinks[4], tnode7);
// TODO validate child
}
} finally {
}
tnode2.addChild(myAggregationLinks[1], tnode6);
// TODO validate child
}
} finally {
}
tnode1.addChild(myAggregationLinks[5], tnode2);
// TODO validate child
}
} finally {
}
return tnode1;
}
protected SNode applyPart1(@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 {
TemplateContext context2 = context1.subContext();
{
final SNode tnode3 = environment.createOutputNode(myConcepts[4]);
try {
TemplateContext context3 = context2.subContext();
{
final SNode tnode4 = environment.createOutputNode(myConcepts[5]);
try {
environment.nodeCopied(context3, tnode4, "tpl/r:00000000-0000-4000-0000-011c89590606/3392060900980649133");
SNodeAccessUtil.setProperty(tnode4, myProperties[1], "e");
TemplateContext context4 = context3.subContext();
{
final SNode tnode5 = environment.createOutputNode(myConcepts[6]);
try {
} finally {
}
tnode4.addChild(myAggregationLinks[2], tnode5);
// TODO validate child
}
} finally {
}
tnode3.addChild(myAggregationLinks[4], tnode4);
// TODO validate child
}
} finally {
}
tnode2.addChild(myAggregationLinks[1], tnode3);
// TODO validate child
}
{
final SNode tnode6 = environment.createOutputNode(myConcepts[7]);
try {
TemplateContext context5 = context2.subContext();
{
final SNode tnode7 = environment.createOutputNode(myConcepts[8]);
try {
TemplateContext context6 = context5.subContext();
{
final SNode tnode8 = environment.createOutputNode(myConcepts[9]);
try {
environment.resolveInTemplateLater(tnode8, myAssociationLinks[0], templateNode_iblz6q_c0a0a1a1a1a1a1a2a1a1a2a11, "tpl/r:00000000-0000-4000-0000-011c89590606/3392060900980649133", "e", context6);
} finally {
}
tnode7.addChild(myAggregationLinks[6], tnode8);
// TODO validate child
}
{
final SNode tnode9 = environment.createOutputNode(myConcepts[10]);
try {
SNodeAccessUtil.setProperty(tnode9, myProperties[2], "5");
} finally {
}
tnode7.addChild(myAggregationLinks[7], tnode9);
// TODO validate child
}
} finally {
}
tnode6.addChild(myAggregationLinks[8], tnode7);
// TODO validate child
}
} finally {
}
tnode2.addChild(myAggregationLinks[1], tnode6);
// TODO validate child
}
} finally {
}
tnode1.addChild(myAggregationLinks[5], tnode2);
// TODO validate child
}
} finally {
}
return tnode1;
}
protected Collection<SNode> applyPart2(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
Collection<SNode> tlist1 = null;
tlist1 = new Template_aaaaa(((SNode) context.getVariable("expr"))).apply(environment, context);
return tlist1;
}
@Override
public Collection<SNode> apply(@NotNull TemplateExecutionEnvironment environment, @NotNull TemplateContext context) throws GenerationException {
TemplateContext contextWithParams = context.subContext(getParametersAsMap());
return TemplateUtil.asList(applyPart0(contextWithParams), applyPart1(contextWithParams), applyPart2(contextWithParams));
}
@Override
public Collection<SNode> weave(@NotNull NodeWeaveFacility.WeaveContext weaveContext, @NotNull NodeWeaveFacility weaveSupport) throws GenerationException {
final TemplateContext templateContext = weaveSupport.getTemplateContext().subContext(getParametersAsMap());
SNode tnodepart0 = applyPart0(templateContext);
weaveSupport.weaveNode(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement"), tnodepart0);
SNode tnodepart1 = applyPart1(templateContext);
weaveSupport.weaveNode(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement"), tnodepart1);
Collection<SNode> tlistpart2 = applyPart2(templateContext);
for (SNode nodeToWeave : TemplateUtil.asNotNull(tlistpart2)) {
weaveSupport.weaveNode(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement"), nodeToWeave);
}
return TemplateUtil.asList(tnodepart0, tnodepart1, tlistpart2);
}
@Override
protected SConcept[] initConcepts() {
SConcept[] rv = new SConcept[11];
rv[0] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfc092b6b77L, "BlockStatement");
rv[1] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc56b200L, "StatementList");
rv[2] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x57d533a7af15ed3aL, "SingleLineComment");
rv[3] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x57d533a7af15ed3dL, "TextCommentPart");
rv[4] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc67c7f0L, "LocalVariableDeclarationStatement");
rv[5] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc67c7efL, "LocalVariableDeclaration");
rv[6] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf940d22479L, "IntegerType");
rv[7] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc56b213L, "ExpressionStatement");
rv[8] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c77f1e96L, "AssignmentExpression");
rv[9] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c77f1e98L, "VariableReference");
rv[10] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc59b314L, "IntegerConstant");
return rv;
}
@Override
protected SProperty[] initProperties() {
SProperty[] rv = new SProperty[3];
rv[0] = MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x57d533a7af15ed3dL, 0x57d533a7af15ed3eL, "text");
rv[1] = MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name");
rv[2] = 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[9];
rv[0] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x57d533a7af15ed3aL, 0x57d533a7af16ff73L, "commentPart");
rv[1] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement");
rv[2] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type");
rv[3] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer");
rv[4] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc67c7f0L, 0xf8cc67c7f1L, "localVariableDeclaration");
rv[5] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc092b6b77L, 0xfc092b6b78L, "statements");
rv[6] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, 0xf8c77f1e97L, "lValue");
rv[7] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, 0xf8c77f1e99L, "rValue");
rv[8] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b213L, 0xf8cc56b214L, "expression");
return rv;
}
private static SNodePointer propertyMacro_iblz6q_c0a0c0a0b0b0b0b0b0b0c0k = new SNodePointer("r:00000000-0000-4000-0000-011c89590606(jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main@generator)", "2681305894288695069");
private static SNodePointer propertyMacro_iblz6q_c0a0c0a0b0c0b0b0b0b0c0k = new SNodePointer("r:00000000-0000-4000-0000-011c89590606(jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main@generator)", "2163819695913280743");
private static SNodePointer propertyMacro_iblz6q_c0a0c0a0b0b0b0c0b0b0c0k = new SNodePointer("r:00000000-0000-4000-0000-011c89590606(jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main@generator)", "2681305894288695039");
private static SNodePointer copySrcMacro_iblz6q_b0a0c0d0b0b0b0c0b0b0c0k = new SNodePointer("r:00000000-0000-4000-0000-011c89590606(jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main@generator)", "2681305894288695055");
private static SNodePointer templateNode_iblz6q_c0a0a1a1a1a1a1a2a1a1a2a11 = new SNodePointer("r:00000000-0000-4000-0000-011c89590606(jetbrains.mps.transformation.test.outputLang.generator.baseLanguage.template.main@generator)", "4265636116363100026");
}