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.BaseMappingRuleContext;
import jetbrains.mps.smodel.SReference;
import org.jetbrains.mps.openapi.persistence.PersistenceFacade;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
import jetbrains.mps.generator.impl.DismissTopMappingRuleException;
@Generated
public class Mapping_mc_implicitSelect extends MapConfigBase implements TemplateMappingConfiguration {
private final Collection<TemplateReductionRule> rules;
public Mapping_mc_implicitSelect(@NotNull TemplateModel model) {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "7551657168185584731"), "mc_implicitSelect", model, false);
rules = TemplateUtil.<TemplateReductionRule>asCollection(new Mapping_mc_implicitSelect.ReductionRule0());
}
@Override
public boolean isApplicable(@NotNull ITemplateGenerator generator) {
return QueriesGenerated.mappingConfiguration_Condition_3624172675691267240(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)", "7551657168185616464"), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, "jetbrains.mps.baseLanguage.structure.DotExpression"), true);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_7551657168185616465(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.baseMappingRule_Condition_4877343046905065733(new BaseMappingRuleContext(context, rule_x5z8bg_b0a0c0c4))) {
final SNode tnode2 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall"));
try {
tnode2.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), tnode2, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("4877343046905094202")));
tnode2.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), tnode2, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("6599163591527286349")));
TemplateContext context1 = context.subContext();
{
Collection<SNode> tlist3 = null;
final SNode copySrcInput3 = QueriesGenerated.sourceNodeQuery_4877343046905147149(new SourceSubstituteMacroNodeContext(context1, copySrcMacro_x5z8bg_b0a0c0d0b0c0c4));
tlist3 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput3), copySrcMacro_x5z8bg_b0a0c0d0b0c0c4, "tpl/r:00000000-0000-4000-0000-011c89590303/4877343046905139073", context1);
for (SNode child4 : TemplateUtil.asNotNull(tlist3)) {
tnode2.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child4);
}
// TODO validate child
}
{
Collection<SNode> tlist5 = null;
SNode callInputNode5 = QueriesGenerated.sourceNodeQuery_4877343046905178476(new SourceSubstituteMacroNodeContext(context1, callMacro_x5z8bg_b0a0a1a4a1a2a2e));
TemplateContext context2 = context1.subContext(null, callInputNode5);
if (callInputNode5 != null) {
tlist5 = new Template_reduce_LinkDeclaration_SLink().apply(environment, context2);
}
for (SNode child6 : TemplateUtil.asNotNull(tlist5)) {
tnode2.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child6);
}
// TODO validate child
}
} finally {
}
tlist1 = TemplateUtil.singletonList(tnode2);
} else if (QueriesGenerated.baseMappingRule_Condition_4877343046905092782(new BaseMappingRuleContext(context, rule_x5z8bg_b0a0c0c4))) {
final SNode tnode7 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall"));
try {
tnode7.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), tnode7, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("6599163591527286349")));
tnode7.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), tnode7, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("4877343046905095413")));
TemplateContext context3 = context.subContext();
{
Collection<SNode> tlist8 = null;
final SNode copySrcInput8 = QueriesGenerated.sourceNodeQuery_4877343046905223676(new SourceSubstituteMacroNodeContext(context3, copySrcMacro_x5z8bg_b0a0c0d0b0a2a2e));
tlist8 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput8), copySrcMacro_x5z8bg_b0a0c0d0b0a2a2e, "tpl/r:00000000-0000-4000-0000-011c89590303/4877343046905223674", context3);
for (SNode child9 : TemplateUtil.asNotNull(tlist8)) {
tnode7.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child9);
}
// TODO validate child
}
{
Collection<SNode> tlist10 = null;
SNode callInputNode10 = QueriesGenerated.sourceNodeQuery_4877343046905225318(new SourceSubstituteMacroNodeContext(context3, callMacro_x5z8bg_b0a0a1a4a1a0c0c4));
TemplateContext context4 = context3.subContext(null, callInputNode10);
if (callInputNode10 != null) {
tlist10 = new Template_reduce_LinkDeclaration_SLink().apply(environment, context4);
}
for (SNode child11 : TemplateUtil.asNotNull(tlist10)) {
tnode7.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child11);
}
// TODO validate child
}
} finally {
}
tlist1 = TemplateUtil.singletonList(tnode7);
} else if (QueriesGenerated.baseMappingRule_Condition_4877343046905067102(new BaseMappingRuleContext(context, rule_x5z8bg_b0a0c0c4))) {
final SNode tnode12 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall"));
try {
tnode12.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), tnode12, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("4877343046905096608")));
tnode12.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), tnode12, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("6599163591527286349")));
TemplateContext context5 = context.subContext();
{
Collection<SNode> tlist13 = null;
final SNode copySrcInput13 = QueriesGenerated.sourceNodeQuery_4877343046905241410(new SourceSubstituteMacroNodeContext(context5, copySrcMacro_x5z8bg_b0a0c0d0b0b2a2e));
tlist13 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput13), copySrcMacro_x5z8bg_b0a0c0d0b0b2a2e, "tpl/r:00000000-0000-4000-0000-011c89590303/4877343046905241408", context5);
for (SNode child14 : TemplateUtil.asNotNull(tlist13)) {
tnode12.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child14);
}
// TODO validate child
}
{
Collection<SNode> tlist15 = null;
SNode callInputNode15 = QueriesGenerated.sourceNodeQuery_4877343046905241423(new SourceSubstituteMacroNodeContext(context5, callMacro_x5z8bg_b0a0a1a4a1a1c0c4));
TemplateContext context6 = context5.subContext(null, callInputNode15);
if (callInputNode15 != null) {
tlist15 = new Template_reduce_LinkDeclaration_SLink().apply(environment, context6);
}
for (SNode child16 : TemplateUtil.asNotNull(tlist15)) {
tnode12.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child16);
}
// TODO validate child
}
} finally {
}
tlist1 = TemplateUtil.singletonList(tnode12);
} else {
DismissTopMappingRuleException ex_yxgl8l_a0a = new DismissTopMappingRuleException(DismissTopMappingRuleException.MessageType.error, "\"Unexpected implicit link select operation\"");
ex_yxgl8l_a0a.setTemplateContext(context);
ex_yxgl8l_a0a.setTemplateModelLocation(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905239389"));
throw ex_yxgl8l_a0a;
}
return tlist1;
}
}
private static SNodePointer rule_x5z8bg_b0a0c0c4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "7551657168185616464");
private static SNodePointer copySrcMacro_x5z8bg_b0a0c0d0b0c0c4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905145817");
private static SNodePointer callMacro_x5z8bg_b0a0a1a4a1a2a2e = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905176267");
private static SNodePointer copySrcMacro_x5z8bg_b0a0c0d0b0a2a2e = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905223675");
private static SNodePointer callMacro_x5z8bg_b0a0a1a4a1a0c0c4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905225317");
private static SNodePointer copySrcMacro_x5z8bg_b0a0c0d0b0b2a2e = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905241409");
private static SNodePointer callMacro_x5z8bg_b0a0a1a4a1a1c0c4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4877343046905241422");
}