package jetbrains.mps.baseLanguage.generator.java.strings;

/*Generated by MPS */

import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.impl.query.QueryProviderBase;
import jetbrains.mps.generator.template.CreateRootRuleContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SEnumOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.generator.template.BaseMappingRuleContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.baseLanguage.behavior.IOperation__BehaviorDescriptor;
import jetbrains.mps.generator.template.PropertyMacroContext;
import jetbrains.mps.generator.template.ReferenceMacroContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.template.IfMacroContext;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext;
import jetbrains.mps.generator.template.TemplateVarContext;
import jetbrains.mps.lang.core.behavior.INamedConcept__BehaviorDescriptor;
import jetbrains.mps.baseLanguage.behavior.IClassifierMember__BehaviorDescriptor;
import java.util.Map;
import jetbrains.mps.generator.impl.query.ReductionRuleCondition;
import java.util.HashMap;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.impl.query.QueryKey;
import jetbrains.mps.generator.template.ReductionRuleQueryContext;
import jetbrains.mps.generator.impl.GenerationFailureException;
import jetbrains.mps.generator.impl.query.CreateRootCondition;
import jetbrains.mps.generator.impl.query.SourceNodeQuery;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.generator.impl.query.SourceNodesQuery;
import java.util.Collection;
import jetbrains.mps.util.IterableUtil;
import jetbrains.mps.generator.impl.query.PropertyValueQuery;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SProperty;
import jetbrains.mps.generator.impl.query.IfMacroCondition;
import jetbrains.mps.generator.impl.query.InlineSwitchCaseCondition;
import jetbrains.mps.generator.template.InlineSwitchCaseContext;
import jetbrains.mps.generator.impl.query.ReferenceTargetQuery;
import jetbrains.mps.generator.impl.query.VariableValueQuery;
import org.jetbrains.mps.openapi.language.SConcept;
import org.jetbrains.mps.openapi.language.SInterfaceConcept;
import org.jetbrains.mps.openapi.language.SContainmentLink;

@Generated
public class QueriesGenerated extends QueryProviderBase {
  public QueriesGenerated() {
    super(1);
  }
  public static boolean createRootRule_Condition_6_0(final CreateRootRuleContext _context) {
    return !(SModelOperations.nodes(_context.getInputModel(), CONCEPTS.SubstringExpression$uY).isEmpty()) || ListSequence.fromList(SModelOperations.nodes(_context.getInputModel(), CONCEPTS.TrimOperation$$f)).any((it) -> !(SEnumOperations.isMember(SPropertyOperations.getEnum(it, PROPS.trimKind$5DDk), 0x11d47df9507L)));
  }
  public static boolean rule_Condition_6_0(final BaseMappingRuleContext _context) {
    return SNodeOperations.isInstanceOf(SLinkOperations.getTarget(_context.getNode(), LINKS.operation$gs9E), CONCEPTS.BaseStringOperation$Ae);
  }
  public static boolean rule_Condition_6_1(final BaseMappingRuleContext _context) {
    return !(SNodeOperations.isInstanceOf(IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode()), CONCEPTS.IVariableReference$C));
  }
  public static boolean rule_Condition_6_2(final BaseMappingRuleContext _context) {
    return SNodeOperations.isInstanceOf(IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode()), CONCEPTS.IVariableReference$C);
  }
  public static boolean rule_Condition_6_3(final BaseMappingRuleContext _context) {
    return !(SNodeOperations.isInstanceOf(IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode()), CONCEPTS.IVariableReference$C));
  }
  public static boolean rule_Condition_6_4(final BaseMappingRuleContext _context) {
    return SNodeOperations.isInstanceOf(IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode()), CONCEPTS.IVariableReference$C);
  }
  public static boolean rule_Condition_6_5(final BaseMappingRuleContext _context) {
    return SEnumOperations.isMember(SPropertyOperations.getEnum(_context.getNode(), PROPS.trimKind$5DDk), 0x11d47df9508L);
  }
  public static boolean rule_Condition_6_6(final BaseMappingRuleContext _context) {
    return SEnumOperations.isMember(SPropertyOperations.getEnum(_context.getNode(), PROPS.trimKind$5DDk), 0x11d47df9509L);
  }
  public static boolean rule_Condition_6_7(final BaseMappingRuleContext _context) {
    return SNodeOperations.isInstanceOf(IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode()), CONCEPTS.IVariableReference$C);
  }
  public static Object propertyMacro_GetValue_4_0(final PropertyMacroContext _context) {
    return jetbrains.mps.util.SNodeOperations.getModelLongName(SNodeOperations.getModel(_context.getNode())) + ".StringUtils";
  }
  public static Object propertyMacro_GetValue_5_0(final PropertyMacroContext _context) {
    return _context.createUniqueName("trim", SNodeOperations.getContainingRoot(_context.getNode()));
  }
  public static Object propertyMacro_GetValue_8_0(final PropertyMacroContext _context) {
    return jetbrains.mps.util.SNodeOperations.getModelLongName(SNodeOperations.getModel(_context.getNode())) + ".StringUtils";
  }
  public static Object propertyMacro_GetValue_10_0(final PropertyMacroContext _context) {
    return jetbrains.mps.util.SNodeOperations.getModelLongName(SNodeOperations.getModel(_context.getNode())) + ".StringUtils";
  }
  public static Object referenceMacro_GetReferent_0_0(final ReferenceMacroContext _context) {
    SNode firstOp = (SNode) _context.getSessionObject(((String) _context.getVariable("var:methodNameKey")));
    return SLinkOperations.getTarget(_context.getOutputNodeByInputNodeAndMappingLabel(firstOp, "IsNotEmptyExtractExpr"), LINKS.method$yoGN);
  }
  public static Object referenceMacro_GetReferent_11_0(final ReferenceMacroContext _context) {
    // To distinguish generated isEmpty of the same session in different classes, need an object we've replaced
    // with extract statement. With it, can get output by label and input
    SNode firstOp = (SNode) _context.getSessionObject(((String) _context.getVariable("var:methodNameKey")));
    return SLinkOperations.getTarget(_context.getOutputNodeByInputNodeAndMappingLabel(firstOp, "IsEmptyExtractExpr"), LINKS.method$yoGN);
  }
  public static boolean ifMacro_Condition_0_0(final IfMacroContext _context) {
    if (_context.getSessionObject(((String) _context.getVariable("var:methodNameKey"))) == null) {
      _context.putSessionObject(((String) _context.getVariable("var:methodNameKey")), _context.getNode());
      return true;
    }
    return false;
  }
  public static boolean ifMacro_Condition_4_0(final IfMacroContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.startIndex$vALN) != null;
  }
  public static boolean ifMacro_Condition_9_0(final IfMacroContext _context) {
    return ListSequence.fromList(SModelOperations.nodes(_context.getInputModel(), CONCEPTS.TrimOperation$$f)).any((it) -> SEnumOperations.isMember(SPropertyOperations.getEnum(it, PROPS.trimKind$5DDk), 0x11d47df9508L));
  }
  public static boolean ifMacro_Condition_9_1(final IfMacroContext _context) {
    return ListSequence.fromList(SModelOperations.nodes(_context.getInputModel(), CONCEPTS.TrimOperation$$f)).any((it) -> SEnumOperations.isMember(SPropertyOperations.getEnum(it, PROPS.trimKind$5DDk), 0x11d47df9509L));
  }
  public static boolean ifMacro_Condition_9_2(final IfMacroContext _context) {
    return !(SModelOperations.nodes(_context.getInputModel(), CONCEPTS.SubstringExpression$uY).isEmpty());
  }
  public static boolean ifMacro_Condition_9_3(final IfMacroContext _context) {
    return !(SModelOperations.nodes(_context.getInputModel(), CONCEPTS.SubstringExpression$uY).isEmpty());
  }
  public static boolean ifMacro_Condition_11_0(final IfMacroContext _context) {
    if (_context.getSessionObject(((String) _context.getVariable("var:methodNameKey"))) == null) {
      _context.putSessionObject(((String) _context.getVariable("var:methodNameKey")), _context.getNode());
      return true;
    }
    return false;
  }
  public static SNode sourceNodeQuery_0_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_0_1(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_1_0(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.leftExpression$sEj);
  }
  public static SNode sourceNodeQuery_1_1(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.rightExpression$nvX);
  }
  public static SNode sourceNodeQuery_2_0(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.leftExpression$sEj);
  }
  public static SNode sourceNodeQuery_2_1(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.rightExpression$nvX);
  }
  public static SNode sourceNodeQuery_4_0(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.operand$vAyM);
  }
  public static SNode sourceNodeQuery_4_1(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.startIndex$vALN);
  }
  public static SNode sourceNodeQuery_4_2(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.endIndex$vB0O);
  }
  public static SNode sourceNodeQuery_5_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_6_0(final SourceSubstituteMacroNodeContext _context) {
    return SLinkOperations.getTarget(_context.getNode(), LINKS.operation$gs9E);
  }
  public static SNode sourceNodeQuery_6_1(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_6_2(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_6_3(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_6_4(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_6_5(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_6_6(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_7_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_8_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_10_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_11_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_11_1(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static SNode sourceNodeQuery_12_0(final SourceSubstituteMacroNodeContext _context) {
    return (SNode) IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(_context.getNode());
  }
  public static Iterable<SNode> sourceNodesQuery_12_0(final SourceSubstituteMacroNodesContext _context) {
    return SLinkOperations.getChildren(_context.getNode(), LINKS.arguments$3huj);
  }
  public static Object varMacro_Value_0_0(final TemplateVarContext _context) {
    return INamedConcept__BehaviorDescriptor.getFqName_idhEwIO9y.invoke(ListSequence.fromList(SNodeOperations.getNodeAncestors(_context.getNode(), CONCEPTS.ClassConcept$bK, false)).where((it) -> (boolean) IClassifierMember__BehaviorDescriptor.isStatic_id6r77ob2USS8.invoke(it)).first()) + ".IsNotEmptyStringMethod";
  }
  public static Object varMacro_Value_11_0(final TemplateVarContext _context) {
    // ExtractStaticMethodExpression looks for first non static class
    // and as long as there's no alternative to ESME, this code shall
    // respect the way ContextUtil.getContextForMethod works
    return INamedConcept__BehaviorDescriptor.getFqName_idhEwIO9y.invoke(ListSequence.fromList(SNodeOperations.getNodeAncestors(_context.getNode(), CONCEPTS.ClassConcept$bK, false)).where((it) -> (boolean) IClassifierMember__BehaviorDescriptor.isStatic_id6r77ob2USS8.invoke(it)).first()) + ".IsEmptyStringMethod";
  }
  private final Map<String, ReductionRuleCondition> rrcMethods = new HashMap<String, ReductionRuleCondition>();
  {
    int i = 0;
    rrcMethods.put("1225277059819", new RRC(i++));
    rrcMethods.put("1225277059838", new RRC(i++));
    rrcMethods.put("4592826945243768925", new RRC(i++));
    rrcMethods.put("1225277059840", new RRC(i++));
    rrcMethods.put("4592826945243771511", new RRC(i++));
  }
  @Override
  @NotNull
  public ReductionRuleCondition getReductionRuleCondition(@NotNull QueryKey identity) {
    ReductionRuleCondition query = identity.forTemplateNode(rrcMethods);
    return (query != null ? query : super.getReductionRuleCondition(identity));
  }
  private static class RRC implements ReductionRuleCondition {
    private final int methodKey;
    public RRC(int methodKey) {
      this.methodKey = methodKey;
    }
    @Override
    public boolean check(ReductionRuleQueryContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.rule_Condition_6_0(ctx);
        case 1:
          return QueriesGenerated.rule_Condition_6_1(ctx);
        case 2:
          return QueriesGenerated.rule_Condition_6_2(ctx);
        case 3:
          return QueriesGenerated.rule_Condition_6_3(ctx);
        case 4:
          return QueriesGenerated.rule_Condition_6_4(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for rule %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, CreateRootCondition> crcMethods = new HashMap<String, CreateRootCondition>();
  {
    int i = 0;
    crcMethods.put("2696770507970454879", new CRC(i++));
  }
  @Override
  @NotNull
  public CreateRootCondition getCreateRootRuleCondition(@NotNull QueryKey identity) {
    CreateRootCondition query = identity.forTemplateNode(crcMethods);
    return (query != null ? query : super.getCreateRootRuleCondition(identity));
  }
  private static class CRC implements CreateRootCondition {
    private final int methodKey;
    public CRC(int methodKey) {
      this.methodKey = methodKey;
    }
    @Override
    public boolean check(@NotNull CreateRootRuleContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.createRootRule_Condition_6_0(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for rule %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, SourceNodeQuery> snqMethods = new HashMap<String, SourceNodeQuery>();
  {
    int i = 0;
    snqMethods.put("4592826945244850127", new SNQ(i++));
    snqMethods.put("1482495884796567805", new SNQ(i++));
    snqMethods.put("1750438968355682278", new SNQ(i++));
    snqMethods.put("1750438968355682703", new SNQ(i++));
    snqMethods.put("1750438968355684573", new SNQ(i++));
    snqMethods.put("1750438968355683333", new SNQ(i++));
    snqMethods.put("3987319776542716744", new SNQ(i++));
    snqMethods.put("3987319776542716779", new SNQ(i++));
    snqMethods.put("3987319776542716787", new SNQ(i++));
    snqMethods.put("4592826945244850162", new SNQ(i++));
    snqMethods.put("1225277059823", new SNQ(i++));
    snqMethods.put("4592826945243769794", new SNQ(i++));
    snqMethods.put("4592826945243769762", new SNQ(i++));
    snqMethods.put("4592826945243771561", new SNQ(i++));
    snqMethods.put("4592826945243771596", new SNQ(i++));
    snqMethods.put("4592826945243770430", new SNQ(i++));
    snqMethods.put("4592826945243770434", new SNQ(i++));
    snqMethods.put("1461424660015435939", new SNQ(i++));
    snqMethods.put("2696770507970538121", new SNQ(i++));
    snqMethods.put("2696770507970463573", new SNQ(i++));
    snqMethods.put("4592826945244850077", new SNQ(i++));
    snqMethods.put("3505562578125797802", new SNQ(i++));
    snqMethods.put("7485977462274913539", new SNQ(i++));
  }
  @NotNull
  @Override
  public SourceNodeQuery getSourceNodeQuery(@NotNull QueryKey identity) {
    SourceNodeQuery query = identity.forFunctionNode(snqMethods);
    return (query != null ? query : super.getSourceNodeQuery(identity));
  }
  private static class SNQ implements SourceNodeQuery {
    private final int methodKey;
    public SNQ(int methodKey) {
      this.methodKey = methodKey;
    }
    @Nullable
    public SNode evaluate(@NotNull SourceSubstituteMacroNodeContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.sourceNodeQuery_0_0(ctx);
        case 1:
          return QueriesGenerated.sourceNodeQuery_0_1(ctx);
        case 2:
          return QueriesGenerated.sourceNodeQuery_1_0(ctx);
        case 3:
          return QueriesGenerated.sourceNodeQuery_1_1(ctx);
        case 4:
          return QueriesGenerated.sourceNodeQuery_2_0(ctx);
        case 5:
          return QueriesGenerated.sourceNodeQuery_2_1(ctx);
        case 6:
          return QueriesGenerated.sourceNodeQuery_4_0(ctx);
        case 7:
          return QueriesGenerated.sourceNodeQuery_4_1(ctx);
        case 8:
          return QueriesGenerated.sourceNodeQuery_4_2(ctx);
        case 9:
          return QueriesGenerated.sourceNodeQuery_5_0(ctx);
        case 10:
          return QueriesGenerated.sourceNodeQuery_6_0(ctx);
        case 11:
          return QueriesGenerated.sourceNodeQuery_6_1(ctx);
        case 12:
          return QueriesGenerated.sourceNodeQuery_6_2(ctx);
        case 13:
          return QueriesGenerated.sourceNodeQuery_6_3(ctx);
        case 14:
          return QueriesGenerated.sourceNodeQuery_6_4(ctx);
        case 15:
          return QueriesGenerated.sourceNodeQuery_6_5(ctx);
        case 16:
          return QueriesGenerated.sourceNodeQuery_6_6(ctx);
        case 17:
          return QueriesGenerated.sourceNodeQuery_7_0(ctx);
        case 18:
          return QueriesGenerated.sourceNodeQuery_8_0(ctx);
        case 19:
          return QueriesGenerated.sourceNodeQuery_10_0(ctx);
        case 20:
          return QueriesGenerated.sourceNodeQuery_11_0(ctx);
        case 21:
          return QueriesGenerated.sourceNodeQuery_11_1(ctx);
        case 22:
          return QueriesGenerated.sourceNodeQuery_12_0(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, SourceNodesQuery> snsqMethods = new HashMap<String, SourceNodesQuery>();
  {
    int i = 0;
    snsqMethods.put("7485977462274915658", new SNsQ(i++));
  }
  @NotNull
  @Override
  public SourceNodesQuery getSourceNodesQuery(@NotNull QueryKey identity) {
    SourceNodesQuery query = identity.forFunctionNode(snsqMethods);
    return (query != null ? query : super.getSourceNodesQuery(identity));
  }
  private static class SNsQ implements SourceNodesQuery {
    private final int methodKey;
    public SNsQ(int methodKey) {
      this.methodKey = methodKey;
    }
    @NotNull
    public Collection<SNode> evaluate(@NotNull SourceSubstituteMacroNodesContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_12_0(ctx));
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, PropertyValueQuery> pvqMethods = new HashMap<String, PropertyValueQuery>();
  {
    int i = 0;
    pvqMethods.put("3987319776542716752", new PVQ(i++, MetaAdapterFactory.getProperty(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x1115749abe3L, 0x1115767a8eeL, "fqClassName"), "StringUtils"));
    pvqMethods.put("4592826945245316728", new PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "trim"));
    pvqMethods.put("2696770507970538130", new PVQ(i++, MetaAdapterFactory.getProperty(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x1115749abe3L, 0x1115767a8eeL, "fqClassName"), "StringUtils"));
    pvqMethods.put("2696770507970471605", new PVQ(i++, MetaAdapterFactory.getProperty(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x1115749abe3L, 0x1115767a8eeL, "fqClassName"), "StringUtils"));
  }
  @NotNull
  @Override
  public PropertyValueQuery getPropertyValueQuery(@NotNull QueryKey identity) {
    PropertyValueQuery query = identity.forTemplateNode(pvqMethods);
    return (query != null ? query : super.getPropertyValueQuery(identity));
  }
  private static class PVQ extends PropertyValueQuery.Base {
    private final int methodKey;
    /*package*/ PVQ(int methodKey, SProperty property, String templateValue) {
      super(property, templateValue);
      this.methodKey = methodKey;
    }
    @Nullable
    public Object evaluate(@NotNull PropertyMacroContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.propertyMacro_GetValue_4_0(ctx);
        case 1:
          return QueriesGenerated.propertyMacro_GetValue_5_0(ctx);
        case 2:
          return QueriesGenerated.propertyMacro_GetValue_8_0(ctx);
        case 3:
          return QueriesGenerated.propertyMacro_GetValue_10_0(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, IfMacroCondition> imcMethods = new HashMap<String, IfMacroCondition>();
  {
    int i = 0;
    imcMethods.put("6269300764715607366", new IfMC(i++));
    imcMethods.put("3987319776542716767", new IfMC(i++));
    imcMethods.put("4592826945243771478", new IfMC(i++));
    imcMethods.put("4592826945243771380", new IfMC(i++));
    imcMethods.put("4592826945243769898", new IfMC(i++));
    imcMethods.put("4592826945243769922", new IfMC(i++));
    imcMethods.put("6269300764714516438", new IfMC(i++));
  }
  @NotNull
  @Override
  public IfMacroCondition getIfMacroCondition(@NotNull QueryKey identity) {
    IfMacroCondition query = identity.forTemplateNode(imcMethods);
    return (query != null ? query : super.getIfMacroCondition(identity));
  }
  private static class IfMC implements IfMacroCondition {
    private final int methodKey;
    public IfMC(int methodKey) {
      this.methodKey = methodKey;
    }
    @Override
    public boolean check(@NotNull IfMacroContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.ifMacro_Condition_0_0(ctx);
        case 1:
          return QueriesGenerated.ifMacro_Condition_4_0(ctx);
        case 2:
          return QueriesGenerated.ifMacro_Condition_9_0(ctx);
        case 3:
          return QueriesGenerated.ifMacro_Condition_9_1(ctx);
        case 4:
          return QueriesGenerated.ifMacro_Condition_9_2(ctx);
        case 5:
          return QueriesGenerated.ifMacro_Condition_9_3(ctx);
        case 6:
          return QueriesGenerated.ifMacro_Condition_11_0(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for if macro %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, InlineSwitchCaseCondition> isccMethods = new HashMap<String, InlineSwitchCaseCondition>();
  {
    int i = 0;
    isccMethods.put("1225277059845", new ISCC(i++));
    isccMethods.put("1225277059856", new ISCC(i++));
    isccMethods.put("4592826945243770284", new ISCC(i++));
  }
  @NotNull
  @Override
  public InlineSwitchCaseCondition getInlineSwitchCaseCondition(@NotNull QueryKey identity) {
    InlineSwitchCaseCondition query = identity.forTemplateNode(isccMethods);
    return (query != null ? query : super.getInlineSwitchCaseCondition(identity));
  }
  private static class ISCC implements InlineSwitchCaseCondition {
    private final int methodKey;
    public ISCC(int methodKey) {
      this.methodKey = methodKey;
    }
    @Override
    public boolean check(@NotNull InlineSwitchCaseContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.rule_Condition_6_5(ctx);
        case 1:
          return QueriesGenerated.rule_Condition_6_6(ctx);
        case 2:
          return QueriesGenerated.rule_Condition_6_7(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for inline switch's case %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, ReferenceTargetQuery> rtqMethods = new HashMap<String, ReferenceTargetQuery>();
  {
    rtqMethods.put("1482495884796568566", new RTQ(0, "isNotEmptyString"));
    rtqMethods.put("1482495884796522425", new RTQ(1, "isEmptyString"));
  }
  @NotNull
  @Override
  public ReferenceTargetQuery getReferenceTargetQuery(@NotNull QueryKey queryKey) {
    ReferenceTargetQuery query = queryKey.forTemplateNode(rtqMethods);
    return (query != null ? query : super.getReferenceTargetQuery(queryKey));
  }
  private static class RTQ extends ReferenceTargetQuery.Base {
    private final int methodKey;
    /*package*/ RTQ(int methodKey, String templateValue) {
      super(templateValue);
      this.methodKey = methodKey;
    }
    @Nullable
    public Object evaluate(@NotNull ReferenceMacroContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.referenceMacro_GetReferent_0_0(ctx);
        case 1:
          return QueriesGenerated.referenceMacro_GetReferent_11_0(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }
  private final Map<String, VariableValueQuery> vvqMethods = new HashMap<String, VariableValueQuery>();
  {
    vvqMethods.put("2409421742521898462", new VVQ(0));
    vvqMethods.put("2409421742521898467", new VVQ(1));
  }
  @NotNull
  @Override
  public VariableValueQuery getVariableValueQuery(@NotNull QueryKey queryKey) {
    VariableValueQuery query = queryKey.forTemplateNode(vvqMethods);
    return (query != null ? query : super.getVariableValueQuery(queryKey));
  }
  private static class VVQ implements VariableValueQuery {
    private final int methodKey;
    /*package*/ VVQ(int methodKey) {
      this.methodKey = methodKey;
    }
    @Nullable
    public Object evaluate(@NotNull TemplateVarContext ctx) throws GenerationFailureException {
      switch (methodKey) {
        case 0:
          return QueriesGenerated.varMacro_Value_0_0(ctx);
        case 1:
          return QueriesGenerated.varMacro_Value_11_0(ctx);
        default:
          throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
      }
    }
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept SubstringExpression$uY = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47df21f3L, "jetbrains.mps.baseLanguage.structure.SubstringExpression");
    /*package*/ static final SConcept TrimOperation$$f = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47e0122aL, "jetbrains.mps.baseLanguage.structure.TrimOperation");
    /*package*/ static final SConcept BaseStringOperation$Ae = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47dc8da1L, "jetbrains.mps.baseLanguage.structure.BaseStringOperation");
    /*package*/ static final SInterfaceConcept IVariableReference$C = MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xe34de34746464f2L, "jetbrains.mps.baseLanguage.structure.IVariableReference");
    /*package*/ static final SConcept ClassConcept$bK = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca66L, "jetbrains.mps.baseLanguage.structure.ClassConcept");
  }

  private static final class PROPS {
    /*package*/ static final SProperty trimKind$5DDk = MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47e0122aL, 0x11d47e0122dL, "trimKind");
  }

  private static final class LINKS {
    /*package*/ static final SContainmentLink operation$gs9E = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation");
    /*package*/ static final SContainmentLink method$yoGN = MetaAdapterFactory.getContainmentLink(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x31c3f88088ea0ac4L, 0x31c3f88088ea0ac6L, "method");
    /*package*/ static final SContainmentLink startIndex$vALN = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47df21f3L, 0x11d47df21f5L, "startIndex");
    /*package*/ static final SContainmentLink leftExpression$sEj = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression");
    /*package*/ static final SContainmentLink rightExpression$nvX = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression");
    /*package*/ static final SContainmentLink operand$vAyM = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47df21f3L, 0x11d47df21f4L, "operand");
    /*package*/ static final SContainmentLink endIndex$vB0O = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11d47df21f3L, 0x11d47df21f6L, "endIndex");
    /*package*/ static final SContainmentLink arguments$3huj = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x67e388d6eb788475L, 0x67e388d6eb788650L, "arguments");
  }
}
