MCPcopy Create free account
hub / github.com/RefactoringGuru/design-patterns-python / Leaf

Class Leaf

src/Composite/Conceptual/main.py:93–109  ·  view source on GitHub ↗

EN: The Leaf class represents the end objects of a composition. A leaf can't have any children. Usually, it's the Leaf objects that do the actual work, whereas Composite objects only delegate to their sub-components. RU: Класс Лист представляет собой конечные объекты структуры

Source from the content-addressed store, hash-verified

91
92
93class Leaf(Component):
94 """
95 EN: The Leaf class represents the end objects of a composition. A leaf can't
96 have any children.
97
98 Usually, it's the Leaf objects that do the actual work, whereas Composite
99 objects only delegate to their sub-components.
100
101 RU: Класс Лист представляет собой конечные объекты структуры. Лист не может
102 иметь вложенных компонентов.
103
104 Обычно объекты Листьев выполняют фактическую работу, тогда как объекты
105 Контейнера лишь делегируют работу своим подкомпонентам.
106 """
107
108 def operation(self) -> str:
109 return "Leaf"
110
111
112class Composite(Component):

Callers 1

main.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected