//---------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
namespace System.Data.EntityModel.SchemaObjectModel
{
///
/// Summary description for SchemaElementLookUpTableEnumerator.
///
internal sealed class SchemaElementLookUpTableEnumerator: IEnumerator
where T : S
where S : SchemaElement
{
#region Instance Fields
private Dictionary _data = null;
private List.Enumerator _enumerator;
#endregion
#region Public Methods
///
///
///
///
///
public SchemaElementLookUpTableEnumerator(Dictionary data,List keysInOrder)
{
Debug.Assert(data != null, "data parameter is null");
Debug.Assert(keysInOrder != null, "keysInOrder parameter is null");
_data = data;
_enumerator = keysInOrder.GetEnumerator();
}
#endregion
#region IEnumerator Members
///
///
///
public void Reset()
{
// it is implemented explicitly
((IEnumerator)_enumerator).Reset();
}
///
///
///
public T Current
{
get
{
string key = _enumerator.Current;
return _data[key] as T;
}
}
object System.Collections.IEnumerator.Current
{
get
{
string key = _enumerator.Current;
return _data[key] as T;
}
}
///
///
///
///
public bool MoveNext()
{
while ( _enumerator.MoveNext() )
{
if ( Current != null )
return true;
}
return false;
}
#endregion
#region IDisposable Members
///
///
///
public void Dispose()
{
}
#endregion
}
}