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

Class Visitor

src/Visitor/Conceptual/main.py:83–100  ·  view source on GitHub ↗

EN: The Visitor Interface declares a set of visiting methods that correspond to component classes. The signature of a visiting method allows the visitor to identify the exact class of the component that it's dealing with. RU: Интерфейс Посетителя объявляет набор методов посещения,

Source from the content-addressed store, hash-verified

81
82
83class Visitor(ABC):
84 """
85 EN: The Visitor Interface declares a set of visiting methods that correspond
86 to component classes. The signature of a visiting method allows the visitor
87 to identify the exact class of the component that it's dealing with.
88
89 RU: Интерфейс Посетителя объявляет набор методов посещения, соответствующих
90 классам компонентов. Сигнатура метода посещения позволяет посетителю
91 определить конкретный класс компонента, с которым он имеет дело.
92 """
93
94 @abstractmethod
95 def visit_concrete_component_a(self, element: ConcreteComponentA) -> None:
96 pass
97
98 @abstractmethod
99 def visit_concrete_component_b(self, element: ConcreteComponentB) -> None:
100 pass
101
102
103"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected