package jetbrains.mps.lang.smodel.generator.baseLanguage.template.main;
/*Generated by MPS */
import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.runtime.MapConfigBase;
import jetbrains.mps.generator.runtime.TemplateMappingConfiguration;
import java.util.Collection;
import jetbrains.mps.generator.runtime.TemplateReductionRule;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.runtime.TemplateModel;
import jetbrains.mps.smodel.SNodePointer;
import jetbrains.mps.generator.runtime.TemplateUtil;
import jetbrains.mps.generator.template.ITemplateGenerator;
import jetbrains.mps.generator.template.TemplateQueryContext;
import jetbrains.mps.generator.runtime.ReductionRuleBase;
import jetbrains.mps.generator.runtime.TemplateRuleWithCondition;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.generator.runtime.TemplateContext;
import jetbrains.mps.generator.runtime.GenerationException;
import jetbrains.mps.generator.template.ReductionRuleQueryContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.runtime.TemplateExecutionEnvironment;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
import jetbrains.mps.generator.template.IfMacroContext;
@Generated
public class Mapping_mc_concept_method_call extends MapConfigBase implements TemplateMappingConfiguration {
private final Collection<TemplateReductionRule> rules;
public Mapping_mc_concept_method_call(@NotNull TemplateModel model) {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "7552281371882288144"), "mc_concept_method_call", model, false);
rules = TemplateUtil.<TemplateReductionRule>asCollection(new Mapping_mc_concept_method_call.ReductionRule0(), new Mapping_mc_concept_method_call.ReductionRule1(), new Mapping_mc_concept_method_call.ReductionRule2());
}
@Override
public boolean isApplicable(@NotNull ITemplateGenerator generator) {
return QueriesGenerated.mappingConfiguration_Condition_3624172675691123852(new TemplateQueryContext(getMappingNode(), generator));
}
@Override
public Collection<TemplateReductionRule> getReductionRules() {
return rules;
}
public final class ReductionRule0 extends ReductionRuleBase implements TemplateRuleWithCondition {
public ReductionRule0() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "5850694276437263813"), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, "jetbrains.mps.baseLanguage.structure.DotExpression"), true);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_5850694276437457225(new ReductionRuleQueryContext(context, getRuleNode()));
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
Collection<SNode> tlist1 = null;
final SNode copySrcInput1 = QueriesGenerated.sourceNodeQuery_5850694276437457245(new SourceSubstituteMacroNodeContext(context, copySrcMacro_ihzv2u_b0a0d0c4));
tlist1 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput1), copySrcMacro_ihzv2u_b0a0d0c4, "tpl/r:00000000-0000-4000-0000-011c89590303/5850694276437457243", context);
return tlist1;
}
}
public final class ReductionRule1 extends ReductionRuleBase implements TemplateRuleWithCondition {
public ReductionRule1() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "5616724231236577438"), MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x1129a43046bL, "jetbrains.mps.lang.smodel.structure.Node_ConceptMethodCall"), false);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_2391302010127468238(new ReductionRuleQueryContext(context, getRuleNode()));
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
Collection<SNode> tlist1 = null;
if (QueriesGenerated.ifMacro_Condition_5616724231236702747(new IfMacroContext(context, ifMacroRef_ihzv2u_b0a0c0c5))) {
final SNode tnode2 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfb4ed32b7fL, "ParenthesizedExpression"));
try {
TemplateContext context1 = context.subContext();
{
final SNode tnode3 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf940dabe4aL, "CastExpression"));
try {
TemplateContext context2 = context1.subContext();
{
Collection<SNode> tlist4 = null;
final SNode copySrcInput4 = QueriesGenerated.sourceNodeQuery_5616724231236702710(new SourceSubstituteMacroNodeContext(context2, copySrcMacro_ihzv2u_b0a0c0b0b0b0b0c0c5));
tlist4 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput4), copySrcMacro_ihzv2u_b0a0c0b0b0b0b0c0c5, "tpl/r:00000000-0000-4000-0000-011c89590303/5616724231236702708", context2);
for (SNode child5 : TemplateUtil.asNotNull(tlist4)) {
tnode3.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940dabe4aL, 0xf940dabe4bL, "type"), child5);
}
// TODO validate child
}
{
Collection<SNode> tlist6 = null;
tlist6 = new Template_reduce_ConceptMethodCallReflective().apply(environment, context2);
for (SNode child7 : TemplateUtil.asNotNull(tlist6)) {
tnode3.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940dabe4aL, 0xf940dabe4cL, "expression"), child7);
}
// TODO validate child
}
} finally {
}
tnode2.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, 0xfb4ed32b80L, "expression"), tnode3);
// TODO validate child
}
} finally {
}
tlist1 = TemplateUtil.singletonList(tnode2);
} else {
Collection<SNode> tlist8 = new Template_reduce_ConceptMethodCallReflective().apply(environment, context);
tlist1 = tlist8;
}
return tlist1;
}
}
public final class ReductionRule2 extends ReductionRuleBase {
public ReductionRule2() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "8560627202335067150"), MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x1129a43046bL, "jetbrains.mps.lang.smodel.structure.Node_ConceptMethodCall"), false);
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
Collection<SNode> tlist1 = new Template_reduce_ConceptMethodCall().apply(environment, context);
return tlist1;
}
}
private static SNodePointer copySrcMacro_ihzv2u_b0a0d0c4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "5850694276437457244");
private static SNodePointer copySrcMacro_ihzv2u_b0a0c0b0b0b0b0c0c5 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "5616724231236702709");
private static SNodePointer ifMacroRef_ihzv2u_b0a0c0c5 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "5616724231236702746");
}