2 using System
.Diagnostics
;
3 using SCG
= System
.Collections
.Generic
;
5 public abstract class EnumerableBase
<T
> : SCG
.IEnumerable
<T
>
7 public abstract SCG
.IEnumerator
<T
> GetEnumerator ();
9 System
.Collections
.IEnumerator System
.Collections
.IEnumerable
.GetEnumerator ()
11 return GetEnumerator ();
15 public abstract class CollectionValueBase
<T
> : EnumerableBase
<T
>
17 protected virtual void raiseItemsAdded (T item
, int count
)
20 protected class RaiseForRemoveAllHandler
22 CircularQueue
<T
> wasRemoved
;
25 public override abstract SCG
.IEnumerator
<T
> GetEnumerator();
28 public class CircularQueue
<T
> : EnumerableBase
<T
>
30 public override SCG
.IEnumerator
<T
> GetEnumerator()
35 public virtual void Enqueue (T item
)
39 public class HashSet
<T
> : CollectionValueBase
<T
>
41 private bool searchoradd (ref T item
, bool add, bool update
, bool raise
)
46 public virtual void RemoveAll
<U
>(SCG
.IEnumerable
<U
> items
) where U
: T
48 RaiseForRemoveAllHandler raiseHandler
= new RaiseForRemoveAllHandler ();
51 public virtual void AddAll
<U
> (SCG
.IEnumerable
<U
> items
)
54 CircularQueue
<T
> wasAdded
= new CircularQueue
<T
> ();
56 foreach (T item
in wasAdded
)
57 raiseItemsAdded (item
, 1);
60 public override SCG
.IEnumerator
<T
> GetEnumerator()
68 public static void Main ()