|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace NAnt.SMAnalyzerTasks
{
/// <summary>
/// Class that contains the list of Threshold objects for a given file.
/// </summary>
class FileThresholds
{
private string m_sFileName= "";
private Hashtable m_Thresholds = new Hashtable(15);
#region Constructors
public FileThresholds()
{
}
public FileThresholds(string sFileName)
{
m_sFileName = sFileName;
}
/// <summary>
/// Copy constructor.
/// </summary>
public FileThresholds(FileThresholds oOther)
{
m_sFileName = oOther.FileName;
m_Thresholds = (Hashtable)oOther.Thresholds.Clone();
}
#endregion
/// <summary>
/// Add a new Threshold to the given object.
/// <br>If a Threshold with the same id already exist it will be overwritten</br>
/// </summary>
public void AddThreshold(Threshold oThreshold)
{
_AddThreshold(oThreshold);
}
/// <summary>
/// Remove the Threshold having the given ID intot the current object.
/// </summary>
public void RemoveThreshold(string sId)
{
if (null != m_Thresholds)
{
if(m_Thresholds.ContainsKey(sId))
{
m_Thresholds.Remove(sId);
}
}
}
public string FileName
{
get { return m_sFileName; }
set { m_sFileName = value; }
}
public Hashtable Thresholds
{
get
{
return m_Thresholds;
}
}
/// <summary>
/// Add the given Threshold to the current object.
/// <br>Check if it already exist to overwrite</br>
/// </summary>
private void _AddThreshold(Threshold oThreshold)
{
if (null != m_Thresholds)
{
if(true==m_Thresholds.ContainsKey(oThreshold.ID))
{
//object already exist
//destroy
m_Thresholds.Remove(oThreshold.ID);
//overwrite it
m_Thresholds.Add(oThreshold.ID, oThreshold);
}
else
{
m_Thresholds.Add(oThreshold.ID, oThreshold);
}
}
}
}
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.