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.runtime.ReductionRuleBase;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.runtime.TemplateContext;
import jetbrains.mps.generator.runtime.GenerationException;
import jetbrains.mps.generator.runtime.TemplateExecutionEnvironment;
import jetbrains.mps.smodel.SReference;
import org.jetbrains.mps.openapi.persistence.PersistenceFacade;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
import jetbrains.mps.generator.runtime.TemplateRuleWithCondition;
import jetbrains.mps.generator.template.ReductionRuleQueryContext;
import java.util.Collections;
@Generated
public class Mapping_mc_link_operations extends MapConfigBase implements TemplateMappingConfiguration {
private final Collection<TemplateReductionRule> rules;
public Mapping_mc_link_operations(@NotNull TemplateModel model) {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1139341814904"), "mc_link_operations", model, false);
rules = TemplateUtil.<TemplateReductionRule>asCollection(new Mapping_mc_link_operations.ReductionRule0(), new Mapping_mc_link_operations.ReductionRule1(), new Mapping_mc_link_operations.ReductionRule2());
}
@Override
public Collection<TemplateReductionRule> getReductionRules() {
return rules;
}
public final class ReductionRule0 extends ReductionRuleBase {
public ReductionRule0() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1168907859730"), MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x108f96ea2caL, "jetbrains.mps.lang.smodel.structure.SLinkAccess"), false);
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
final SNode tnode1 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall"));
try {
tnode1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), tnode1, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("6599163591527286349")));
tnode1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), tnode1, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("1612392507789494675")));
TemplateContext context1 = context.subContext();
{
Collection<SNode> tlist2 = null;
final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_1205438232672(new SourceSubstituteMacroNodeContext(context1, copySrcMacro_jzpaek_b0a0c0d0c0b3));
tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro_jzpaek_b0a0c0d0c0b3, "tpl/r:00000000-0000-4000-0000-011c89590303/1205438232670", context1);
for (SNode child3 : TemplateUtil.asNotNull(tlist2)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child3);
}
// TODO validate child
}
{
Collection<SNode> tlist4 = null;
try {
SNode callInputNode4 = QueriesGenerated.sourceNodeQuery_4585658144694186034(new SourceSubstituteMacroNodeContext(context1, includeMacro_jzpaek_b0a0a0a1a4a2a1d));
TemplateContext context2 = context1.subContext(null, callInputNode4);
if (callInputNode4 != null) {
try {
tlist4 = new Template_reduce_LinkDeclaration_SLink().apply(environment, context2);
} finally {
}
}
} finally {
}
for (SNode child5 : TemplateUtil.asNotNull(tlist4)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child5);
}
// TODO validate child
}
} finally {
}
return TemplateUtil.singletonList(tnode1);
}
}
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)", "1168907918945"), MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x109233dbca1L, "jetbrains.mps.lang.smodel.structure.Link_SetNewChildOperation"), false);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_6960953357954081795(new ReductionRuleQueryContext(context, getRuleNode()));
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
final SNode tnode1 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall"));
try {
tnode1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), tnode1, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("4585658144689928116")));
tnode1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), tnode1, 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> tlist2 = null;
final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_6246743999000387774(new SourceSubstituteMacroNodeContext(context1, copySrcMacro_jzpaek_b0a0c0d0c0c4));
tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro_jzpaek_b0a0c0d0c0c4, "tpl/r:00000000-0000-4000-0000-011c89590303/6246743999000387772", context1);
for (SNode child3 : TemplateUtil.asNotNull(tlist2)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child3);
}
// TODO validate child
}
{
Collection<SNode> tlist4 = null;
{
final SNode switchInput4 = QueriesGenerated.sourceNodeQuery_6246743999000387784(new SourceSubstituteMacroNodeContext(context1, switchMacroRef_jzpaek_b0a0a0a1a4a2a2e));
if (switchInput4 == null) {
tlist4 = Collections.emptyList();
} else {
TemplateContext switchContext4;
switchContext4 = context1.subContext(null, switchInput4);
tlist4 = environment.trySwitch(templateSwitchNode_jzpaek_a0a0c0a1a1a4a2a2e, switchContext4);
if (tlist4 == null) {
final SNode tnode5 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf940cd6167L, "NullLiteral"));
try {
} finally {
}
if (tnode5 != null) {
tlist4 = TemplateUtil.singletonList(tnode5);
}
}
}
}
for (SNode child6 : TemplateUtil.asNotNull(tlist4)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child6);
}
// TODO validate child
}
{
Collection<SNode> tlist7 = null;
try {
SNode callInputNode7 = QueriesGenerated.sourceNodeQuery_7840981857923730690(new SourceSubstituteMacroNodeContext(context1, includeMacro_jzpaek_b0a0a0a1a5a2a2e));
TemplateContext context2 = context1.subContext(null, callInputNode7);
if (callInputNode7 != null) {
try {
tlist7 = new Template_reduce_ConceptDeclaration2SConcept().apply(environment, context2);
} finally {
}
}
} finally {
}
for (SNode child8 : TemplateUtil.asNotNull(tlist7)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child8);
}
// TODO validate child
}
} finally {
}
return TemplateUtil.singletonList(tnode1);
}
}
public final class ReductionRule2 extends ReductionRuleBase implements TemplateRuleWithCondition {
public ReductionRule2() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1168908007519"), MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x1099887af60L, "jetbrains.mps.lang.smodel.structure.Link_SetTargetOperation"), false);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_6960953357954085007(new ReductionRuleQueryContext(context, getRuleNode()));
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
final SNode tnode1 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall"));
try {
tnode1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration"), tnode1, PersistenceFacade.getInstance().createModelReference("r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)"), PersistenceFacade.getInstance().createNodeId("1612392507789543417")));
tnode1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept"), tnode1, 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> tlist2 = null;
final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_6246743999000991650(new SourceSubstituteMacroNodeContext(context1, copySrcMacro_jzpaek_b0a0c0d0c0c5));
tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro_jzpaek_b0a0c0d0c0c5, "tpl/r:00000000-0000-4000-0000-011c89590303/6246743999000991648", context1);
for (SNode child3 : TemplateUtil.asNotNull(tlist2)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child3);
}
// TODO validate child
}
{
Collection<SNode> tlist4 = null;
{
final SNode switchInput4 = QueriesGenerated.sourceNodeQuery_6246743999000995471(new SourceSubstituteMacroNodeContext(context1, switchMacroRef_jzpaek_b0a0a0a1a4a2a2f));
if (switchInput4 == null) {
tlist4 = Collections.emptyList();
} else {
TemplateContext switchContext4;
switchContext4 = context1.subContext(null, switchInput4);
tlist4 = environment.trySwitch(templateSwitchNode_jzpaek_a0a0c0a1a1a4a2a2f, switchContext4);
if (tlist4 == null) {
final SNode tnode5 = environment.createOutputNode(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf940cd6167L, "NullLiteral"));
try {
} finally {
}
if (tnode5 != null) {
tlist4 = TemplateUtil.singletonList(tnode5);
}
}
}
}
for (SNode child6 : TemplateUtil.asNotNull(tlist4)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child6);
}
// TODO validate child
}
{
Collection<SNode> tlist7 = null;
final SNode copySrcInput7 = QueriesGenerated.sourceNodeQuery_6246743999000991668(new SourceSubstituteMacroNodeContext(context1, copySrcMacro_jzpaek_b0a0c0f0c0c5));
tlist7 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput7), copySrcMacro_jzpaek_b0a0c0f0c0c5, "tpl/r:00000000-0000-4000-0000-011c89590303/6246743999000991666", context1);
for (SNode child8 : TemplateUtil.asNotNull(tlist7)) {
tnode1.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument"), child8);
}
// TODO validate child
}
} finally {
}
return TemplateUtil.singletonList(tnode1);
}
}
private static SNodePointer copySrcMacro_jzpaek_b0a0c0d0c0b3 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1205438232671");
private static SNodePointer includeMacro_jzpaek_b0a0a0a1a4a2a1d = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "4585658144694184901");
private static SNodePointer copySrcMacro_jzpaek_b0a0c0d0c0c4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6246743999000387773");
private static SNodePointer switchMacroRef_jzpaek_b0a0a0a1a4a2a2e = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6246743999000387783");
private static SNodePointer templateSwitchNode_jzpaek_a0a0c0a1a1a4a2a2e = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1205432344145");
private static SNodePointer includeMacro_jzpaek_b0a0a0a1a5a2a2e = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "7840981857923730689");
private static SNodePointer copySrcMacro_jzpaek_b0a0c0d0c0c5 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6246743999000991649");
private static SNodePointer switchMacroRef_jzpaek_b0a0a0a1a4a2a2f = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6246743999000995128");
private static SNodePointer templateSwitchNode_jzpaek_a0a0c0a1a1a4a2a2f = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1205432344145");
private static SNodePointer copySrcMacro_jzpaek_b0a0c0f0c0c5 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6246743999000991667");
}