/*
Copyright 2007-2013 The NGenerics Team
(https://github.com/ngenerics/ngenerics/wiki/Team)
This program is licensed under the GNU Lesser General Public License (LGPL). You should
have received a copy of the license along with the source code. If not, an online copy
of the license can be found at http://www.gnu.org/copyleft/lesser.html.
*/
using System.Collections.Generic;
namespace NGenerics.Patterns.Visitor
{
///
/// A visitor that tracks (stores) objects in the order they were visited.
/// Handy for demonstrating and testing different ordered visits implementations on
/// data structures.
///
/// The type of objects to be visited.
public sealed class TrackingVisitor : IVisitor
{
#region Globals
private readonly List tracks;
#endregion
#region Construction
///
public TrackingVisitor()
{
tracks = new List();
}
#endregion
#region IVisitor Members
///
public void Visit(T obj)
{
tracks.Add(obj);
}
///
public bool HasCompleted {
get
{
return false;
}
}
#endregion
#region Public Members
///
/// Gets the tracking list.
///
/// The tracking list.
public IList TrackingList
{
get
{
return tracks;
}
}
#endregion
}
}