// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
/*
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) keys from KeyValuePAirs in the order they were visited.
///
/// The type of the keys for the items to be visited.
/// The type of the values for the items to be visited.
public sealed class KeyTrackingVisitor : IVisitor>
{
#region Globals
private readonly List _tracks;
#endregion
#region Construction
///
public KeyTrackingVisitor()
{
_tracks = new List();
}
#endregion
#region Public Members
///
/// Gets the tracking list.
///
/// The tracking list.
public IList TrackingList => _tracks;
#endregion
#region IVisitor> Members
///
public void Visit(KeyValuePair obj)
{
_tracks.Add(obj.Key);
}
///
public bool HasCompleted => false;
#endregion
}
}