// 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 Accept(Visitor v) { IEnumerator it = GetEnumerator(); while (it.MoveNext()) { Element a = (Element)it.Current; a.Accept(v); } }
private QueryPhaseArgs VisitChild(Element node, QueryPhaseArgs arg) { if (node != null) { _visitStack.Push(arg); node.Accept(this); return(_visitStack.Pop()); } return(null); }
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); }
public void CountElements(Element element) { element.Accept(this); if (element.Link != null) CountElements(element.Link); if (element.Next != null) CountElements(element.Next); }