using System;
using System.Collections;
namespace Netron.GraphLib.IO.NML
{
///
/// STC of string-value pairs, helpful in keeping a collection of properties with their value
///
public class PropertiesHashtable : DictionaryBase
{
///
/// keeps the collection of keys
///
private StringCollection mKeys = new StringCollection();
///
/// Gets the keys of the hashtable and
/// allows to loop over the keys without
/// boxing/unboxing.
///
public StringCollection Keys
{
get{return mKeys;}
}
///
/// Constructor
///
public PropertiesHashtable()
{
}
///
/// Adds a property-value pair
///
///
///
public void Add(string key, object propertyValue)
{
this.InnerHashtable.Add(key, propertyValue);
mKeys.Add(key);
}
///
/// Integer indexer
///
public object this[int index]
{
get{
if(mKeys[index]!=null)
{
return this.InnerHashtable[mKeys[index]];
}
else return null;
}
}
///
/// Removes an elements based on a key
///
/// a (string) key
///
public bool Remove(string key)
{
int index;
if((index=mKeys.Contains(key))>-1)
{
this.InnerHashtable.Remove(key);
this.mKeys.RemoveAt(index);
return true;
}
return false;
}
}
}