package jetbrains.mps.baseLanguage.money.generator.baseLanguage.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 jetbrains.mps.baseLanguage.money.generator.baseLanguage.template.util.Util;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SConceptOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
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.SourceNodeQuery;
import jetbrains.mps.generator.impl.query.QueryKeyImpl;
import org.jetbrains.annotations.Nullable;
@Generated
public class QueriesGenerated extends QueryProviderBase {
public QueriesGenerated() {
super(1);
}
public static boolean baseMappingRule_Condition_1187352489455(final BaseMappingRuleContext _context) {
return SNodeOperations.isInstanceOf(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10ab8473cc5L, 0x10ab847b486L, "creator")), MetaAdapterFactory.getConcept(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x11472ff5968L, "jetbrains.mps.baseLanguage.money.structure.MoneyCreator"));
}
public static boolean baseMappingRule_Condition_1187347436103(final BaseMappingRuleContext _context) {
return Util.isPlusMinusExpressionMoneyExpression(_context.getNode());
}
public static boolean baseMappingRule_Condition_1187349818811(final BaseMappingRuleContext _context) {
return Util.isPlusMinusExpressionMoneyExpression(_context.getNode());
}
public static boolean baseMappingRule_Condition_1187350249789(final BaseMappingRuleContext _context) {
return Util.isMulDivExpressionMoneyExpression(_context.getNode());
}
public static boolean baseMappingRule_Condition_1187350287829(final BaseMappingRuleContext _context) {
return Util.isMulDivExpressionMoneyExpression(_context.getNode());
}
public static SNode sourceNodeQuery_1187347202363(final SourceSubstituteMacroNodeContext _context) {
SNode new_node = SConceptOperations.createNewNode(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, "jetbrains.mps.baseLanguage.structure.StringLiteral"));
SPropertyOperations.set(new_node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x1144ae7606aL, 0x1144aec21fdL, "amount")));
return new_node;
}
public static SNode sourceNodeQuery_1187347224873(final SourceSubstituteMacroNodeContext _context) {
SNode new_node = SConceptOperations.createNewNode(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, "jetbrains.mps.baseLanguage.structure.StringLiteral"));
SPropertyOperations.set(new_node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x1144ae7606aL, 0x1144aebdf40L, "currency")));
return new_node;
}
public static SNode sourceNodeQuery_2110953167961230052(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(SNodeOperations.cast(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10ab8473cc5L, 0x10ab847b486L, "creator")), MetaAdapterFactory.getConcept(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x11472ff5968L, "jetbrains.mps.baseLanguage.money.structure.MoneyCreator")), MetaAdapterFactory.getContainmentLink(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x11472ff5968L, 0x11473383db1L, "amount"));
}
public static SNode sourceNodeQuery_2110953167961228859(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(SNodeOperations.cast(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10ab8473cc5L, 0x10ab847b486L, "creator")), MetaAdapterFactory.getConcept(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x11472ff5968L, "jetbrains.mps.baseLanguage.money.structure.MoneyCreator")), MetaAdapterFactory.getContainmentLink(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x11472ff5968L, 0x11473390f4aL, "currency"));
}
public static SNode sourceNodeQuery_1217888347510(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_1217888349960(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_1217888375666(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_1217888321098(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_1217888394951(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_1187350367397(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_1217888412279(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_1187350349293(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_1217888432992(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x114740b1673L, 0x114740fc5e3L, "instance"));
}
public static SNode sourceNodeQuery_1217888379132(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x114740b1673L, 0x114740fc5e3L, "instance"));
}
public static SNode sourceNodeQuery_1217888377424(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf43135f9b8334685L, 0x8d26ffb6c8215f72L, 0x114740b1673L, 0x114740fc5e3L, "instance"));
}
private final Map<String, ReductionRuleCondition> rrcMethods = new HashMap<String, ReductionRuleCondition>();
{
int i = 0;
rrcMethods.put("1187347245210", new QueriesGenerated.RRC(i++));
rrcMethods.put("1187344468783", new QueriesGenerated.RRC(i++));
rrcMethods.put("1187349818788", new QueriesGenerated.RRC(i++));
rrcMethods.put("1187344489147", new QueriesGenerated.RRC(i++));
rrcMethods.put("1187344492617", 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_1187352489455(ctx);
case 1:
return QueriesGenerated.baseMappingRule_Condition_1187347436103(ctx);
case 2:
return QueriesGenerated.baseMappingRule_Condition_1187349818811(ctx);
case 3:
return QueriesGenerated.baseMappingRule_Condition_1187350249789(ctx);
case 4:
return QueriesGenerated.baseMappingRule_Condition_1187350287829(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("1187347202363", new QueriesGenerated.SNQ(i++));
snqMethods.put("1187347224873", new QueriesGenerated.SNQ(i++));
snqMethods.put("2110953167961230052", new QueriesGenerated.SNQ(i++));
snqMethods.put("2110953167961228859", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888347510", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888349960", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888375666", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888321098", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888394951", new QueriesGenerated.SNQ(i++));
snqMethods.put("1187350367397", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888412279", new QueriesGenerated.SNQ(i++));
snqMethods.put("1187350349293", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888432992", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888379132", new QueriesGenerated.SNQ(i++));
snqMethods.put("1217888377424", 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_1187347202363(ctx);
case 1:
return QueriesGenerated.sourceNodeQuery_1187347224873(ctx);
case 2:
return QueriesGenerated.sourceNodeQuery_2110953167961230052(ctx);
case 3:
return QueriesGenerated.sourceNodeQuery_2110953167961228859(ctx);
case 4:
return QueriesGenerated.sourceNodeQuery_1217888347510(ctx);
case 5:
return QueriesGenerated.sourceNodeQuery_1217888349960(ctx);
case 6:
return QueriesGenerated.sourceNodeQuery_1217888375666(ctx);
case 7:
return QueriesGenerated.sourceNodeQuery_1217888321098(ctx);
case 8:
return QueriesGenerated.sourceNodeQuery_1217888394951(ctx);
case 9:
return QueriesGenerated.sourceNodeQuery_1187350367397(ctx);
case 10:
return QueriesGenerated.sourceNodeQuery_1217888412279(ctx);
case 11:
return QueriesGenerated.sourceNodeQuery_1187350349293(ctx);
case 12:
return QueriesGenerated.sourceNodeQuery_1217888432992(ctx);
case 13:
return QueriesGenerated.sourceNodeQuery_1217888379132(ctx);
case 14:
return QueriesGenerated.sourceNodeQuery_1217888377424(ctx);
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
}
}