|
// Martijn Boeker, July 14, 2009
// License: The Code Project Open License (CPOL) 1.02
using System;
using System.Collections.Generic;
using System.Text;
namespace MB.Propagators
{
/// <summary>
/// Encapsulates state change to be propagated. The StateChangeTypeID is used by the
/// Propagator class to dispatch state change handler methods.
/// </summary>
public class StateChange
{
#region Data Members
private readonly int _stateChangeTypeID;
private List<IPropagator> _observedBy = new List<IPropagator>();
#endregion
#region Constructors
/// <summary>
/// Constructor.
/// </summary>
/// <param name="stateChangeTypeID">Identifies type of state change.</param>
public StateChange(int stateChangeTypeID)
{
_stateChangeTypeID = stateChangeTypeID;
}
#endregion
#region Properties
/// <summary>
/// ID of the type of command.
/// </summary>
public int StateChangeTypeID
{
get
{
return _stateChangeTypeID;
}
}
#endregion
#region Methods
/// <summary>
/// Indicate that the given propagator has observed this command.
/// </summary>
/// <param name="propagator"></param>
public void AddObservedBy(IPropagator propagator)
{
_observedBy.Add(propagator);
}
/// <summary>
/// Find out if the given propagator has observed this command.
/// </summary>
/// <param name="propagator"></param>
/// <returns></returns>
public bool HasBeenObservedBy(IPropagator propagator)
{
return _observedBy.Contains(propagator);
}
#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.
Grew up in Amsterdam, now living in downtown Vancouver. There are definitely more mountains here.
My first internship was with the first company in the Netherlands to teach C++ (www.datasim.nl). During this internship I got to know Object Oriented Design, which kept my interest until this day. In the mean time, I have worked for different companies in the Netherlands and Canada. I have done most of my recent work in C#, developing Database/Web/Desktop applications.
I am currently working as a freelance Software Developer for PHI International in Amsterdam.
The CodeProject rocks!