package jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_ArgumentsInTemplateDeclarationReference;
/*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.Map;
import jetbrains.mps.internal.collections.runtime.MapSequence;
import java.util.HashMap;
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.runtime.NodeWeaveFacility;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SConcept;
import org.jetbrains.mps.openapi.language.SProperty;
@Generated
public class Template_reduceWithArgs extends TemplateDeclarationBase {
private String myP1;
public Template_reduceWithArgs(String p1) {
this.myP1 = p1;
}
public SNodeReference getTemplateNode() {
return new SNodePointer("r:b5afdf3a-04e4-43b0-b72c-a4e3b5141a37(jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_ArgumentsInTemplateDeclarationReference@generator)", "7496726876599872860");
}
private Map<String, Object> getParametersAsMap() {
Map<String, Object> result = MapSequence.fromMap(new HashMap<String, Object>());
MapSequence.fromMap(result).put("p1", myP1);
return result;
}
protected SNode applyPart0(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
final SNode tnode1 = environment.createOutputNode(myConcepts[0]);
try {
SNodeAccessUtil.setProperty(tnode1, myProperties[0], TemplateUtil.asString(QueriesGenerated.propertyMacro_GetPropertyValue_7496726876599876334(new PropertyMacroContext(context, null, propertyMacro_quugqv_c0a0c0a0c0g))));
} finally {
}
return tnode1;
}
@Override
public Collection<SNode> apply(@NotNull TemplateExecutionEnvironment environment, @NotNull TemplateContext context) throws GenerationException {
TemplateContext contextWithParams = context.subContext(getParametersAsMap());
return TemplateUtil.singletonList(applyPart0(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(0xb401a68083254110L, 0x8fd384331ff25befL, 0xfe43cb41d0L, 0xfe43de823bL, "contentNode"), tnodepart0);
return TemplateUtil.singletonList(tnodepart0);
}
@Override
protected SConcept[] initConcepts() {
SConcept[] rv = new SConcept[1];
rv[0] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x157a9668bf58417bL, 0x893e53d86388dc56L, "jetbrains.mps.transformation.test.outputLang"), 0x1164564a526L, "OutputNode");
return rv;
}
@Override
protected SProperty[] initProperties() {
SProperty[] rv = new SProperty[1];
rv[0] = MetaAdapterFactory.getProperty(0x157a9668bf58417bL, 0x893e53d86388dc56L, 0x1164564a526L, 0x11645b5a797L, "text");
return rv;
}
private static SNodePointer propertyMacro_quugqv_c0a0c0a0c0g = new SNodePointer("r:b5afdf3a-04e4-43b0-b72c-a4e3b5141a37(jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_ArgumentsInTemplateDeclarationReference@generator)", "7496726876599876333");
}