CPD Results

The following document contains the results of PMD's CPD 4.1.

Duplications

File Line
com\gridsystems\nextgrid\api\pom\DoWhileProcessImpl.java 56
com\gridsystems\nextgrid\api\pom\RepeatUntilProcessImpl.java 56
  public RepeatUntilProcessImpl() {
    super(1);
  }

  /**
   * Gets the expr value.
   *
   * @return The expr
   */
  public Expression getExpression() {
    return this.expr;
  }

  /**
   * Sets the expr value.
   *
   * @param expression The expr to set
   */
  public void setExpression(Expression expression) {
    this.expr = expression;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected void doValidate(ValidationType when) throws ProcessException {
    if (when == ValidationType.BEFORE_CHILDREN) {
      if (this.expr == null) {
        throw new ExpressionException("Null expression");
      } else {
        this.expr.validate();
      }
    }
  }

  /**
   * {@inheritDoc}
   */
  public void run(ProcessContext ctx) throws ProcessException, InterruptedException {
    fireProcessStarted();

    // Very naive approach!
    while (true) {

      // Reset all local variables used by this loop
      for (Map.Entry<String, Reference<?>> entry : this.getLocalVars().entrySet()) {
        entry.getValue().reset();
      }

      waitForInputs();
      Process[] children = getChildren();
      int count = (children == null) ? 0 : children.length;

      while (this.index < count) {
        if (!ctx.isRunning()) {
          return;
        }
        ProcessController controller = children[this.index].enact(ctx);
        controller.run();

        if (!ctx.isRunning()) {
          return;
        }
        this.index++;
      }
      this.index = 0;

      if (this.getExpression().boolEval(ctx, this)) {