private boolean isFinalStage(State s){
  return s.taskState.stage == TaskState.TaskStage.FINISHED || s.taskState.stage == TaskState.TaskStage.FAILED || s.taskState.stage == TaskState.TaskStage.CANCELLED;
}

private boolean isFinalStage ( State s ) { return s . taskState . stage == TaskState . TaskStage . FINISHED || s . taskState . stage == TaskState . TaskStage . FAILED || s . taskState . stage == TaskState . TaskStage . CANCELLED ; }
determines if the task is in a final state .
