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

Implementation of the Command_Exercise() function as used in the Command 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.command
 
namespace  DesignPatternExamples_python.command.command_exercise
 

Functions

def Command_Save_And_Execute (Command_TextObject text, Command command)
 Save the given command on the undo list then execute the command on the given text object.
 
None Command_Operation_Replace (Command_TextObject source, str searchPattern, str replaceText)
 An operation to search and replace text in a Command_TextObject.
 
def Command_Operation_Reverse (Command_TextObject source)
 An operation to reverse the characters in the given Command_TextObject.
 
None Command_Undo (Command_TextObject text)
 Perform an undo on the given Command_TextObject, using the commands in the "global" undo list.
 
None Command_ApplyReplaceCommand (Command_TextObject text, str searchPattern, str replaceText)
 Helper function to create a Command object that replaces text in the given Command_TextObject, adds the command to the undo list and then applies the command to the Command_TextObject.
 
None Command_ApplyReverseCommand (Command_TextObject text)
 Helper function to create a Command object that reverses the order of the characters in the given Command_TextObject, adds the command to the undo list and then applies the command to the Command_TextObject.
 
def Command_Exercise ()
 Example of using the Command Pattern.
 

Variables

list _commandUndoList = []
 The list of commands applied.
 

Detailed Description

Implementation of the Command_Exercise() function as used in the Command Pattern.

Definition in file command_exercise.py.