[PLinq] Reflect directory hierarchy change on namespace names
[mono.git] / mcs / class / System.Core / System.Linq.Parallel / QueryOptions.cs
1 //
2 // QueryOptions.cs
3 //
4 // Author:
5 //       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
6 //
7 // Copyright (c) 2010 Jérémie "Garuma" Laval
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26
27 #if NET_4_0
28 using System;
29 using System.Threading;
30
31 namespace System.Linq.Parallel
32 {
33         internal class QueryOptions
34         {
35                 public ParallelMergeOptions? Options;
36                 public ParallelExecutionMode? Mode;
37                 public CancellationToken Token;
38                 /* This token is to be used by some operator (like Take) to tell that
39                  * the execution of the query can be prematurly stopped
40                  *
41                  * It is set when passing QueryOptions to the different node's Get method
42                  * and ParallelExecuter should check after the call to this method is this guy has been
43                  * set. Operator may chain up multiple cancellation token that way.
44                  * When checking for this token, the task body should simply return.
45                  */
46                 public CancellationToken ImplementerToken;
47                 public bool UseStrip;
48                 public bool? BehindOrderGuard;
49                 public int PartitionCount;
50                 public Tuple<bool, bool, bool> PartitionerSettings;
51
52                 public QueryOptions (ParallelMergeOptions? options,
53                                      ParallelExecutionMode? mode,
54                                      CancellationToken token,
55                                      bool useStrip,
56                                      bool? behindOrderGuard,
57                                      int partitionCount,
58                                      CancellationToken implementerToken)
59                 {
60                         Options = options;
61                         Mode = mode;
62                         Token = token;
63                         UseStrip = useStrip;
64                         BehindOrderGuard = behindOrderGuard;
65                         PartitionCount = partitionCount;
66                         PartitionerSettings = null;
67                         ImplementerToken = implementerToken;
68                 }
69         }
70 }
71 #endif