diff --git a/Antlr4.Runtime/Atn/ATNConfigSet.cs b/Antlr4.Runtime/Atn/ATNConfigSet.cs
index 5a2140a48..9dd84b6fd 100644
--- a/Antlr4.Runtime/Atn/ATNConfigSet.cs
+++ b/Antlr4.Runtime/Atn/ATNConfigSet.cs
@@ -33,11 +33,13 @@ using System.Text;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Misc;
using Sharpen;
+using IEnumerable = System.Collections.IEnumerable;
+using IEnumerator = System.Collections.IEnumerator;
namespace Antlr4.Runtime.Atn
{
/// Sam Harwell
- public class ATNConfigSet : ISet
+ public class ATNConfigSet : IEnumerable
{
///
/// This maps (state, alt) -> merged
@@ -301,7 +303,12 @@ namespace Antlr4.Runtime.Atn
public virtual IEnumerator GetEnumerator()
{
- return new ATNConfigSet.ATNConfigSetIterator(this);
+ return configs.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
}
public virtual object[] ToArray()
@@ -446,13 +453,12 @@ namespace Antlr4.Runtime.Atn
return true;
}
- public virtual bool AddAll<_T0>(ICollection<_T0> c) where _T0:ATNConfig
+ public virtual bool AddAll(IEnumerable c)
{
return AddAll(c, null);
}
- public virtual bool AddAll<_T0>(ICollection<_T0> c, PredictionContextCache contextCache
- ) where _T0:ATNConfig
+ public virtual bool AddAll(IEnumerable c, PredictionContextCache contextCache)
{
EnsureWritable();
bool changed = false;
diff --git a/Antlr4.Runtime/Dfa/AbstractEdgeMap`1.cs b/Antlr4.Runtime/Dfa/AbstractEdgeMap`1.cs
index 6db6c0542..02b061853 100644
--- a/Antlr4.Runtime/Dfa/AbstractEdgeMap`1.cs
+++ b/Antlr4.Runtime/Dfa/AbstractEdgeMap`1.cs
@@ -114,5 +114,15 @@ namespace Antlr4.Runtime.Dfa
public abstract int Size();
public abstract IDictionary ToMap();
+
+ public virtual IEnumerator> GetEnumerator()
+ {
+ return ToMap().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
}
}
diff --git a/Antlr4.Runtime/Dfa/DFASerializer.cs b/Antlr4.Runtime/Dfa/DFASerializer.cs
index d982e0851..bbf03ef8f 100644
--- a/Antlr4.Runtime/Dfa/DFASerializer.cs
+++ b/Antlr4.Runtime/Dfa/DFASerializer.cs
@@ -85,8 +85,8 @@ namespace Antlr4.Runtime.Dfa
states.Sort(new _IComparer_85());
foreach (DFAState s in states)
{
- IDictionary edges = s.EdgeMap;
- IDictionary contextEdges = s.ContextEdgeMap;
+ IEnumerable> edges = s.EdgeMap;
+ IEnumerable> contextEdges = s.ContextEdgeMap;
foreach (KeyValuePair entry in edges)
{
if ((entry.Value == null || entry.Value == ATNSimulator.Error) && !s.IsContextSymbol
diff --git a/Antlr4.Runtime/Dfa/IEdgeMap`1.cs b/Antlr4.Runtime/Dfa/IEdgeMap`1.cs
index 52f79e464..141cb896a 100644
--- a/Antlr4.Runtime/Dfa/IEdgeMap`1.cs
+++ b/Antlr4.Runtime/Dfa/IEdgeMap`1.cs
@@ -35,7 +35,7 @@ using Sharpen;
namespace Antlr4.Runtime.Dfa
{
/// Sam Harwell
- public interface IEdgeMap
+ public interface IEdgeMap : IEnumerable>
{
int Size();