package jetbrains.mps.samples.Shapes.generator.template.main;
/*Generated by MPS */
import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.impl.query.QueryProviderBase;
import jetbrains.mps.generator.template.PropertyMacroContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.generator.template.ReferenceMacroContext;
import util.ColorReferenceResolver;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext;
import java.util.Map;
import jetbrains.mps.generator.impl.query.SourceNodesQuery;
import java.util.HashMap;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.impl.query.QueryKey;
import jetbrains.mps.generator.impl.query.QueryKeyImpl;
import java.util.Collection;
import jetbrains.mps.generator.impl.GenerationFailureException;
import jetbrains.mps.util.IterableUtil;
import jetbrains.mps.generator.impl.query.PropertyValueQuery;
import org.jetbrains.mps.openapi.language.SProperty;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.generator.impl.query.ReferenceTargetQuery;
@Generated
public class QueriesGenerated extends QueryProviderBase {
public QueriesGenerated() {
super(1);
}
public static Object propertyMacro_GetPropertyValue_5898776707557736279(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_5898776707557582396(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558014758(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc198L, 0x51dcaa29974fc199L, "x"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558016314(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc198L, 0x51dcaa29974fc19bL, "y"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558017922(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc198L, 0x51dcaa29974fc19eL, "radius"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558019582(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc198L, 0x51dcaa29974fc19eL, "radius"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558026861(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc1a2L, 0x51dcaa29974fc1a3L, "upperLeftX"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558028409(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc1a2L, 0x51dcaa29974fc1a5L, "upperLeftY"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558030009(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc1a2L, 0x51dcaa29974fc1a8L, "size"));
}
public static Object propertyMacro_GetPropertyValue_5898776707558031661(final PropertyMacroContext _context) {
return SPropertyOperations.getInteger(_context.getNode(), MetaAdapterFactory.getProperty(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc1a2L, 0x51dcaa29974fc1a8L, "size"));
}
public static Object referenceMacro_GetReferent_6037902070683321763(final ReferenceMacroContext _context) {
return ColorReferenceResolver.findColorDeclaration(SLinkOperations.getTarget(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc161L, 0x3a2b0182df24928cL, "colorRef")), MetaAdapterFactory.getReferenceLink(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x3a2b0182df2201afL, 0x3a2b0182df22029aL, "target")));
}
public static Object referenceMacro_GetReferent_6037902070683332881(final ReferenceMacroContext _context) {
return ColorReferenceResolver.findColorDeclaration(SLinkOperations.getTarget(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fc161L, 0x3a2b0182df24928cL, "colorRef")), MetaAdapterFactory.getReferenceLink(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x3a2b0182df2201afL, 0x3a2b0182df22029aL, "target")));
}
public static Iterable<SNode> sourceNodesQuery_5898776707557819858(final SourceSubstituteMacroNodesContext _context) {
return SLinkOperations.getChildren(_context.getNode(), MetaAdapterFactory.getContainmentLink(0x16bafbb4c6cd4cc5L, 0x83327c6de8729b3fL, 0x51dcaa29974fa71dL, 0x51dcaa29974ffa47L, "shapes"));
}
private final Map<String, SourceNodesQuery> snsqMethods = new HashMap<String, SourceNodesQuery>();
{
int i = 0;
snsqMethods.put("5898776707557819858", 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_5898776707557819858(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("5898776707557736278", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "Title"));
pvqMethods.put("5898776707557582395", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "MyCanvas"));
pvqMethods.put("5898776707558014755", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558016311", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558017919", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558019579", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558026858", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558028406", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558030006", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
pvqMethods.put("5898776707558031658", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "10"));
}
@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_5898776707557736279(ctx);
case 1:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707557582396(ctx);
case 2:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558014758(ctx);
case 3:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558016314(ctx);
case 4:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558017922(ctx);
case 5:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558019582(ctx);
case 6:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558026861(ctx);
case 7:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558028409(ctx);
case 8:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558030009(ctx);
case 9:
return QueriesGenerated.propertyMacro_GetPropertyValue_5898776707558031661(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, ReferenceTargetQuery> rtqMethods = new HashMap<String, ReferenceTargetQuery>();
{
rtqMethods.put("6037902070683309737", new QueriesGenerated.RTQ(0, "red"));
rtqMethods.put("6037902070683332878", new QueriesGenerated.RTQ(1, "red"));
}
@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_6037902070683321763(ctx);
case 1:
return QueriesGenerated.referenceMacro_GetReferent_6037902070683332881(ctx);
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
}
}