コード例 #1
0
ファイル: Action.java プロジェクト: RmLtA/Malai
  /**
   * Executes the action. Should be overridden by sub-class to define stuffs to execute. If the
   * status of the action differs than CREATED or EXECUTED and if the action cannot be done (canDo),
   * the action is not executed.
   *
   * @since 0.1
   * @return True if the execution is successful. False otherwise.
   */
  public boolean doIt() {
    final boolean ok;

    if ((status == ActionStatus.CREATED || status == ActionStatus.EXECUTED) && canDo()) {
      ok = true;
      doActionBody();
      status = ActionStatus.EXECUTED;
      ActionsRegistry.INSTANCE.onActionExecuted(this);
    } else ok = false;

    return ok;
  }
コード例 #2
0
ファイル: Action.java プロジェクト: RmLtA/Malai
 /**
  * Sets the action to "done".
  *
  * @since 0.1
  */
 public void done() {
   if (status == ActionStatus.CREATED || status == ActionStatus.EXECUTED) {
     status = ActionStatus.DONE;
     ActionsRegistry.INSTANCE.onActionDone(this);
   }
 }