Track what task is currently executed by a ThreadWorker and add the case for "parent...
[mono.git] / mcs / class / System.Core / System.Linq / Check.cs
1 //
2 // Check.cs
3 //
4 // Author:
5 //   Jb Evain (jbevain@novell.com)
6 //
7 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System;
30
31 namespace System.Linq {
32
33         static class Check {
34
35                 public static void Source (object source)
36                 {
37                         if (source == null)
38                                 throw new ArgumentNullException ("source");
39                 }
40
41                 public static void Source1AndSource2 (object source1,object source2)
42                 {
43                         if (source1 == null)
44                                 throw new ArgumentNullException ("source1");
45                         if (source2 == null)
46                                 throw new ArgumentNullException ("source2");
47                 }
48
49                 public static void SourceAndFuncAndSelector ( object source, object func, object selector)
50                 {
51                         if (source == null)
52                                 throw new ArgumentNullException ("source");
53                         if (func == null)
54                                 throw new ArgumentNullException ("func");
55                         if (selector == null)
56                                 throw new ArgumentNullException ("selector");
57                 }
58
59
60                 public static void SourceAndFunc (object source, object func)
61                 {
62                         if (source == null)
63                                 throw new ArgumentNullException ("source");
64                         if (func == null)
65                                 throw new ArgumentNullException ("func");
66                 }
67
68                 public static void SourceAndSelector (object source, object selector)
69                 {
70                         if (source == null)
71                                 throw new ArgumentNullException ("source");
72                         if (selector == null)
73                                 throw new ArgumentNullException ("selector");
74                 }
75
76                 public static void SourceAndPredicate (object source, object predicate)
77                 {
78                         if (source == null)
79                                 throw new ArgumentNullException ("source");
80                         if (predicate == null)
81                                 throw new ArgumentNullException ("predicate");
82                 }
83
84                 public static void FirstAndSecond (object first, object second)
85                 {
86                         if (first == null)
87                                 throw new ArgumentNullException ("first");
88                         if (second == null)
89                                 throw new ArgumentNullException ("second");
90                 }
91
92                 public static void SourceAndKeySelector (object source, object keySelector)
93                 {
94                         if (source == null)
95                                 throw new ArgumentNullException ("source");
96                         if (keySelector == null)
97                                 throw new ArgumentNullException ("keySelector");
98                 }
99
100                 public static void SourceAndKeyElementSelectors (object source, object keySelector, object elementSelector)
101                 {
102                         if (source == null)
103                                 throw new ArgumentNullException ("source");
104                         if (keySelector == null)
105                                 throw new ArgumentNullException ("keySelector");
106                         if (elementSelector == null)
107                                 throw new ArgumentNullException ("elementSelector");
108                 }
109                 public static void SourceAndKeyResultSelectors (object source, object keySelector, object resultSelector)
110                 {
111                         if (source == null)
112                                 throw new ArgumentNullException ("source");
113                         if (keySelector == null)
114                                 throw new ArgumentNullException ("keySelector");
115                         if (resultSelector == null)
116                                 throw new ArgumentNullException ("resultSelector");
117                 }
118
119                 public static void SourceAndCollectionSelectorAndResultSelector (object source, object collectionSelector, object resultSelector)
120                 {
121                         if (source == null)
122                                 throw new ArgumentNullException ("source");
123                         if (collectionSelector == null)
124                                 throw new ArgumentNullException ("collectionSelector");
125                         if (resultSelector == null)
126                                 throw new ArgumentNullException ("resultSelector");
127                 }
128
129                 public static void SourceAndCollectionSelectors (object source, object collectionSelector, object selector)
130                 {
131                         if (source == null)
132                                 throw new ArgumentNullException ("source");
133                         if (collectionSelector == null)
134                                 throw new ArgumentNullException ("collectionSelector");
135                         if (selector == null)
136                                 throw new ArgumentNullException ("selector");
137                 }
138
139                 public static void JoinSelectors (object outer, object inner, object outerKeySelector, object innerKeySelector, object resultSelector)
140                 {
141                         if (outer == null)
142                                 throw new ArgumentNullException ("outer");
143                         if (inner == null)
144                                 throw new ArgumentNullException ("inner");
145                         if (outerKeySelector == null)
146                                 throw new ArgumentNullException ("outerKeySelector");
147                         if (innerKeySelector == null)
148                                 throw new ArgumentNullException ("innerKeySelector");
149                         if (resultSelector == null)
150                                 throw new ArgumentNullException ("resultSelector");
151                 }
152
153                 public static void GroupBySelectors (object source, object keySelector, object elementSelector, object resultSelector)
154                 {
155                         if (source == null)
156                                 throw new ArgumentNullException ("source");
157                         if (keySelector == null)
158                                 throw new ArgumentNullException ("keySelector");
159                         if (elementSelector == null)
160                                 throw new ArgumentNullException ("elementSelector");
161                         if (resultSelector == null)
162                                 throw new ArgumentNullException ("resultSelector");
163                 }
164         }
165 }