using System;
using System.Collections.Generic;
namespace Substrate
{
///
/// Provides read-only indexed access to an underlying resource.
///
/// The type of the underlying resource.
public interface ICacheTable
{
///
/// Gets the value at the given index.
///
/// The index to fetch.
T this[int index] { get; }
}
/*internal class CacheTableArray : ICacheTable
{
private T[] _cache;
public T this[int index]
{
get { return _cache[index]; }
}
public CacheTableArray (T[] cache)
{
_cache = cache;
}
}
internal class CacheTableDictionary : ICacheTable
{
private Dictionary _cache;
private static Random _rand = new Random();
public T this[int index]
{
get
{
T val;
if (_cache.TryGetValue(index, out val)) {
return val;
}
return default(T);
}
}
public CacheTableDictionary (Dictionary cache)
{
_cache = cache;
}
}
///
/// Provides read-only indexed access to an underlying resource.
///
/// The type of the underlying resource.
public class CacheTable
{
ICacheTable _cache;
///
/// Gets the value at the given index.
///
///
public T this[int index]
{
get { return _cache[index]; }
}
internal CacheTable (T[] cache)
{
_cache = new CacheTableArray(cache);
}
internal CacheTable (Dictionary cache)
{
_cache = new CacheTableDictionary(cache);
}
}*/
}