Refactoring EffectivityManager

A while ago i presented the EffectivityManager. Having used this class for a while i have decided to rename it to Temporal<T>. The implementation of IList<T> is not required anymore because a user is typically only interested in a specific effectivity, not the evolution of the effectivities.

/// <summary>
/// Represents an element that changes over time.
/// It consists out of effectivities of that element that are effective in different periods.
/// </summary>
public interface ITemporal<t>
{
 /// <summary>
 /// Modifies the element from the given date.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="from"></param>
 /// <returns></returns>
 void Modify(T element, DateTime from);

 /// <summary>
 /// Gets the effectivity that is valid on the given date.
 /// </summary>
 /// <param name="validityDate">The validity date.</param>
 /// <returns></returns>
 IEffectivity<t> GetSnapshot(DateTime validityDate);

 /// <summary>
 /// Tries to get the effectivity that is valid on the given date.
 /// </summary>
 /// <param name="validityDate"></param>
 /// <param name="effectivity"></param>
 /// <returns></returns>
 bool TryGetSnapshot(DateTime validityDate, out IEffectivity<t> effectivity);
}

In the implementation i have added a constructor that accepts a DiscreteValuesGenerator<DateTime> which makes it possible to create Periods with a resolution of a day instead of seconds.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>