package jetbrains.mps.traceInfo.testWeavingInterpreted.data.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.lang.smodel.generator.smodelAdapter.SNodeOperations;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext;
import jetbrains.mps.internal.collections.runtime.Sequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.generator.template.WeavingMappingRuleContext;
import java.util.Map;
import java.util.HashMap;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.impl.query.WeaveRuleCondition;
import jetbrains.mps.generator.impl.query.QueryKey;
import jetbrains.mps.generator.impl.query.WeaveRuleQuery;
import jetbrains.mps.generator.impl.query.WeaveAnchorQuery;
import jetbrains.mps.generator.impl.GenerationFailureException;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.generator.template.WeavingAnchorContext;
import jetbrains.mps.generator.impl.query.SourceNodesQuery;
import jetbrains.mps.generator.impl.query.QueryKeyImpl;
import java.util.Collection;
import jetbrains.mps.util.IterableUtil;
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 Object propertyMacro_GetPropertyValue_6186432342008490331(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_6186432342008526320(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_6186432342008522555(final PropertyMacroContext _context) {
return _context.createUniqueName(SNodeOperations.getConcept(_context.getNode()).getName(), null);
}
public static Object propertyMacro_GetPropertyValue_6186432342008533408(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_6186432342008533417(final PropertyMacroContext _context) {
return _context.createUniqueName(SNodeOperations.getConcept(_context.getNode()).getName(), null);
}
public static Object propertyMacro_GetPropertyValue_6186432342008533449(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_6186432342008533458(final PropertyMacroContext _context) {
return _context.createUniqueName(SNodeOperations.getConcept(_context.getNode()).getName(), null);
}
public static Object propertyMacro_GetPropertyValue_6186432342008533482(final PropertyMacroContext _context) {
return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
public static Object propertyMacro_GetPropertyValue_6186432342008533491(final PropertyMacroContext _context) {
return _context.createUniqueName(SNodeOperations.getConcept(_context.getNode()).getName(), null);
}
public static Iterable<SNode> sourceNodesQuery_6186432342008490342(final SourceSubstituteMacroNodesContext _context) {
return Sequence.<SNode>singleton(_context.getNode());
}
public static Iterable<SNode> sourceNodesQuery_6186432342008522532(final SourceSubstituteMacroNodesContext _context) {
return SLinkOperations.getChildren(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xffafcf63cbe64e5cL, 0x9717541f01743ac7L, 0x55da9f701c64caccL, 0x55da9f701c64f39fL, "weaveEach"));
}
public static Iterable<SNode> sourceNodesQuery_6186432342008533377(final SourceSubstituteMacroNodesContext _context) {
return Sequence.<SNode>singleton(_context.getNode());
}
public static Iterable<SNode> sourceNodesQuery_6186432342008533362(final SourceSubstituteMacroNodesContext _context) {
return SLinkOperations.getChildren(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xffafcf63cbe64e5cL, 0x9717541f01743ac7L, 0x55da9f701c64caccL, 0x55da9f701c68116fL, "weaveEachMany"));
}
public static SNode weaving_MappingRule_ContextNodeQuery_6186432342008490339(final WeavingMappingRuleContext _context) {
return _context.getOutputNodeByInputNodeAndMappingLabel(SNodeOperations.cast(SNodeOperations.getContainingRoot(_context.getNode()), MetaAdapterFactory.getConcept(0xffafcf63cbe64e5cL, 0x9717541f01743ac7L, 0x55da9f701c64caccL, "jetbrains.mps.traceInfo.testWeavingInterpreted.data.structure.RootConcept")), "map_RootConcept");
}
public static SNode weaving_MappingRule_ContextNodeQuery_6186432342008522529(final WeavingMappingRuleContext _context) {
return _context.getOutputNodeByInputNodeAndMappingLabel(_context.getNode(), "map_RootConcept");
}
public static SNode weaving_MappingRule_ContextNodeQuery_6186432342008533384(final WeavingMappingRuleContext _context) {
return _context.getOutputNodeByInputNodeAndMappingLabel(SNodeOperations.cast(SNodeOperations.getContainingRoot(_context.getNode()), MetaAdapterFactory.getConcept(0xffafcf63cbe64e5cL, 0x9717541f01743ac7L, 0x55da9f701c64caccL, "jetbrains.mps.traceInfo.testWeavingInterpreted.data.structure.RootConcept")), "map_RootConcept");
}
public static SNode weaving_MappingRule_ContextNodeQuery_6186432342008533368(final WeavingMappingRuleContext _context) {
return _context.getOutputNodeByInputNodeAndMappingLabel(_context.getNode(), "map_RootConcept");
}
private final Map<String, QueriesGenerated.WRQ> wrcnMethods = new HashMap<String, QueriesGenerated.WRQ>();
{
int i = 0;
wrcnMethods.put("6186432342008490337", new QueriesGenerated.WRQ(i++));
wrcnMethods.put("6186432342008522527", new QueriesGenerated.WRQ(i++));
wrcnMethods.put("6186432342008533375", new QueriesGenerated.WRQ(i++));
wrcnMethods.put("6186432342008533360", new QueriesGenerated.WRQ(i++));
}
@Override
@NotNull
public WeaveRuleCondition getWeaveRuleCondition(@NotNull QueryKey identity) {
final String id = identity.getTemplateNode().getNodeId().toString();
if (!(wrcnMethods.containsKey(id))) {
return super.getWeaveRuleCondition(identity);
}
return wrcnMethods.get(id);
}
@Override
@NotNull
public WeaveRuleQuery getWeaveRuleQuery(@NotNull QueryKey identity) {
final String id = identity.getTemplateNode().getNodeId().toString();
if (!(wrcnMethods.containsKey(id))) {
return super.getWeaveRuleQuery(identity);
}
return wrcnMethods.get(id);
}
@NotNull
@Override
public WeaveAnchorQuery getWeaveAnchorQuery(@NotNull QueryKey identity) {
final String id = identity.getTemplateNode().getNodeId().toString();
if (!(wrcnMethods.containsKey(id))) {
return super.getWeaveAnchorQuery(identity);
}
return wrcnMethods.get(id);
}
private static class WRQ implements WeaveRuleQuery, WeaveRuleCondition, WeaveAnchorQuery {
private final int methodKey;
public WRQ(int methodKey) {
this.methodKey = methodKey;
}
@Override
public boolean check(@NotNull WeavingMappingRuleContext ctx) throws GenerationFailureException {
switch (methodKey) {
case 0:
return true;
case 1:
return true;
case 2:
return true;
case 3:
return true;
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for rule %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
@Override
public SNode contextNode(WeavingMappingRuleContext ctx) throws GenerationFailureException {
switch (methodKey) {
case 0:
return QueriesGenerated.weaving_MappingRule_ContextNodeQuery_6186432342008490339(ctx);
case 1:
return QueriesGenerated.weaving_MappingRule_ContextNodeQuery_6186432342008522529(ctx);
case 2:
return QueriesGenerated.weaving_MappingRule_ContextNodeQuery_6186432342008533384(ctx);
case 3:
return QueriesGenerated.weaving_MappingRule_ContextNodeQuery_6186432342008533368(ctx);
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no context node query method for weaving rule %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
@Nullable
@Override
public SNode anchorNode(WeavingAnchorContext ctx) throws GenerationFailureException {
switch (methodKey) {
case 0:
return null;
case 1:
return null;
case 2:
return null;
case 3:
return null;
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no anchor query method for rule %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
}
private final Map<String, SourceNodesQuery> snsqMethods = new HashMap<String, SourceNodesQuery>();
{
int i = 0;
snsqMethods.put("6186432342008490342", new QueriesGenerated.SNsQ(i++));
snsqMethods.put("6186432342008522532", new QueriesGenerated.SNsQ(i++));
snsqMethods.put("6186432342008533377", new QueriesGenerated.SNsQ(i++));
snsqMethods.put("6186432342008533362", 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_6186432342008490342(ctx));
case 1:
return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_6186432342008522532(ctx));
case 2:
return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_6186432342008533377(ctx));
case 3:
return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_6186432342008533362(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("6186432342008490328", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "map_RootConcept"));
pvqMethods.put("6186432342008526317", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "name"));
pvqMethods.put("6186432342008522554", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "method"));
pvqMethods.put("6186432342008533407", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "name"));
pvqMethods.put("6186432342008533416", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "method"));
pvqMethods.put("6186432342008533448", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "name"));
pvqMethods.put("6186432342008533457", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "method2"));
pvqMethods.put("6186432342008533481", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "name"));
pvqMethods.put("6186432342008533490", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "method3"));
}
@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_6186432342008490331(ctx);
case 1:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008526320(ctx);
case 2:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008522555(ctx);
case 3:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008533408(ctx);
case 4:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008533417(ctx);
case 5:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008533449(ctx);
case 6:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008533458(ctx);
case 7:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008533482(ctx);
case 8:
return QueriesGenerated.propertyMacro_GetPropertyValue_6186432342008533491(ctx);
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey));
}
}
}
}