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