6using System.Collections.Generic;
21 public string Name =
string.Empty;
26 private List<Visitor_Shop>
shops =
new List<Visitor_Shop>();
33 Name =
"Village of Self-Sufficiency";
37 Name =
"Joe's Burger Joint",
38 Address =
"47 Millings Rd.",
40 IngredientsForItems =
new Dictionary<string, string[]> {
41 {
"hamburger",
new string[] {
"ground beef",
"hamburger buns",
"ketchup",
"mustard",
"mayonnaise",
"lettuce",
"tomato",
"onion",
"pickles" } }
47 Name =
"Amelia's Butcher Shop",
48 Address =
"12 Klaxon Ave.",
50 IngredientsForItems =
new Dictionary<string, string[]> { {
"ground beef",
new string[] { } } }
55 Name =
"Oxel's Breads and Buns Bakery",
56 Address =
"131 Worthington Dr.",
58 IngredientsForItems =
new Dictionary<string, string[]> { {
"hamburger buns",
new string[] { } } }
63 Name =
"Connie's Condiments",
64 Address =
"83 Millings Rd.",
66 IngredientsForItems =
new Dictionary<string, string[]> {
67 {
"ketchup",
new string[] {
"fresh ketchup" } },
68 {
"mustard",
new string[] {
"fresh mustard" } },
69 {
"mayonnaise",
new string[] {
"fresh mayonnaise" } }
75 Name =
"Florence's Vegetables",
76 Address =
"32 Main St.",
78 IngredientsForItems =
new Dictionary<string, string[]> {
79 {
"lettuce",
new string[] { } },
80 {
"tomato",
new string[] { } },
81 {
"onion",
new string[] { } },
82 {
"cucumber",
new string[] { } },
83 {
"mustard seed",
new string[] { } }
89 Name =
"Larry's Pickle Emporium",
90 Address =
"34 Main St.",
92 IngredientsForItems =
new Dictionary<string, string[]> { {
"pickles",
new string[] {
"vinegar",
"cucumber",
"salt" } } }
97 Name =
"Klyde and Sons Ketchup Makers",
98 Address =
"800 Overtown Rd.",
100 IngredientsForItems =
new Dictionary<string, string[]> { {
"fresh ketchup",
new string[] { } } }
105 Name =
"Molly's Mustard Mart",
106 Address =
"810 Overtown Rd.",
108 IngredientsForItems =
new Dictionary<string, string[]> { {
"fresh mustard",
new string[] {
"vinegar",
"mustard seed" } } }
113 Name =
"Turk's Mayo Supply",
114 Address =
"820 Overtown Rd.",
116 IngredientsForItems =
new Dictionary<string, string[]> { {
"fresh mayonnaise",
new string[] { } } }
121 Name =
"Vinnies' Sour Flavors",
122 Address =
"830 Overtown Rd.",
124 IngredientsForItems =
new Dictionary<string, string[]> { {
"vinegar",
new string[] { } } }
129 Name =
"Jessie's Salt Works",
130 Address =
"920 Overtown Rd.",
132 IngredientsForItems =
new Dictionary<string, string[]> { {
"salt",
new string[] { } } }
140 foreach (var shop
in shops)
142 shop.Accept(visitor);
Represents a collection of shops that can be visited.
void LoadVillage()
Load the village.
List< Visitor_Shop > shops
List of Visitor_Shop class-derived shops in this village that can be visited.
string Name
Name of this village.
void Accept(Visitor visitor)
The visitor will call this method on each element it wants to visit.
Represent a butcher shop.
Represent a condiment grocer.
Represent a maker (of things).
Represent a pickle grocer.
Represent a restaurant shop.
Represent a vegetable grocer.
All visitors must implement this base class and then override one or more of the VisitXXX() methods,...
The interface that all element classes must implement if they are to participate in the visitor patte...
The namespace containing all Design Pattern Examples implemented in C#.