|
using System;
using System.Collections.Generic;
using System.Text;
namespace DataStructuresDotNet.Visitors
{
/// <summary>
/// A visitor that visits objects only in pre order.
/// </summary>
/// <typeparam name="T"></typeparam>
public sealed class PreOrderVisitor<T> : OrderedVisitor<T>
{
#region Construction
/// <summary>
/// Initializes a new instance of the <see cref="PreOrderVisitor<T>"/> class.
/// </summary>
/// <param name="visitor">The visitor to use when visiting the object.</param>
public PreOrderVisitor(IVisitor<T> visitor) : base(visitor) { }
#endregion
#region OrderedVisitor<T> Members
/// <summary>
/// Visits the object in order.
/// </summary>
/// <param name="obj">The obj.</param>
public override void VisitInOrder(T obj)
{
// Do nothing.
}
/// <summary>
/// Visits the object in post order.
/// </summary>
/// <param name="obj">The obj.</param>
public override void VisitPostOrder(T obj)
{
// Do nothing.
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
The author is a software consultant in South Africa, specializing in bespoke software solutions.