package jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_weaveManyToSingularChild;
/*Generated by MPS */
import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.runtime.MapConfigBase;
import jetbrains.mps.generator.runtime.TemplateMappingConfiguration;
import java.util.Collection;
import jetbrains.mps.generator.runtime.TemplateRootMappingRule;
import jetbrains.mps.generator.runtime.TemplateWeavingRule;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.runtime.TemplateModel;
import jetbrains.mps.smodel.SNodePointer;
import jetbrains.mps.generator.runtime.TemplateUtil;
import jetbrains.mps.generator.runtime.MapRootRuleBase;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.generator.runtime.TemplateContext;
import jetbrains.mps.generator.runtime.GenerationException;
import jetbrains.mps.generator.template.MapRootRuleContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.generator.runtime.TemplateExecutionEnvironment;
import jetbrains.mps.generator.runtime.WeaveRuleBase;
import jetbrains.mps.generator.template.WeavingMappingRuleContext;
import jetbrains.mps.generator.runtime.NodeWeaveFacility;
import jetbrains.mps.generator.impl.WeaveContextImpl;
@Generated
public class Mapping_main extends MapConfigBase implements TemplateMappingConfiguration {
private final Collection<TemplateRootMappingRule> rootRules;
private final Collection<TemplateWeavingRule> weavings;
public Mapping_main(@NotNull TemplateModel model) {
super(new SNodePointer("r:00000000-0000-4000-0000-011c895905fa(jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_weaveManyToSingularChild@generator)", "1218738629621"), "main", model, false);
rootRules = TemplateUtil.<TemplateRootMappingRule>asCollection(new Mapping_main.RootMappingRule0());
weavings = TemplateUtil.<TemplateWeavingRule>asCollection(new Mapping_main.WeavingRule0());
}
@Override
public Collection<TemplateRootMappingRule> getRootRules() {
return rootRules;
}
@Override
public Collection<TemplateWeavingRule> getWeavingRules() {
return weavings;
}
public class RootMappingRule0 extends MapRootRuleBase implements TemplateRootMappingRule {
public RootMappingRule0() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c895905fa(jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_weaveManyToSingularChild@generator)", "1218738658950"), MetaAdapterFactory.getConcept(0xab0ae915e3b54f35L, 0xb55ac655d649a03cL, 0x11645953ab3L, "jetbrains.mps.transformation.test.inputLang.structure.InputRoot"), false, false);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_1218738676457(new MapRootRuleContext(context, getRuleNode()));
}
@Override
public Collection<SNode> apply(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
Collection<SNode> result = new Template_map_outputNode().apply(environment, context);
return result;
}
}
public class WeavingRule0 extends WeaveRuleBase implements TemplateWeavingRule {
public WeavingRule0() {
super(new SNodePointer("r:00000000-0000-4000-0000-011c895905fa(jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_weaveManyToSingularChild@generator)", "1218738863683"), MetaAdapterFactory.getConcept(0xab0ae915e3b54f35L, 0xb55ac655d649a03cL, 0x11645be5a7aL, "jetbrains.mps.transformation.test.inputLang.structure.InputNode_A"), false);
}
@Override
public boolean isApplicable(@NotNull TemplateContext context) throws GenerationException {
return QueriesGenerated.baseMappingRule_Condition_1218738876108(new WeavingMappingRuleContext(context, getRuleNode()));
}
@NotNull
@Override
public SNode getContextNode(TemplateExecutionEnvironment environment, TemplateContext context) {
return QueriesGenerated.weaving_MappingRule_ContextNodeQuery_1218738863685(new WeavingMappingRuleContext(context, getRuleNode()));
}
@Override
public boolean apply(final TemplateExecutionEnvironment environment, final TemplateContext context, final SNode outputContextNode) throws GenerationException {
NodeWeaveFacility.WeaveContext weaveContext = new WeaveContextImpl(outputContextNode, context, WeavingRule0.this);
Collection<SNode> tlist1 = environment.prepareWeave(weaveContext, new SNodePointer("r:00000000-0000-4000-0000-011c895905fa(jetbrains.mps.transformation.test.inputLang.generator.outputLang.template.test_weaveManyToSingularChild@generator)", "1218738992786")).weaveTemplate(new Template_weave_InputNode_A());
return tlist1 != null && !(tlist1.isEmpty());
}
}
}