Accept() public abstract method

public abstract Accept ( Visitor, visitor ) : void
visitor Visitor,
return void
示例#1
0
        // Extension method: Call via "ast.Print(writer)".
        public static void Print(this Element ast, TextWriter writer)
        {
            // Create a new printer that wraps the writer.
            var printer = new Printer(writer);

            // Visit the AST recursively.
            ast.Accept(printer);
        }
        public void ConcreteVisitorBTest()
        {
            ConcreteVisitorB visitor     = new ConcreteVisitorB();
            Element          composition = BuildComposition();

            composition.Accept(visitor);
            Assert.AreEqual("ElementC;ElementA;ElementC;ElementA;ElementB;", visitor.GetTrace());
        }
 public void DisplayElementsNames(Element element)
 {
     element.Accept(this);
     if (element.Next != null)
     {
         DisplayElementsNames(element.Next);
     }
 }
        public void ConcreteVisitorATest()
        {
            ConcreteVisitorA visitor     = new ConcreteVisitorA();
            Element          composition = BuildComposition();

            composition.Accept(visitor);
            Assert.AreEqual(5, visitor.VisitCount);
        }
 public void DisplayElementsNames(Element element)
 {
     element.Accept(this);
     if (element.Next != null)
     {
         DisplayElementsNames(element.Next);
     }
 }
示例#6
0
        public void Accept(Visitor v)
        {
            IEnumerator it = GetEnumerator();

            while (it.MoveNext())
            {
                Element a = (Element)it.Current;
                a.Accept(v);
            }
        }
示例#7
0
        private QueryPhaseArgs VisitChild(Element node, QueryPhaseArgs arg)
        {
            if (node != null)
            {
                _visitStack.Push(arg);
                node.Accept(this);
                return(_visitStack.Pop());
            }

            return(null);
        }
示例#8
0
 public void CountElements(Element element)
 {
     element.Accept(this);
     if (element.Link != null)
     {
         CountElements(element.Link);
     }
     if (element.Next != null)
     {
         CountElements(element.Next);
     }
 }
 GlowContainer ElementToGlow(Element element, ElementToGlowOptions options)
 {
     return(element.Accept(this, options));
 }
 public override void Accept(IVisitor visitor)
 {
     Element.Accept(visitor);
     visitor.Visit(this);
 }
示例#11
0
 public void CountElements(Element element)
 {
     element.Accept(this);
     if (element.Link != null) CountElements(element.Link);
     if (element.Next != null) CountElements(element.Next);
 }