Esempio n. 1
0
        static void Main(string[] args)
        {
            var firsts = new List<IColor>
            {
                new Red(),
                new Green(),
                new Blue()
            };

            var seconds = new List<IColor>
            {
                new Red(),
                new Green(),
                new Blue()
            };

            var firstVisitor = new FirstVisitor(new ColorProcessor());

            foreach (var first in firsts)
            {
                var secondVisitor = first.AcceptVisitor(firstVisitor);

                foreach (var second in seconds)
                {
                    Console.WriteLine(second.AcceptVisitor(secondVisitor));
                }
            }
        }
Esempio n. 2
0
            VisitStatus IPropertyVisitor.VisitProperty <TProperty2, TContainer2, TValue2>(TProperty2 property, ref TContainer2 container, ref ChangeTracker changeTracker)
            {
                if (visitedFirst)
                {
                    return(VisitStatus.Handled);
                }
                if (!Result)
                {
                    return(VisitStatus.Handled);
                }
                visitedFirst = true;

                if (property.IsContainer)
                {
                    var bag = PropertyBagResolver.Resolve <TValue2>();
                    if (bag != null)
                    {
                        var ct       = new ChangeTracker();
                        var v        = property.GetValue(ref container);
                        var visitor2 = new FirstVisitor(Visitor);
                        bag.Accept(ref v, ref visitor2, ref ct);
                        Result = visitor2.Result;
                    }
                }
                return(VisitStatus.Handled);
            }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var firsts = new List <IColor>
            {
                new Red(),
                new Green(),
                new Blue()
            };

            var seconds = new List <IColor>
            {
                new Red(),
                new Green(),
                new Blue()
            };

            var firstVisitor = new FirstVisitor(new ColorProcessor());

            foreach (var first in firsts)
            {
                var secondVisitor = first.AcceptVisitor(firstVisitor);

                foreach (var second in seconds)
                {
                    Console.WriteLine(second.AcceptVisitor(secondVisitor));
                }
            }
        }
Esempio n. 4
0
            VisitStatus IPropertyVisitor.VisitCollectionProperty <TProperty2, TContainer2, TValue2>(TProperty2 property, ref TContainer2 container, ref ChangeTracker changeTracker)
            {
                if (visitedFirst)
                {
                    return(VisitStatus.Handled);
                }
                if (!Result)
                {
                    return(VisitStatus.Handled);
                }
                visitedFirst = true;

                var visitor2 = new FirstVisitor(Visitor);
                var vs       = visitor2.VisitCollectionProperty <TProperty2, TContainer2, TValue2>(property, ref container, ref changeTracker);

                Result = visitor2.Result;
                return(vs);
            }