/// <summary> /// Pretty prints a <see cref="CompareNode"/> to a specified writer. /// </summary> /// <param name="node">The root of the tree to print.</param> /// <param name="writer">A writer that will be used for displaying the resulting text.</param> public static void PrettyPrint(this CompareNode node, PrettyWriter writer) { var visitor = new CompareNodePrettyTreeVisitor(); node.Accept(visitor); writer.Execute(visitor.Result); }
/// <summary> /// Visits a single <see cref="CompareNode"/> and produces a value of type <typeparamref name="TResult"/>. /// </summary> /// <param name="node">The node to visit.</param> /// <returns>If the node was not null, the value produced by visiting it. Otherwise, the default value of <typeparamref name="TResult"/>.</returns> public virtual TResult Visit(CompareNode node) { if (node != null) { return(node.Accept(this)); } return(default(TResult)); }
public virtual void Visit(CompareNode node) => node.Accept(this);