public void executeAction(IAction<T> pAction) {
    for (IActionListener<T> pActionListener : mActionListeners)
      pActionListener.actionWillExecute(pAction);

    mRollback.peek().push(pAction.getReverseAction(mPuzzle));
    pAction.doAction(mPuzzle);

    for (IActionListener<T> pActionListener : mActionListeners)
      pActionListener.actionExecuted(pAction);
  }
 public void rollBack() {
   if (mRollback.size() == 0)
     throw new IllegalStateException("Could not rollback: nothing to rollback");
   Stack<IAction<T>> actions = mRollback.pop();
   while (!actions.isEmpty()) {
     IAction<T> action = actions.pop();
     for (IActionListener<T> pActionListener : mActionListeners)
       pActionListener.actionWillExecute(action);
     action.doAction(mPuzzle);
     for (IActionListener<T> pActionListener : mActionListeners)
       pActionListener.actionExecuted(action);
   }
 }