Remove wrong using
[mono.git] / mcs / class / System.Core / System.Linq.Parallel.QueryNodes / QueryOrderGuardNode.cs
1 // QueryOrderGuardNode.cs
2 //
3 // Author:
4 //       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
5 //
6 // Copyright (c) 2010 Jérémie "Garuma" Laval
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 // THE SOFTWARE.
25
26 #if NET_4_0
27 using System;
28 using System.Collections.Generic;
29
30 namespace System.Linq.Parallel.QueryNodes
31 {
32         internal abstract class QueryOrderGuardNode<T> : QueryStreamNode<T, T>
33         {
34                 bool ensureOrder;
35
36                 internal QueryOrderGuardNode (QueryBaseNode<T> parent, bool ensureOrder)
37                         : base (parent, ensureOrder)
38                 {
39                         this.ensureOrder = ensureOrder;
40                 }
41
42                 public bool EnsureOrder {
43                         get {
44                                 return ensureOrder;
45                         }
46                 }
47
48                 internal override IEnumerable<T> GetSequential ()
49                 {
50                         return Parent.GetSequential ();
51                 }
52
53                 public override void Visit (INodeVisitor visitor)
54                 {
55                         visitor.Visit<T> (this);
56                 }
57         }
58
59         internal class QueryAsUnorderedNode<T> : QueryOrderGuardNode<T>
60         {
61                 internal QueryAsUnorderedNode (QueryBaseNode<T> parent)
62                         : base (parent, false)
63                 {
64
65                 }
66
67                 internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
68                 {
69                         return Parent.GetEnumerables (options);
70                 }
71
72                 internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
73                 {
74                         return Parent.GetOrderedEnumerables (options);
75                 }
76
77         }
78
79         internal class QueryAsOrderedNode<T> : QueryOrderGuardNode<T>
80         {
81                 internal QueryAsOrderedNode (QueryBaseNode<T> parent)
82                         : base (parent, true)
83                 {
84
85                 }
86
87                 internal override IList<IEnumerable<T>> GetEnumerables (QueryOptions options)
88                 {
89                         return Parent.GetEnumerables (options);
90                 }
91
92                 internal override IList<IEnumerable<KeyValuePair<long, T>>> GetOrderedEnumerables (QueryOptions options)
93                 {
94                         return Parent.GetOrderedEnumerables (options);
95                 }
96
97         }
98 }
99 #endif