(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / mbas / statementCollection.cs
blob352cb132b59dd8ecd0f74e28e7b1e4a24072c4ea
1 //
2 // System.CodeDOM CodeStatementCollection Class implementation
3 //
4 // Author:
5 // Miguel de Icaza (miguel@ximian.com)
6 //
7 // (C) 2001 Ximian, Inc.
8 //
10 namespace Mono.MonoBASIC {
12 using System.Collections;
13 using System;
15 public class StatementCollection : IList, ICollection, IEnumerable {
17 ArrayList statements;
20 // Constructors
22 public StatementCollection ()
24 statements = new ArrayList ();
28 // Properties
30 public int Count {
31 get {
32 return statements.Count;
37 // Methods
39 public void Add (Statement value)
41 statements.Add (value);
44 public void AddRange (Statement [] values)
46 foreach (Statement ca in values)
47 statements.Add (ca);
51 public void Clear ()
53 statements.Clear ();
56 private class Enumerator : IEnumerator {
57 private StatementCollection collection;
58 private int currentIndex = -1;
60 internal Enumerator (StatementCollection collection)
62 this.collection = collection;
65 public object Current {
66 get {
67 if (currentIndex == collection.Count)
68 throw new InvalidOperationException ();
69 return collection [currentIndex];
73 public bool MoveNext ()
75 if (currentIndex > collection.Count)
76 throw new InvalidOperationException ();
77 return ++currentIndex < collection.Count;
80 public void Reset ()
82 currentIndex = -1;
86 public IEnumerator GetEnumerator ()
88 return new StatementCollection.Enumerator (this);
92 // IList method implementations
94 public int Add (object value)
96 return statements.Add (value);
99 public bool Contains (Object value)
101 return statements.Contains (value);
104 public int IndexOf (Object value)
106 return statements.IndexOf (value);
109 public void Insert (int index, Object value)
111 statements [index] = value;
114 public object this[int index] {
115 get {
116 return statements [index];
119 set {
120 statements [index] = value;
124 public void Remove (object value)
126 statements.Remove (value);
129 public void RemoveAt (int index)
131 statements.RemoveAt (index);
135 // ICollection method implementations
137 public void CopyTo (Array array, int index)
139 statements.CopyTo (array, index);
142 public object SyncRoot {
143 get {
144 return statements.SyncRoot;
148 public bool IsReadOnly {
149 get {
150 return false;
154 public bool IsSynchronized {
155 get {
156 return statements.IsSynchronized;
160 public bool IsFixedSize {
161 get {
162 return false;