package jetbrains.mps.baseLanguage.checkedDots.generator.template.main; /*Generated by MPS */ import jetbrains.mps.generator.runtime.Generated; import jetbrains.mps.generator.impl.query.QueryProviderBase; 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.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.baseLanguage.checkedDots.generator.referenceUtils.ReferenceConversionHelper; import jetbrains.mps.generator.template.PropertyMacroContext; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.baseLanguage.behavior.IVariableReference__BehaviorDescriptor; import jetbrains.mps.generator.template.ReferenceMacroContext; import jetbrains.mps.generator.template.IfMacroContext; import jetbrains.mps.typesystem.inference.TypeChecker; import jetbrains.mps.baseLanguage.checkedDots.behavior.CheckedDotExpression__BehaviorDescriptor; import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext; import jetbrains.mps.lang.typesystem.runtime.HUtil; import jetbrains.mps.baseLanguage.behavior.Classifier__BehaviorDescriptor; import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext; import jetbrains.mps.internal.collections.runtime.ISelector; import jetbrains.mps.internal.collections.runtime.IVisitor; import java.util.List; import jetbrains.mps.internal.collections.runtime.ListSequence; import java.util.ArrayList; import java.util.Iterator; import jetbrains.mps.internal.collections.runtime.IWhereFilter; import jetbrains.mps.generator.template.MapSrcMacroContext; import jetbrains.mps.generator.template.TemplateQueryContext; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations; 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.MapConfigurationCondition; import jetbrains.mps.generator.impl.query.SourceNodeQuery; import jetbrains.mps.generator.impl.query.QueryKeyImpl; 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 org.jetbrains.mps.openapi.language.SProperty; import jetbrains.mps.generator.impl.query.IfMacroCondition; import jetbrains.mps.generator.impl.query.ReferenceTargetQuery; import jetbrains.mps.generator.impl.query.MapNodeQuery; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; @Generated public class QueriesGenerated extends QueryProviderBase { public QueriesGenerated() { super(1); } public static boolean baseMappingRule_Condition_2319519288049917875(final BaseMappingRuleContext _context) { if (!(SNodeOperations.isInstanceOf(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration")), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b21dL, "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration")))) { return false; } SNode checkedDot = SNodeOperations.getNodeAncestor(_context.getNode(), MetaAdapterFactory.getConcept(0x774bf8a062e541e1L, 0xaf63f4812e60e48bL, 0x389ce13592c3023bL, "jetbrains.mps.baseLanguage.checkedDots.structure.CheckedDotExpression"), false, false); return checkedDot != null && SLinkOperations.getTarget(checkedDot, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")) != null && jetbrains.mps.util.SNodeOperations.isAncestor(SLinkOperations.getTarget(checkedDot, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")), _context.getNode()); } public static boolean baseMappingRule_Condition_3905905920761714586(final BaseMappingRuleContext _context) { SNode checkedDot = SNodeOperations.getNodeAncestor(_context.getNode(), MetaAdapterFactory.getConcept(0x774bf8a062e541e1L, 0xaf63f4812e60e48bL, 0x389ce13592c3023bL, "jetbrains.mps.baseLanguage.checkedDots.structure.CheckedDotExpression"), false, false); return checkedDot != null && SLinkOperations.getTarget(checkedDot, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")) != null && jetbrains.mps.util.SNodeOperations.isAncestor(SLinkOperations.getTarget(checkedDot, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")), _context.getNode()); } public static boolean baseMappingRule_Condition_4726684212252844941(final BaseMappingRuleContext _context) { if (!(SNodeOperations.isInstanceOf(_context.getNode(), MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xe34de34746464f2L, "jetbrains.mps.baseLanguage.structure.IVariableReference")))) { return false; } SNode checkedDot = SNodeOperations.getNodeAncestor(_context.getNode(), MetaAdapterFactory.getConcept(0x774bf8a062e541e1L, 0xaf63f4812e60e48bL, 0x389ce13592c3023bL, "jetbrains.mps.baseLanguage.checkedDots.structure.CheckedDotExpression"), false, false); return checkedDot != null && SLinkOperations.getTarget(checkedDot, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")) != null && jetbrains.mps.util.SNodeOperations.isAncestor(SLinkOperations.getTarget(checkedDot, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")), _context.getNode()) && Sequence.fromIterable(ReferenceConversionHelper.retrieveDescendentRefs(checkedDot)).contains(_context.getNode()); } public static Object propertyMacro_GetPropertyValue_4549711462050029098(final PropertyMacroContext _context) { return _context.createUniqueName("check", _context.getNode()); } public static Object propertyMacro_GetPropertyValue_3391577739833458953(final PropertyMacroContext _context) { if (_context.getNode().getUserObject("needsUniqueName") != null) { return _context.createUniqueName(SPropertyOperations.getString(IVariableReference__BehaviorDescriptor.getVariable_idSORzhOpB6t.invoke(_context.getNode()), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")), SNodeOperations.getNodeAncestor(_context.getNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b1fcL, "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration"), false, false)); } else { return SPropertyOperations.getString(IVariableReference__BehaviorDescriptor.getVariable_idSORzhOpB6t.invoke(_context.getNode()), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")); } } public static Object referenceMacro_GetReferent_5665267283159127972(final ReferenceMacroContext _context) { return SLinkOperations.getTarget(SNodeOperations.cast(_context.getNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier")); } public static Object referenceMacro_GetReferent_2319519288049960746(final ReferenceMacroContext _context) { return SNodeOperations.cast(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration")), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b21dL, "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration")); } public static Object referenceMacro_GetReferent_4726684212252404117(final ReferenceMacroContext _context) { return _context.getOutputNodeByInputNodeAndMappingLabel(_context.getNode(), "thisLabel"); } public static boolean ifMacro_Condition_53796356308815904(final IfMacroContext _context) { return !(SNodeOperations.isInstanceOf(TypeChecker.getInstance().getTypeOf(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"))), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc6bf96dL, "jetbrains.mps.baseLanguage.structure.VoidType"))); } public static boolean ifMacro_Condition_3674434577577159998(final IfMacroContext _context) { return (boolean) CheckedDotExpression__BehaviorDescriptor.hasLocalContextInside_id3bYdGv2TyNM.invoke(_context.getNode()); } public static boolean ifMacro_Condition_131924539844672792(final IfMacroContext _context) { return (boolean) CheckedDotExpression__BehaviorDescriptor.hasLocalContextInside_id3bYdGv2TyNM.invoke(_context.getNode()); } public static boolean ifMacro_Condition_3674434577577160639(final IfMacroContext _context) { return (boolean) CheckedDotExpression__BehaviorDescriptor.hasLocalContextInside_id3bYdGv2TyNM.invoke(_context.getNode()); } public static SNode sourceNodeQuery_4726684212252007392(final SourceSubstituteMacroNodeContext _context) { return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")); } public static SNode sourceNodeQuery_4726684212252031228(final SourceSubstituteMacroNodeContext _context) { SNode operation = SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")); return operation; } public static SNode sourceNodeQuery_53796356308780436(final SourceSubstituteMacroNodeContext _context) { return TypeChecker.getInstance().getTypeOf(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"))); } public static SNode sourceNodeQuery_5227621747122194587(final SourceSubstituteMacroNodeContext _context) { SNode operationType = TypeChecker.getInstance().getTypeOf(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"))); if (SNodeOperations.isInstanceOf(operationType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10f0ad8bde4L, "jetbrains.mps.baseLanguage.structure.PrimitiveType"))) { // I don't want void return type to become java.lang.Void, nor do I need extra boxing for boolean/int values // I don't do the same for method arguments, however, as expect a lot of primitives as operand or variable references. return operationType; } if (SNodeOperations.isInstanceOf(operationType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940d819f7L, "jetbrains.mps.baseLanguage.structure.ArrayType"))) { // coerce(AnAction[] as ClassifierType) gives Serializable. // This gonna fail once we face array of smth that is not ClassifierType (e.g. concept<>[]) // and our only hope is that proper generator shows up afterwards. return operationType; } return TypeChecker.getInstance().getRuntimeSupport().coerce_(operationType, HUtil.createMatchingPatternByConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")), true); } public static SNode sourceNodeQuery_7907427828436736378(final SourceSubstituteMacroNodeContext _context) { SNode operandType = TypeChecker.getInstance().getTypeOf(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46a4416L, "operand"))); if (SNodeOperations.isInstanceOf(operandType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940d819f7L, "jetbrains.mps.baseLanguage.structure.ArrayType"))) { // see similar code and corresponding comment of return value return operandType; } SNode result = TypeChecker.getInstance().getRuntimeSupport().coerce_(operandType, HUtil.createMatchingPatternByConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")), true); if (result == null) { result = operandType; } return result; } public static SNode sourceNodeQuery_1392486827343609139(final SourceSubstituteMacroNodeContext _context) { SNode nodeType = TypeChecker.getInstance().getTypeOf(_context.getNode()); if (SNodeOperations.isInstanceOf(nodeType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf940d819f7L, "jetbrains.mps.baseLanguage.structure.ArrayType"))) { // see similar code and corresponding comment of return value return nodeType; } return TypeChecker.getInstance().getRuntimeSupport().coerce_(nodeType, HUtil.createMatchingPatternByConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")), true); } public static SNode sourceNodeQuery_2319519288049976964(final SourceSubstituteMacroNodeContext _context) { return (SNode) Classifier__BehaviorDescriptor.getThisType_id2RtWPFZ12w7.invoke(SNodeOperations.getNodeAncestor(_context.getNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101d9d3ca30L, "jetbrains.mps.baseLanguage.structure.Classifier"), false, false)); } public static SNode sourceNodeQuery_7907427828436735258(final SourceSubstituteMacroNodeContext _context) { return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46a4416L, "operand")); } public static SNode sourceNodeQuery_3674434577577160632(final SourceSubstituteMacroNodeContext _context) { return _quotation_createNode_x583g4_a0a12(); } public static Iterable<SNode> sourceNodesQuery_629557350449693433(final SourceSubstituteMacroNodesContext _context) { Iterable<SNode> refs = ReferenceConversionHelper.retrieveDescendentRefs(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"))); if (Sequence.fromIterable(refs).select(new ISelector<SNode, String>() { public String select(SNode it) { return SPropertyOperations.getString(IVariableReference__BehaviorDescriptor.getVariable_idSORzhOpB6t.invoke(it), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")); } }).distinct().count() != Sequence.fromIterable(refs).count()) { Sequence.fromIterable(refs).visitAll(new IVisitor<SNode>() { public void visit(SNode it) { it.putUserObject("needsUniqueName", true); } }); } return refs; } public static Iterable<SNode> sourceNodesQuery_5837079428841717746(final SourceSubstituteMacroNodesContext _context) { Iterable<SNode> callsToConsider = ReferenceConversionHelper.retrieveDescendentMethodCalls(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"))); final List<SNode> throwns = ListSequence.fromList(new ArrayList<SNode>()); Sequence.fromIterable(callsToConsider).visitAll(new IVisitor<SNode>() { public void visit(SNode call) { SNode declaration; declaration = SLinkOperations.getTarget(call, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration")); ListSequence.fromList(throwns).addSequence(ListSequence.fromList(SLinkOperations.getChildren(declaration, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b1fcL, 0x10f383d6949L, "throwsItem")))); } }); List<SNode> result = ListSequence.fromList(new ArrayList<SNode>()); Iterator<SNode> iter = ListSequence.fromList(throwns).iterator(); while (iter.hasNext()) { final SNode next = iter.next(); if (SNodeOperations.isInstanceOf(next, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")) && ListSequence.fromList(result).all(new IWhereFilter<SNode>() { public boolean accept(SNode it) { return neq_x583g4_a0a0a0a0a0a1a7a32(SLinkOperations.getTarget(it, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier")), SLinkOperations.getTarget(SNodeOperations.cast(next, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"))); } })) { ListSequence.fromList(result).addElement(SNodeOperations.cast(next, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType"))); } } return result; } public static Iterable<SNode> sourceNodesQuery_131924539844672796(final SourceSubstituteMacroNodesContext _context) { return SLinkOperations.getChildren(SNodeOperations.getNodeAncestor(_context.getNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101d9d3ca30L, "jetbrains.mps.baseLanguage.structure.Classifier"), false, false), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102463b447aL, 0x102463bb98eL, "typeVariableDeclaration")); } public static Iterable<SNode> sourceNodesQuery_4726684212254314052(final SourceSubstituteMacroNodesContext _context) { return ReferenceConversionHelper.retrieveDescendentRefs(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation"))); } public static Iterable<SNode> sourceNodesQuery_4741735385321357379(final SourceSubstituteMacroNodesContext _context) { return SLinkOperations.getChildren(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301aeL, "actualArgument")); } public static SNode mapSrcMacro_mapper_4726684212254393902(final MapSrcMacroContext _context) { return _context.getNode(); } public static boolean mappingConfiguration_Condition_6450631649356367178(final TemplateQueryContext _context) { return !(SModelOperations.nodes(_context.getInputModel(), MetaAdapterFactory.getConcept(0x774bf8a062e541e1L, 0xaf63f4812e60e48bL, 0x389ce13592c3023bL, "jetbrains.mps.baseLanguage.checkedDots.structure.CheckedDotExpression")).isEmpty()); } private final Map<String, ReductionRuleCondition> rrcMethods = new HashMap<String, ReductionRuleCondition>(); { int i = 0; rrcMethods.put("2319519288049914743", new QueriesGenerated.RRC(i++)); rrcMethods.put("3905905920761714584", new QueriesGenerated.RRC(i++)); rrcMethods.put("4726684212252397593", new QueriesGenerated.RRC(i++)); } @Override @NotNull public ReductionRuleCondition getReductionRuleCondition(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(rrcMethods.containsKey(id))) { return super.getReductionRuleCondition(identity); } return rrcMethods.get(id); } 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.baseMappingRule_Condition_2319519288049917875(ctx); case 1: return QueriesGenerated.baseMappingRule_Condition_3905905920761714586(ctx); case 2: return QueriesGenerated.baseMappingRule_Condition_4726684212252844941(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, MapConfigurationCondition> mccMethods = new HashMap<String, MapConfigurationCondition>(); { int i = 0; mccMethods.put("4549711462050000012", new QueriesGenerated.MCC(i++)); } @Override @NotNull public MapConfigurationCondition getMapConfigurationCondition(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(mccMethods.containsKey(id))) { return super.getMapConfigurationCondition(identity); } return mccMethods.get(id); } private static class MCC implements MapConfigurationCondition { private final int methodKey; public MCC(int methodKey) { this.methodKey = methodKey; } @Override public boolean check(TemplateQueryContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.mappingConfiguration_Condition_6450631649356367178(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for map configuration %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private final Map<String, SourceNodeQuery> snqMethods = new HashMap<String, SourceNodeQuery>(); { int i = 0; snqMethods.put("4726684212252007392", new QueriesGenerated.SNQ(i++)); snqMethods.put("4726684212252031228", new QueriesGenerated.SNQ(i++)); snqMethods.put("53796356308780436", new QueriesGenerated.SNQ(i++)); snqMethods.put("5227621747122194587", new QueriesGenerated.SNQ(i++)); snqMethods.put("7907427828436736378", new QueriesGenerated.SNQ(i++)); snqMethods.put("1392486827343609139", new QueriesGenerated.SNQ(i++)); snqMethods.put("2319519288049976964", new QueriesGenerated.SNQ(i++)); snqMethods.put("7907427828436735258", new QueriesGenerated.SNQ(i++)); snqMethods.put("3674434577577160632", new QueriesGenerated.SNQ(i++)); } @NotNull @Override public SourceNodeQuery getSourceNodeQuery(@NotNull QueryKey identity) { final String id = ((QueryKeyImpl) identity).getQueryNodeId().toString(); if (!(snqMethods.containsKey(id))) { return super.getSourceNodeQuery(identity); } return snqMethods.get(id); } 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_4726684212252007392(ctx); case 1: return QueriesGenerated.sourceNodeQuery_4726684212252031228(ctx); case 2: return QueriesGenerated.sourceNodeQuery_53796356308780436(ctx); case 3: return QueriesGenerated.sourceNodeQuery_5227621747122194587(ctx); case 4: return QueriesGenerated.sourceNodeQuery_7907427828436736378(ctx); case 5: return QueriesGenerated.sourceNodeQuery_1392486827343609139(ctx); case 6: return QueriesGenerated.sourceNodeQuery_2319519288049976964(ctx); case 7: return QueriesGenerated.sourceNodeQuery_7907427828436735258(ctx); case 8: return QueriesGenerated.sourceNodeQuery_3674434577577160632(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("629557350449693433", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("5837079428841717746", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("131924539844672796", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("4726684212254314052", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("4741735385321357379", new QueriesGenerated.SNsQ(i++)); } @NotNull @Override public SourceNodesQuery getSourceNodesQuery(@NotNull QueryKey identity) { final String id = ((QueryKeyImpl) identity).getQueryNodeId().toString(); if (!(snsqMethods.containsKey(id))) { return super.getSourceNodesQuery(identity); } return snsqMethods.get(id); } 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_629557350449693433(ctx)); case 1: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_5837079428841717746(ctx)); case 2: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_131924539844672796(ctx)); case 3: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_4726684212254314052(ctx)); case 4: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_4741735385321357379(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("4549711462050029097", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "check")); pvqMethods.put("3391577739833458952", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "a")); } @NotNull @Override public PropertyValueQuery getPropertyValueQuery(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(pvqMethods.containsKey(id))) { return super.getPropertyValueQuery(identity); } return pvqMethods.get(id); } 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_GetPropertyValue_4549711462050029098(ctx); case 1: return QueriesGenerated.propertyMacro_GetPropertyValue_3391577739833458953(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("53796356308815903", new QueriesGenerated.IfMC(i++)); imcMethods.put("3674434577577159997", new QueriesGenerated.IfMC(i++)); imcMethods.put("131924539844672791", new QueriesGenerated.IfMC(i++)); imcMethods.put("3674434577577160638", new QueriesGenerated.IfMC(i++)); } @NotNull @Override public IfMacroCondition getIfMacroCondition(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(imcMethods.containsKey(id))) { return super.getIfMacroCondition(identity); } return imcMethods.get(id); } 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_53796356308815904(ctx); case 1: return QueriesGenerated.ifMacro_Condition_3674434577577159998(ctx); case 2: return QueriesGenerated.ifMacro_Condition_131924539844672792(ctx); case 3: return QueriesGenerated.ifMacro_Condition_3674434577577160639(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, ReferenceTargetQuery> rtqMethods = new HashMap<String, ReferenceTargetQuery>(); { rtqMethods.put("5665267283159127971", new QueriesGenerated.RTQ(0, "Exception")); rtqMethods.put("2319519288049960743", new QueriesGenerated.RTQ(1, "charAt")); rtqMethods.put("4726684212252404116", new QueriesGenerated.RTQ(2, "p")); } @NotNull @Override public ReferenceTargetQuery getReferenceTargetQuery(@NotNull QueryKey queryKey) { final String id = queryKey.getTemplateNode().getNodeId().toString(); if (!(rtqMethods.containsKey(id))) { return super.getReferenceTargetQuery(queryKey); } return rtqMethods.get(id); } 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_5665267283159127972(ctx); case 1: return QueriesGenerated.referenceMacro_GetReferent_2319519288049960746(ctx); case 2: return QueriesGenerated.referenceMacro_GetReferent_4726684212252404117(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, MapNodeQuery> mnqMethods = new HashMap<String, MapNodeQuery>(); { mnqMethods.put("4726684212254314050", new QueriesGenerated.MNQ(0)); } @NotNull @Override public MapNodeQuery getMapNodeQuery(@NotNull QueryKey queryKey) { final String id = queryKey.getTemplateNode().getNodeId().toString(); if (!(mnqMethods.containsKey(id))) { return super.getMapNodeQuery(queryKey); } return mnqMethods.get(id); } private static class MNQ implements MapNodeQuery { private final int methodKey; /*package*/ MNQ(int methodKey) { this.methodKey = methodKey; } @Nullable public SNode evaluate(@NotNull MapSrcMacroContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.mapSrcMacro_mapper_4726684212254393902(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private static SNode _quotation_createNode_x583g4_a0a12() { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_1 = null; quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf93d4da00cL, "ThisExpression"), null, null, false); return quotedNode_1; } private static boolean neq_x583g4_a0a0a0a0a0a1a7a32(Object a, Object b) { return !(((a != null ? a.equals(b) : a == b))); } }