/** * Determine if this instance is the loop head of its {@link ExecutionStageLoop}. * * @return {@code true} if the above condition is fulfilled or there is no {@link ExecutionStageLoop} */ public boolean isLoopHead() { return this.executionStageLoop != null && this.executionStageLoop.getLoopHead() == this; }
/** * Tells whether this instance is in a {@link ExecutionStageLoop} that has finished iterating. * * @return whether this instance is in a finished {@link ExecutionStageLoop} * @see #isLoopHead() */ public boolean isInFinishedLoop() { if (this.executionStageLoop == null) { return false; } final LoopHeadOperator loopHeadOperator = (LoopHeadOperator) this.executionStageLoop.getLoopHead().getLoopHeadTask().getOperator(); return loopHeadOperator.getState() == LoopHeadOperator.State.FINISHED; }