synchronized void executed(RTEditText editor,Operation op){
  Stack<Operation> undoStack=getUndoStack(editor);
  Stack<Operation> redoStack=getRedoStack(editor);
  while (!undoStack.empty() && op.canMerge(undoStack.peek())) {
    Operation previousOp=undoStack.pop();
    op.merge(previousOp);
  }
  push(op,undoStack);
  redoStack.clear();
}

synchronized void executed ( RTEditText editor , Operation op ) { Stack < Operation > undoStack = getUndoStack ( editor ) ; Stack < Operation > redoStack = getRedoStack ( editor ) ; while ( ! undoStack . empty ( ) && op . canMerge ( undoStack . peek ( ) ) ) { Operation previousOp = undoStack . pop ( ) ; op . merge ( previousOp ) ; } push ( op , undoStack ) ; redoStack . clear ( ) ; }
call this when an operation is performed to add it to the undo stack .
