package jetbrains.mps.lang.smodel.generator.baseLanguage.template.main;

/*Generated by MPS */

import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.runtime.TemplateSwitchBase;
import jetbrains.mps.generator.runtime.TemplateSwitchMapping;
import jetbrains.mps.generator.runtime.TemplateReductionRule;
import jetbrains.mps.generator.runtime.TemplateUtil;
import org.jetbrains.mps.openapi.model.SNodeReference;
import jetbrains.mps.smodel.SNodePointer;
import java.util.Collection;
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.generator.impl.DismissTopMappingRuleException;
import jetbrains.mps.generator.runtime.ReductionRuleBase;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
import jetbrains.mps.generator.runtime.TemplateRuleWithCondition;
import jetbrains.mps.generator.template.ReductionRuleQueryContext;
import java.util.Collections;
import jetbrains.mps.generator.runtime.MetaObjectContainer;
import org.jetbrains.mps.openapi.language.SConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SReferenceLink;
import org.jetbrains.mps.openapi.language.SContainmentLink;

@Generated
public class Switch_switch_EnumMemberOperation extends TemplateSwitchBase implements TemplateSwitchMapping {
  private final Iterable<TemplateReductionRule> rules;
  public Switch_switch_EnumMemberOperation() {
    super(new MO());
    rules = TemplateUtil.<TemplateReductionRule>asIterable(new ReductionRule0(), new ReductionRule1(), new ReductionRule2(), new ReductionRule3(), new ReductionRule4(), new ReductionRule5(), new ReductionRule6());
  }
  public SNodeReference getSwitchNode() {
    return new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552954635");
  }
  public SNodeReference getModifiesSwitch() {
    return null;
  }
  public Iterable<TemplateReductionRule> getReductionRules() {
    return rules;
  }
  public Collection<SNode> applyDefault(final TemplateContext context) throws GenerationException {
    final TemplateExecutionEnvironment environment = context.getEnvironment();
    DismissTopMappingRuleException ex_6evr7k_a = new DismissTopMappingRuleException(DismissTopMappingRuleException.MessageType.error, "Unsupported enum literal operation");
    ex_6evr7k_a.setTemplateContext(context);
    ex_6evr7k_a.setTemplateModelLocation(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552954636"));
    throw ex_6evr7k_a;
  }
  /*package*/ 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)", "2733396919552954695"), CONCEPTS.EnumMember_NameOperation_Old$QG, true);
    }
    @Override
    public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
      final TemplateExecutionEnvironment environment = context.getEnvironment();
      final SNode tnode1 = environment.createOutputNode(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "2733396919552571238");
        environment.associate(tnode1, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
        TemplateContext context1 = context.subContext();
        {
          Collection<SNode> tlist2 = null;
          final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_116_0(new SourceSubstituteMacroNodeContext(context1, copySrcMacro));
          tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro, "tpl/r:00000000-0000-4000-0000-011c89590303/2733396919552976108", context1);
          environment.aggregate(tnode1, myAggregationLinks[0], tlist2);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }
  /*package*/ 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)", "2733396919552955746"), CONCEPTS.EnumMember_ValueOperation_Old$rN, true);
    }
    @Override
    public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
      return QueriesGenerated.rule_Condition_116_0(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(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "2733396919552571251");
        environment.associate(tnode1, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
        TemplateContext context1 = context.subContext();
        {
          Collection<SNode> tlist2 = null;
          final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_116_1(new SourceSubstituteMacroNodeContext(context1, copySrcMacro1));
          tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro1, "tpl/r:00000000-0000-4000-0000-011c89590303/2733396919552979427", context1);
          environment.aggregate(tnode1, myAggregationLinks[0], tlist2);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }
  /*package*/ 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)", "2733396919552955752"), CONCEPTS.EnumMember_ValueOperation_Old$rN, true);
    }
    @Override
    public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
      return QueriesGenerated.rule_Condition_116_1(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(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Integer.parseInt(java.lang.String)");
        environment.associate(tnode1, myAssociationLinks[1], "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Integer");
        TemplateContext context1 = context.subContext();
        {
          final SNode tnode2 = environment.createOutputNode(myConcepts[0]);
          {
            environment.associate(tnode2, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
            environment.associate(tnode2, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "2733396919552571251");
            TemplateContext context2 = context1.subContext();
            {
              Collection<SNode> tlist3 = null;
              final SNode copySrcInput3 = QueriesGenerated.sourceNodeQuery_116_2(new SourceSubstituteMacroNodeContext(context2, copySrcMacro2));
              tlist3 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput3), copySrcMacro2, "tpl/r:00000000-0000-4000-0000-011c89590303/2733396919552980112", context2);
              environment.aggregate(tnode2, myAggregationLinks[0], tlist3);
            }
          }
          environment.aggregate(tnode1, myAggregationLinks[0], tnode2);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }
  /*package*/ final class ReductionRule3 extends ReductionRuleBase implements TemplateRuleWithCondition {
    public ReductionRule3() {
      super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552961455"), CONCEPTS.EnumMember_ValueOperation_Old$rN, true);
    }
    @Override
    public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
      return QueriesGenerated.rule_Condition_116_2(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(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Boolean.parseBoolean(java.lang.String)");
        environment.associate(tnode1, myAssociationLinks[1], "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Boolean");
        TemplateContext context1 = context.subContext();
        {
          final SNode tnode2 = environment.createOutputNode(myConcepts[0]);
          {
            environment.associate(tnode2, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "2733396919552571251");
            environment.associate(tnode2, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
            TemplateContext context2 = context1.subContext();
            {
              Collection<SNode> tlist3 = null;
              final SNode copySrcInput3 = QueriesGenerated.sourceNodeQuery_116_3(new SourceSubstituteMacroNodeContext(context2, copySrcMacro3));
              tlist3 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput3), copySrcMacro3, "tpl/r:00000000-0000-4000-0000-011c89590303/2733396919552981089", context2);
              environment.aggregate(tnode2, myAggregationLinks[0], tlist3);
            }
          }
          environment.aggregate(tnode1, myAggregationLinks[0], tnode2);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }
  /*package*/ final class ReductionRule4 extends ReductionRuleBase {
    public ReductionRule4() {
      super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "3689841190252912365"), CONCEPTS.EnumMember_NameOperation$1M, true);
    }
    @Override
    public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
      final TemplateExecutionEnvironment environment = context.getEnvironment();
      final SNode tnode1 = environment.createOutputNode(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1007227851265422991");
        environment.associate(tnode1, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
        TemplateContext context1 = context.subContext();
        {
          Collection<SNode> tlist2 = null;
          final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_116_4(new SourceSubstituteMacroNodeContext(context1, copySrcMacro4));
          tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro4, "tpl/r:00000000-0000-4000-0000-011c89590303/3689841190252939273", context1);
          environment.aggregate(tnode1, myAggregationLinks[0], tlist2);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }
  /*package*/ final class ReductionRule5 extends ReductionRuleBase {
    public ReductionRule5() {
      super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "3689841190252939573"), CONCEPTS.EnumMember_PresentationOperation$bM, true);
    }
    @Override
    public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
      final TemplateExecutionEnvironment environment = context.getEnvironment();
      final SNode tnode1 = environment.createOutputNode(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "8813871103013443443");
        environment.associate(tnode1, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
        TemplateContext context1 = context.subContext();
        {
          Collection<SNode> tlist2 = null;
          final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_116_5(new SourceSubstituteMacroNodeContext(context1, copySrcMacro5));
          tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro5, "tpl/r:00000000-0000-4000-0000-011c89590303/3689841190252940910", context1);
          environment.aggregate(tnode1, myAggregationLinks[0], tlist2);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }
  /*package*/ final class ReductionRule6 extends ReductionRuleBase {
    public ReductionRule6() {
      super(new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6202631021711033226"), CONCEPTS.EnumMember_IsOperation$hk, true);
    }
    @Override
    public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
      final TemplateExecutionEnvironment environment = context.getEnvironment();
      final SNode tnode1 = environment.createOutputNode(myConcepts[0]);
      {
        environment.associate(tnode1, myAssociationLinks[0], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "4705942098323993284");
        environment.associate(tnode1, myAssociationLinks[1], "r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)", "1101499704720825413");
        TemplateContext context1 = context.subContext();
        {
          Collection<SNode> tlist2 = null;
          final SNode copySrcInput2 = QueriesGenerated.sourceNodeQuery_116_6(new SourceSubstituteMacroNodeContext(context1, copySrcMacro6));
          tlist2 = environment.copyNodes(TemplateUtil.singletonList(copySrcInput2), copySrcMacro6, "tpl/r:00000000-0000-4000-0000-011c89590303/6202631021711034670", context1);
          environment.aggregate(tnode1, myAggregationLinks[0], tlist2);
        }
        {
          Collection<SNode> tlist3 = null;
          SNode callInputNode3 = QueriesGenerated.sourceNodeQuery_116_7(new SourceSubstituteMacroNodeContext(context1, callMacro));
          TemplateContext context2 = context1;
          context2 = context2.subContext(null, callInputNode3);
          if (callInputNode3 != null) {
            tlist3 = environment.callSite(new Template_reduce_EnumMember2Id(), new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1144794804654544672")).apply(context2);
          } else {
            tlist3 = Collections.emptyList();
          }
          environment.aggregate(tnode1, myAggregationLinks[0], tlist3);
        }
      }
      return TemplateUtil.singletonList(tnode1);
    }
  }

  /*package*/ static final class MO implements MetaObjectContainer {
    @Override
    public SConcept[] concepts() {
      SConcept[] rv = new SConcept[1];
      rv[0] = MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xfbbebabf09L, "StaticMethodCall");
      return rv;
    }


    @Override
    public SReferenceLink[] associations() {
      SReferenceLink[] rv = new SReferenceLink[2];
      rv[0] = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration");
      rv[1] = MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbbebabf09L, 0x10a7588b546L, "classConcept");
      return rv;
    }

    @Override
    public SContainmentLink[] aggregations() {
      SContainmentLink[] rv = new SContainmentLink[1];
      rv[0] = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument");
      return rv;
    }
  }
  private static final SNodePointer copySrcMacro = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552976231");
  private static final SNodePointer copySrcMacro1 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552979428");
  private static final SNodePointer copySrcMacro2 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552980113");
  private static final SNodePointer copySrcMacro3 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "2733396919552981090");
  private static final SNodePointer copySrcMacro4 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "3689841190252939274");
  private static final SNodePointer copySrcMacro5 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "3689841190252940911");
  private static final SNodePointer copySrcMacro6 = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "6202631021711034671");
  private static final SNodePointer callMacro = new SNodePointer("r:00000000-0000-4000-0000-011c89590303(jetbrains.mps.lang.smodel.generator.baseLanguage.template.main@generator)", "1144794804654544672");

  private static final class CONCEPTS {
    /*package*/ static final SConcept EnumMember_NameOperation_Old$QG = MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x120c01735d3L, "jetbrains.mps.lang.smodel.structure.EnumMember_NameOperation_Old");
    /*package*/ static final SConcept EnumMember_ValueOperation_Old$rN = MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x120bff92dbeL, "jetbrains.mps.lang.smodel.structure.EnumMember_ValueOperation_Old");
    /*package*/ static final SConcept EnumMember_NameOperation$1M = MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x1b4bba1b9faef9d2L, "jetbrains.mps.lang.smodel.structure.EnumMember_NameOperation");
    /*package*/ static final SConcept EnumMember_PresentationOperation$bM = MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x50352c802d97cfd1L, "jetbrains.mps.lang.smodel.structure.EnumMember_PresentationOperation");
    /*package*/ static final SConcept EnumMember_IsOperation$hk = MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x414edd67c0135694L, "jetbrains.mps.lang.smodel.structure.EnumMember_IsOperation");
  }
}
