using System.Collections; namespace Ilog.Language.Util { /** * This is a naive (linear) associative table data structure one can * use pretty much as one would a hash table although with poorer * performance, but with a predictable order of enumeration. This is * useful for debugging purposes when one needs to compare the traces * of two identical processes whose order of execution depend on hash * table enumerations. */ public class Table { private ArrayList keys; private ArrayList values; public Table () { keys = new ArrayList(); values = new ArrayList(); } public Table (int cap) { keys = new ArrayList(cap); values = new ArrayList(cap); } public object this [object key] { get { int index = keys.IndexOf(key); return index == -1 ? null : values[index]; } set { keys.Add(key); values.Add(value); } } public int Count { get { return keys.Count; } } public ArrayList Values { get { return values; } } } }