package org.jetbrains.mps.samples.ParallelFor.dataFlow;

/*Generated by MPS */

import jetbrains.mps.lang.dataFlow.DataFlowBuilder;
import jetbrains.mps.lang.dataFlow.DataFlowBuilderContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;

public class ParallelFor_DataFlow extends DataFlowBuilder {
  public void build(final DataFlowBuilderContext _context) {
    _context.getBuilder().build((SNode) SLinkOperations.getTarget(_context.getNode(), LINKS.loopVariable$q6dq));
    _context.getBuilder().build((SNode) SLinkOperations.getTarget(_context.getNode(), LINKS.inputSequence$bOOx));
    if (SLinkOperations.getTarget(_context.getNode(), LINKS.threadPool$PSS$) != null) {
      _context.getBuilder().build((SNode) SLinkOperations.getTarget(_context.getNode(), LINKS.threadPool$PSS$));
      _context.getBuilder().emitRead(SLinkOperations.getTarget(_context.getNode(), LINKS.threadPool$PSS$), "r:fe5285c7-54ed-422a-b9ef-c710009e0ee7(org.jetbrains.mps.samples.ParallelFor.dataFlow)/4659204813808536399");
    }
    _context.getBuilder().emitLabel("loop");
    _context.getBuilder().emitWrite(SLinkOperations.getTarget(_context.getNode(), LINKS.loopVariable$q6dq), SLinkOperations.getTarget(_context.getNode(), LINKS.inputSequence$bOOx), "r:fe5285c7-54ed-422a-b9ef-c710009e0ee7(org.jetbrains.mps.samples.ParallelFor.dataFlow)/7793246093816003169");
    _context.getBuilder().emitIfJump(_context.getBuilder().after(_context.getNode()), "r:fe5285c7-54ed-422a-b9ef-c710009e0ee7(org.jetbrains.mps.samples.ParallelFor.dataFlow)/7793246093816003203");
    _context.getBuilder().build((SNode) SLinkOperations.getTarget(_context.getNode(), LINKS.body$c1sm));
    _context.getBuilder().emitIfJump(_context.getBuilder().label(_context.getNode(), "loop"), "r:fe5285c7-54ed-422a-b9ef-c710009e0ee7(org.jetbrains.mps.samples.ParallelFor.dataFlow)/7793246093816003218");
  }

  private static final class LINKS {
    /*package*/ static final SContainmentLink loopVariable$q6dq = MetaAdapterFactory.getContainmentLink(0xcb7388e8f1824cdaL, 0xbd839796e8634856L, 0x7bd8445d1e8770aaL, 0x7bd8445d1e8810c2L, "loopVariable");
    /*package*/ static final SContainmentLink inputSequence$bOOx = MetaAdapterFactory.getContainmentLink(0xcb7388e8f1824cdaL, 0xbd839796e8634856L, 0x7bd8445d1e8770aaL, 0x7bd8445d1e888c7eL, "inputSequence");
    /*package*/ static final SContainmentLink threadPool$PSS$ = MetaAdapterFactory.getContainmentLink(0xcb7388e8f1824cdaL, 0xbd839796e8634856L, 0x7bd8445d1e8770aaL, 0x40a8d217b6d881feL, "threadPool");
    /*package*/ static final SContainmentLink body$c1sm = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body");
  }
}
