Functions | |
| str | Composite_Exercise_FormatEntry (FileDirEntry entry, int depth) |
| Format the specified entry for display. | |
| None | Composite_Exercise_ShowEntry (FileDirEntry entry) |
| Recursively display the contents of the hierarchical list of objects starting with the given object. | |
| def | Composite_Exercise () |
| Example of using the Composite Pattern. | |
| def Composite_Exercise | ( | void | ) |
Example of using the Composite Pattern.
The Composite pattern is used when a collection of objects is to be formed in a hierarchical form where each object needs to be treated like any other object but some objects can contain other objects.
This example uses a file structure of file and directories to represent each object type.
Definition at line 66 of file composite_exercise.py.
References DesignPatternExamples_python.composite.composite_exercise.Composite_Exercise_ShowEntry().
| str Composite_Exercise_FormatEntry | ( | FileDirEntry | entry, |
| int | depth | ||
| ) |
Format the specified entry for display.
This is a recursive call.
| entry | The FileDirEntry object to format |
| depth | The current recursion depth. This is used as leading space. |
Definition at line 22 of file composite_exercise.py.
References DesignPatternExamples_python.composite.composite_exercise.Composite_Exercise_FormatEntry().
Referenced by DesignPatternExamples_python.composite.composite_exercise.Composite_Exercise_FormatEntry(), and DesignPatternExamples_python.composite.composite_exercise.Composite_Exercise_ShowEntry().
| None Composite_Exercise_ShowEntry | ( | FileDirEntry | entry | ) |
Recursively display the contents of the hierarchical list of objects starting with the given object.
| entry | The file entry to display |
Definition at line 50 of file composite_exercise.py.
References DesignPatternExamples_python.composite.composite_exercise.Composite_Exercise_FormatEntry().
Referenced by DesignPatternExamples_python.composite.composite_exercise.Composite_Exercise().