Exemple #1
0
  /**
   * generate the code for the steady state loop. Inline the work function inside of an infinite
   * while loop.
   *
   * @param filter The single fused filter of the application.
   * @return A JStatement that is a while loop with the work function inlined.
   */
  JStatement generateSteadyStateLoop(SIRFilter filter) {

    JBlock block = new JBlock(null, new JStatement[0], null);

    JBlock workBlock = (JBlock) ObjectDeepCloner.deepCopy(filter.getWork().getBody());

    // add the cloned work function to the block
    block.addStatement(workBlock);

    // return the infinite loop
    return new JWhileStatement(null, new JBooleanLiteral(null, true), block, null);
  }