示例#1
0
 public void VisitGroup(Group @group)
 {
     if (@group.Address.Trim().Length == 0)
     {
         Console.WriteLine("Group visited, address is invalid");
     }
     else
     {
         Console.WriteLine("Group visited, address is valid");
     }
 }
示例#2
0
文件: Program.cs 项目: gobixm/learn
        private static void Main(string[] args)
        {
            IUnit root = new Group();
            root.SubUnits.Add(
                new Group
                {
                    SubUnits = new List<IUnit>
                    {
                        new Employee(),
                        new Employee(),
                        new Employee()
                    }
                }
                );
            root.SubUnits.Add(
                new Group
                {
                    SubUnits = new List<IUnit>
                    {
                        new Group
                        {
                            SubUnits = new List<IUnit>
                            {
                                new Employee(),
                                new Employee(),
                                new Employee()
                            }
                        },
                        new Employee()
                    }
                }
                );

            root.Print(0);
            root.SubUnits[1].Move("elkstreet 666");
            Console.WriteLine("moved to hell");
            root.Print(0);
            Console.WriteLine("address visitor:");
            root.Accept(new AddressValidationVisitor());
            Console.WriteLine("name visitor:");
            root.Accept(new NameValidationVisitor());

            Console.ReadKey();
        }
示例#3
0
 public void VisitGroup(Group @group)
 {
 }