package org.jetbrains.mps.samples.Money.generator.template.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 org.jetbrains.mps.samples.Money.generator.main.util.MoneyUtil;
import jetbrains.mps.generator.template.PropertyMacroContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodeContext;
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;
import jetbrains.mps.generator.impl.query.PropertyValueQuery;
import org.jetbrains.mps.openapi.language.SProperty;
@Generated
public class QueriesGenerated extends QueryProviderBase {
public QueriesGenerated() {
super(1);
}
public static boolean baseMappingRule_Condition_5447719361346553354(final BaseMappingRuleContext _context) {
return MoneyUtil.isMoneyOperation(_context.getNode());
}
public static boolean baseMappingRule_Condition_5447719361346553533(final BaseMappingRuleContext _context) {
return MoneyUtil.isMoneyOperation(_context.getNode());
}
public static boolean baseMappingRule_Condition_2864272256649711188(final BaseMappingRuleContext _context) {
return MoneyUtil.isMoneyOperation(_context.getNode());
}
public static boolean baseMappingRule_Condition_2864272256651347929(final BaseMappingRuleContext _context) {
return MoneyUtil.isMoneyOperation(_context.getNode());
}
public static boolean baseMappingRule_Condition_2864272256651353592(final BaseMappingRuleContext _context) {
return MoneyUtil.isMoneyOperation(_context.getNode());
}
public static boolean baseMappingRule_Condition_2864272256651360964(final BaseMappingRuleContext _context) {
return MoneyUtil.isMoneyOperation(_context.getNode());
}
public static Object propertyMacro_GetPropertyValue_5447719361346518799(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x662a9f2b58024d16L, 0x955872c65c7a681eL, 0x4b9a2fe559135132L, 0x4b9a2fe559135183L, "amount"));
}
public static Object propertyMacro_GetPropertyValue_5447719361346518812(final PropertyMacroContext _context) {
return SPropertyOperations.getString(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0x662a9f2b58024d16L, 0x955872c65c7a681eL, 0x4b9a2fe559135132L, 0x3210b276d14435a8L, "unit")), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_1790427706118386796(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0x662a9f2b58024d16L, 0x955872c65c7a681eL, 0x18d8e0833b34209aL, 0x18d8e0833b34345fL, "targetCurrency"));
}
public static SNode sourceNodeQuery_5447719361346558522(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_5447719361346558513(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_5447719361346558533(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_5447719361346558490(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_2864272256649727827(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_2864272256649728152(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_2864272256651350066(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_2864272256651350076(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_2864272256651359470(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_2864272256651359480(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
public static SNode sourceNodeQuery_2864272256651363162(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"));
}
public static SNode sourceNodeQuery_2864272256651363172(final SourceSubstituteMacroNodeContext _context) {
return SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"));
}
private final Map<String, ReductionRuleCondition> rrcMethods = new HashMap<String, ReductionRuleCondition>();
{
int i = 0;
rrcMethods.put("5447719361346553352", new QueriesGenerated.RRC(i++));
rrcMethods.put("5447719361346553531", new QueriesGenerated.RRC(i++));
rrcMethods.put("2864272256649711187", new QueriesGenerated.RRC(i++));
rrcMethods.put("2864272256651347928", new QueriesGenerated.RRC(i++));
rrcMethods.put("2864272256651353591", new QueriesGenerated.RRC(i++));
rrcMethods.put("2864272256651360963", 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_5447719361346553354(ctx);
case 1:
return QueriesGenerated.baseMappingRule_Condition_5447719361346553533(ctx);
case 2:
return QueriesGenerated.baseMappingRule_Condition_2864272256649711188(ctx);
case 3:
return QueriesGenerated.baseMappingRule_Condition_2864272256651347929(ctx);
case 4:
return QueriesGenerated.baseMappingRule_Condition_2864272256651353592(ctx);
case 5:
return QueriesGenerated.baseMappingRule_Condition_2864272256651360964(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("5447719361346558522", new QueriesGenerated.SNQ(i++));
snqMethods.put("5447719361346558513", new QueriesGenerated.SNQ(i++));
snqMethods.put("5447719361346558533", new QueriesGenerated.SNQ(i++));
snqMethods.put("5447719361346558490", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256649727827", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256649728152", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256651350066", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256651350076", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256651359470", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256651359480", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256651363162", new QueriesGenerated.SNQ(i++));
snqMethods.put("2864272256651363172", 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_5447719361346558522(ctx);
case 1:
return QueriesGenerated.sourceNodeQuery_5447719361346558513(ctx);
case 2:
return QueriesGenerated.sourceNodeQuery_5447719361346558533(ctx);
case 3:
return QueriesGenerated.sourceNodeQuery_5447719361346558490(ctx);
case 4:
return QueriesGenerated.sourceNodeQuery_2864272256649727827(ctx);
case 5:
return QueriesGenerated.sourceNodeQuery_2864272256649728152(ctx);
case 6:
return QueriesGenerated.sourceNodeQuery_2864272256651350066(ctx);
case 7:
return QueriesGenerated.sourceNodeQuery_2864272256651350076(ctx);
case 8:
return QueriesGenerated.sourceNodeQuery_2864272256651359470(ctx);
case 9:
return QueriesGenerated.sourceNodeQuery_2864272256651359480(ctx);
case 10:
return QueriesGenerated.sourceNodeQuery_2864272256651363162(ctx);
case 11:
return QueriesGenerated.sourceNodeQuery_2864272256651363172(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("5447719361346518798", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "1"));
pvqMethods.put("5447719361346518811", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), ""));
pvqMethods.put("1790427706118386795", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), ""));
}
@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_5447719361346518799(ctx);
case 1:
return QueriesGenerated.propertyMacro_GetPropertyValue_5447719361346518812(ctx);
case 2:
return QueriesGenerated.propertyMacro_GetPropertyValue_1790427706118386796(ctx);
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
}
}