Browse Source

Final cleanup of Ix.

Bart De Smet 8 years ago
parent
commit
9d3b95336e

+ 1 - 4
Ix.NET/Source/System.Interactive/Max.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -105,4 +102,4 @@ namespace System.Linq
             return result;
         }
     }
-}
+}

+ 8 - 15
Ix.NET/Source/System.Interactive/Memoize.cs

@@ -2,12 +2,9 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -60,8 +57,7 @@ namespace System.Linq
             if (selector == null)
                 throw new ArgumentNullException(nameof(selector));
 
-            return Create(() => selector(source.Memoize())
-                              .GetEnumerator());
+            return Create(() => selector(source.Memoize()).GetEnumerator());
         }
 
         /// <summary>
@@ -113,11 +109,10 @@ namespace System.Linq
             if (selector == null)
                 throw new ArgumentNullException(nameof(selector));
 
-            return Create(() => selector(source.Memoize(readerCount))
-                              .GetEnumerator());
+            return Create(() => selector(source.Memoize(readerCount)).GetEnumerator());
         }
 
-        private class MemoizedBuffer<T> : IBuffer<T>
+        private sealed class MemoizedBuffer<T> : IBuffer<T>
         {
             private IRefCountList<T> _buffer;
             private bool _disposed;
@@ -245,9 +240,7 @@ namespace System.Linq
         }
     }
 
-
-
-    interface IRefCountList<T>
+    internal interface IRefCountList<T>
     {
         void Clear();
 
@@ -263,7 +256,7 @@ namespace System.Linq
         void Done(int index);
     }
 
-    class MaxRefCountList<T> : IRefCountList<T>
+    internal sealed class MaxRefCountList<T> : IRefCountList<T>
     {
         private IList<T> _list = new List<T>();
 
@@ -292,7 +285,7 @@ namespace System.Linq
         }
     }
 
-    class RefCountList<T> : IRefCountList<T>
+    internal sealed class RefCountList<T> : IRefCountList<T>
     {
         private int _readerCount;
         private readonly IDictionary<int, RefCount> _list;
@@ -360,10 +353,10 @@ namespace System.Linq
             _readerCount--;
         }
 
-        class RefCount
+        private sealed class RefCount
         {
             public int Count;
             public T Value;
         }
     }
-}
+}

+ 2 - 6
Ix.NET/Source/System.Interactive/Min.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -25,8 +22,7 @@ namespace System.Linq
             if (comparer == null)
                 throw new ArgumentNullException(nameof(comparer));
 
-            return MinBy(source, x => x, comparer)
-                .First();
+            return MinBy(source, x => x, comparer).First();
         }
 
         /// <summary>
@@ -68,4 +64,4 @@ namespace System.Linq
             return ExtremaBy(source, keySelector, (key, minValue) => -comparer.Compare(key, minValue));
         }
     }
-}
+}

+ 2 - 5
Ix.NET/Source/System.Interactive/OnErrorResumeNext.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -25,7 +22,7 @@ namespace System.Linq
             if (second == null)
                 throw new ArgumentNullException(nameof(second));
 
-            return OnErrorResumeNext_(new[] {first, second});
+            return OnErrorResumeNext_(new[] { first, second });
         }
 
         /// <summary>
@@ -84,4 +81,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Publish.cs

@@ -2,11 +2,8 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -185,4 +182,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Repeat.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -80,4 +77,4 @@ namespace System.Linq
                     yield return item;
         }
     }
-}
+}

+ 3 - 8
Ix.NET/Source/System.Interactive/Retry.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -22,8 +19,7 @@ namespace System.Linq
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
 
-            return new[] {source}.Repeat()
-                                 .Catch();
+            return new[] { source }.Repeat().Catch();
         }
 
         /// <summary>
@@ -41,8 +37,7 @@ namespace System.Linq
             if (retryCount < 0)
                 throw new ArgumentOutOfRangeException(nameof(retryCount));
 
-            return new[] {source}.Repeat(retryCount)
-                                 .Catch();
+            return new[] { source }.Repeat(retryCount).Catch();
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Return.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -22,4 +19,4 @@ namespace System.Linq
             yield return value;
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Scan.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -83,4 +80,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/SelectMany.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -29,4 +26,4 @@ namespace System.Linq
             return source.SelectMany(_ => other);
         }
     }
-}
+}

+ 3 - 7
Ix.NET/Source/System.Interactive/Share.cs

@@ -2,11 +2,8 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -56,11 +53,10 @@ namespace System.Linq
             if (selector == null)
                 throw new ArgumentNullException(nameof(selector));
 
-            return Create(() => selector(source.Share())
-                              .GetEnumerator());
+            return Create(() => selector(source.Share()).GetEnumerator());
         }
 
-        private class SharedBuffer<T> : IBuffer<T>
+        private sealed class SharedBuffer<T> : IBuffer<T>
         {
             private bool _disposed;
             private IEnumerator<T> _source;
@@ -125,4 +121,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Skip.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -43,4 +40,4 @@ namespace System.Linq
             }
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/StartsWith.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -35,4 +32,4 @@ namespace System.Linq
                 yield return item;
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Take.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -48,4 +45,4 @@ namespace System.Linq
                 yield return q.Dequeue();
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Throw.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -33,4 +30,4 @@ namespace System.Linq
 #pragma warning restore 0162
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/Using.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -37,4 +34,4 @@ namespace System.Linq
                     yield return item;
         }
     }
-}
+}

+ 1 - 4
Ix.NET/Source/System.Interactive/While.cs

@@ -2,10 +2,7 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace System.Linq
 {
@@ -35,4 +32,4 @@ namespace System.Linq
                 yield return source;
         }
     }
-}
+}