Design Pattern Examples
Overview of object-oriented design patterns
memento_exercise.py File Reference

Implementation of the Memento_Exercise() function as used in the Memento Pattern. More...

Go to the source code of this file.

Namespaces

namespace  DesignPatternExamples_python
 The DesignPatternExamples_python package, containing 20 examples of design patterns, each in their own namespace.
 
namespace  DesignPatternExamples_python.memento
 
namespace  DesignPatternExamples_python.memento.memento_exercise
 

Functions

None Memento_SaveForUndo (Memento_TextObject text, str operation)
 Take a snapshot of the given text object associated with the name of given operation.
 
None Memento_Operation_Replace (Memento_TextObject source, str searchPattern, str replaceText)
 An operation to search and replace text in a Memento_TextObject.
 
None Memento_Operation_Reverse (Memento_TextObject source)
 An operation to reverse the characters in the given Memento_TextObject.
 
None Memento_Undo (Memento_TextObject text)
 Perform an undo on the given Command_TextObject, using the mementos in the "global" undo list.
 
None Memento_ApplyReplaceOperation (Memento_TextObject text, str searchPattern, str replaceText)
 Helper function to replace a pattern with another string in the given Memento_TextObject after adding a snapshot of the text object to the undo list.
 
None Memento_ApplyReverseOperation (Memento_TextObject text)
 Helper function to reverse the order of the characters in the given Memento_TextObject after adding a snapshot of the text object to an undo list.
 
def Memento_Exercise ()
 Example of using the Memento Pattern.
 

Variables

list _mementoUndoList = []
 The list of memento objects that form a series of snapshots in time of a Memento_TextObject.
 

Detailed Description

Implementation of the Memento_Exercise() function as used in the Memento Pattern.

Definition in file memento_exercise.py.