7from .visitor_class
import Visitor
20 def __init__(self, itemsToOrder : list[str]) ->
None:
45 if hasattr(shop,
"PlaceOrder")
and shop.PlaceOrder(self.
ItemsToOrder):
46 if hasattr(shop,
"PickupOrder"):
All visitors must implement this base class and then override one or more of the VisitXXX() methods,...
A visitor used for ordering items from various shops.
ItemsReceived
List of items received from an order/pickup process.
None VisitButcher(self, shop)
Let the visitor visit a Visitor_Butcher shop.
None VisitMaker(self, shop)
Let the visitor visit a Visitor_Maker shop.
None VisitPickleGrocer(self, shop)
Let the visitor visit a Visitor_PickleGrocer shop.
ShopNameReceivedFrom
Name of the shop that provided the item(s).
None VisitRestaurant(self, shop)
Let the visitor visit a Visitor_Restaurant shop.
None VisitVegetableGrocer(self, shop)
Let the visitor visit a Visitor_VegetableGrocer shop.
None VisitCondimentGrocer(self, shop)
Let the visitor visit a Visitor_CondimentGrocer shop.
ItemsToOrder
Items to be ordered from any shop that sells the item.
None _HandleVisitor(self, shop)
Helper method to handle a visitor, since all visitors are handled in the same way in this collection ...
None __init__(self, list[str] itemsToOrder)
Constructor.
None VisitBaker(self, shop)
Let the visitor visit a Visitor_Baker shop.