comparison Source/Common/Operator.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2 using System.Data.SqlTypes;
3
4 namespace BLToolkit.Common
5 {
6 public static class Operator<T>
7 {
8 public static IOperable<T> Op = GetOperable();
9 private static IOperable<T> GetOperable()
10 {
11 Type t = typeof(T);
12
13 // Scalar types.
14 //
15 if (t == typeof(String)) return (IOperable<T>)new S();
16
17 if (t == typeof(SByte)) return (IOperable<T>)new S8();
18 if (t == typeof(Int16)) return (IOperable<T>)new S16();
19 if (t == typeof(Int32)) return (IOperable<T>)new S32();
20 if (t == typeof(Int64)) return (IOperable<T>)new S64();
21
22 if (t == typeof(Byte)) return (IOperable<T>)new U8();
23 if (t == typeof(UInt16)) return (IOperable<T>)new U16();
24 if (t == typeof(UInt32)) return (IOperable<T>)new U32();
25 if (t == typeof(UInt64)) return (IOperable<T>)new U64();
26
27 if (t == typeof(bool)) return (IOperable<T>)new B();
28 if (t == typeof(Char)) return (IOperable<T>)new C();
29 if (t == typeof(Single)) return (IOperable<T>)new R4();
30 if (t == typeof(Double)) return (IOperable<T>)new R8();
31
32 if (t == typeof(Decimal)) return (IOperable<T>)new D();
33 if (t == typeof(DateTime)) return (IOperable<T>)new DT();
34 if (t == typeof(TimeSpan)) return (IOperable<T>)new TS();
35 if (t == typeof(Guid)) return (IOperable<T>)new G();
36
37 // Nullable types.
38 //
39 if (t == typeof(SByte?)) return (IOperable<T>)new NS8();
40 if (t == typeof(Int16?)) return (IOperable<T>)new NS16();
41 if (t == typeof(Int32?)) return (IOperable<T>)new NS32();
42 if (t == typeof(Int64?)) return (IOperable<T>)new NS64();
43
44 if (t == typeof(Byte?)) return (IOperable<T>)new NU8();
45 if (t == typeof(UInt16?)) return (IOperable<T>)new NU16();
46 if (t == typeof(UInt32?)) return (IOperable<T>)new NU32();
47 if (t == typeof(UInt64?)) return (IOperable<T>)new NU64();
48
49 if (t == typeof(bool?)) return (IOperable<T>)new NB();
50 if (t == typeof(Char?)) return (IOperable<T>)new NC();
51 if (t == typeof(Single?)) return (IOperable<T>)new NR4();
52 if (t == typeof(Double?)) return (IOperable<T>)new NR8();
53
54 if (t == typeof(Decimal?)) return (IOperable<T>)new ND();
55 if (t == typeof(DateTime?)) return (IOperable<T>)new NDT();
56 if (t == typeof(TimeSpan?)) return (IOperable<T>)new NTS();
57 if (t == typeof(Guid?)) return (IOperable<T>)new NG();
58
59 // Sql types.
60 //
61 if (t == typeof(SqlString)) return (IOperable<T>)new DBS();
62
63 if (t == typeof(SqlByte)) return (IOperable<T>)new DBU8();
64 if (t == typeof(SqlInt16)) return (IOperable<T>)new DBS16();
65 if (t == typeof(SqlInt32)) return (IOperable<T>)new DBS32();
66 if (t == typeof(SqlInt64)) return (IOperable<T>)new DBS64();
67
68 if (t == typeof(SqlSingle)) return (IOperable<T>)new DBR4();
69 if (t == typeof(SqlDouble)) return (IOperable<T>)new DBR8();
70 if (t == typeof(SqlDecimal)) return (IOperable<T>)new DBD();
71 if (t == typeof(SqlMoney)) return (IOperable<T>)new DBM();
72
73 if (t == typeof(SqlBoolean)) return (IOperable<T>)new DBB();
74 if (t == typeof(SqlBinary)) return (IOperable<T>)new DBBin();
75 if (t == typeof(SqlDateTime)) return (IOperable<T>)new DBDT();
76 if (t == typeof(SqlGuid)) return (IOperable<T>)new DBG();
77
78 return new Default<T>();
79 }
80
81 public static T Addition (T op1, T op2) { return Op.Addition (op1, op2); }
82 public static T Subtraction (T op1, T op2) { return Op.Subtraction (op1, op2); }
83 public static T Multiply (T op1, T op2) { return Op.Multiply (op1, op2); }
84 public static T Division (T op1, T op2) { return Op.Division (op1, op2); }
85 public static T Modulus (T op1, T op2) { return Op.Modulus (op1, op2); }
86
87 public static T BitwiseAnd (T op1, T op2) { return Op.BitwiseAnd (op1, op2); }
88 public static T BitwiseOr (T op1, T op2) { return Op.BitwiseOr (op1, op2); }
89 public static T ExclusiveOr (T op1, T op2) { return Op.ExclusiveOr (op1, op2); }
90
91 public static T UnaryNegation (T op) { return Op.UnaryNegation (op); }
92 public static T OnesComplement (T op) { return Op.OnesComplement (op); }
93
94 public static bool Equality (T op1, T op2) { return Op.Equality (op1, op2); }
95 public static bool Inequality (T op1, T op2) { return Op.Inequality (op1, op2); }
96 public static bool GreaterThan (T op1, T op2) { return Op.GreaterThan (op1, op2); }
97 public static bool GreaterThanOrEqual(T op1, T op2) { return Op.GreaterThanOrEqual(op1, op2); }
98 public static bool LessThan (T op1, T op2) { return Op.LessThan (op1, op2); }
99 public static bool LessThanOrEqual (T op1, T op2) { return Op.LessThanOrEqual (op1, op2); }
100
101 #region Default
102
103 private class Default<Q> : IOperable<Q>
104 {
105 public Q Addition (Q op1, Q op2) { throw new InvalidOperationException(); }
106 public Q Subtraction (Q op1, Q op2) { throw new InvalidOperationException(); }
107 public Q Multiply (Q op1, Q op2) { throw new InvalidOperationException(); }
108 public Q Division (Q op1, Q op2) { throw new InvalidOperationException(); }
109 public Q Modulus (Q op1, Q op2) { throw new InvalidOperationException(); }
110
111 public Q BitwiseAnd (Q op1, Q op2) { throw new InvalidOperationException(); }
112 public Q BitwiseOr (Q op1, Q op2) { throw new InvalidOperationException(); }
113 public Q ExclusiveOr (Q op1, Q op2) { throw new InvalidOperationException(); }
114
115 public Q UnaryNegation (Q op) { throw new InvalidOperationException(); }
116 public Q OnesComplement (Q op) { throw new InvalidOperationException(); }
117
118 public bool Equality (Q op1, Q op2) { throw new InvalidOperationException(); }
119 public bool Inequality (Q op1, Q op2) { throw new InvalidOperationException(); }
120 public bool GreaterThan (Q op1, Q op2) { throw new InvalidOperationException(); }
121 public bool GreaterThanOrEqual(Q op1, Q op2) { throw new InvalidOperationException(); }
122 public bool LessThan (Q op1, Q op2) { throw new InvalidOperationException(); }
123 public bool LessThanOrEqual (Q op1, Q op2) { throw new InvalidOperationException(); }
124 }
125
126 #endregion
127
128 #region Scalar Types.
129
130 #region String
131
132 private class S : IOperable<String>
133 {
134 public String Addition (String op1, String op2) { return (op1 + op2); }
135 public String Subtraction (String op1, String op2) { throw new InvalidOperationException(); }
136 public String Multiply (String op1, String op2) { throw new InvalidOperationException(); }
137 public String Division (String op1, String op2) { throw new InvalidOperationException(); }
138 public String Modulus (String op1, String op2) { throw new InvalidOperationException(); }
139
140 public String BitwiseAnd (String op1, String op2) { throw new InvalidOperationException(); }
141 public String BitwiseOr (String op1, String op2) { throw new InvalidOperationException(); }
142 public String ExclusiveOr (String op1, String op2) { throw new InvalidOperationException(); }
143
144 public String UnaryNegation (String op) { throw new InvalidOperationException(); }
145 public String OnesComplement (String op) { throw new InvalidOperationException(); }
146
147 public bool Equality (String op1, String op2) { return op1 == op2; }
148 public bool Inequality (String op1, String op2) { return op1 != op2; }
149 public bool GreaterThan (String op1, String op2) { throw new InvalidOperationException(); }
150 public bool GreaterThanOrEqual(String op1, String op2) { throw new InvalidOperationException(); }
151 public bool LessThan (String op1, String op2) { throw new InvalidOperationException(); }
152 public bool LessThanOrEqual (String op1, String op2) { throw new InvalidOperationException(); }
153 }
154
155 #endregion
156
157 #region SByte
158
159 private class S8 : IOperable<SByte>
160 {
161 public SByte Addition (SByte op1, SByte op2) { return (SByte)(op1 + op2); }
162 public SByte Subtraction (SByte op1, SByte op2) { return (SByte)(op1 - op2); }
163 public SByte Multiply (SByte op1, SByte op2) { return (SByte)(op1 * op2); }
164 public SByte Division (SByte op1, SByte op2) { return (SByte)(op1 / op2); }
165 public SByte Modulus (SByte op1, SByte op2) { return (SByte)(op1 % op2); }
166
167 public SByte BitwiseAnd (SByte op1, SByte op2) { return (SByte)(op1 & op2); }
168 public SByte BitwiseOr (SByte op1, SByte op2) { return (SByte)(op1 | op2); }
169 public SByte ExclusiveOr (SByte op1, SByte op2) { return (SByte)(op1 ^ op2); }
170
171 public SByte UnaryNegation (SByte op) { return (SByte)(-op); }
172 public SByte OnesComplement (SByte op) { return (SByte)(~op); }
173
174 public bool Equality (SByte op1, SByte op2) { return op1 == op2; }
175 public bool Inequality (SByte op1, SByte op2) { return op1 != op2; }
176 public bool GreaterThan (SByte op1, SByte op2) { return op1 > op2; }
177 public bool GreaterThanOrEqual(SByte op1, SByte op2) { return op1 >= op2; }
178 public bool LessThan (SByte op1, SByte op2) { return op1 < op2; }
179 public bool LessThanOrEqual (SByte op1, SByte op2) { return op1 <= op2; }
180 }
181
182 #endregion
183
184 #region Int16
185
186 private class S16 : IOperable<Int16>
187 {
188 public Int16 Addition (Int16 op1, Int16 op2) { return (Int16)(op1 + op2); }
189 public Int16 Subtraction (Int16 op1, Int16 op2) { return (Int16)(op1 - op2); }
190 public Int16 Multiply (Int16 op1, Int16 op2) { return (Int16)(op1 * op2); }
191 public Int16 Division (Int16 op1, Int16 op2) { return (Int16)(op1 / op2); }
192 public Int16 Modulus (Int16 op1, Int16 op2) { return (Int16)(op1 % op2); }
193
194 public Int16 BitwiseAnd (Int16 op1, Int16 op2) { return (Int16)(op1 & op2); }
195 public Int16 BitwiseOr (Int16 op1, Int16 op2) { return (Int16)(op1 | op2); }
196 public Int16 ExclusiveOr (Int16 op1, Int16 op2) { return (Int16)(op1 ^ op2); }
197
198 public Int16 UnaryNegation (Int16 op) { return (Int16)(-op); }
199 public Int16 OnesComplement (Int16 op) { return (Int16)(~op); }
200
201 public bool Equality (Int16 op1, Int16 op2) { return op1 == op2; }
202 public bool Inequality (Int16 op1, Int16 op2) { return op1 != op2; }
203 public bool GreaterThan (Int16 op1, Int16 op2) { return op1 > op2; }
204 public bool GreaterThanOrEqual(Int16 op1, Int16 op2) { return op1 >= op2; }
205 public bool LessThan (Int16 op1, Int16 op2) { return op1 < op2; }
206 public bool LessThanOrEqual (Int16 op1, Int16 op2) { return op1 <= op2; }
207 }
208
209 #endregion
210
211 #region Int32
212
213 private class S32 : IOperable<Int32>
214 {
215 public Int32 Addition (Int32 op1, Int32 op2) { return (op1 + op2); }
216 public Int32 Subtraction (Int32 op1, Int32 op2) { return (op1 - op2); }
217 public Int32 Multiply (Int32 op1, Int32 op2) { return (op1 * op2); }
218 public Int32 Division (Int32 op1, Int32 op2) { return (op1 / op2); }
219 public Int32 Modulus (Int32 op1, Int32 op2) { return (op1 % op2); }
220
221 public Int32 BitwiseAnd (Int32 op1, Int32 op2) { return (op1 & op2); }
222 public Int32 BitwiseOr (Int32 op1, Int32 op2) { return (op1 | op2); }
223 public Int32 ExclusiveOr (Int32 op1, Int32 op2) { return (op1 ^ op2); }
224
225 public Int32 UnaryNegation (Int32 op) { return (-op); }
226 public Int32 OnesComplement (Int32 op) { return (~op); }
227
228 public bool Equality (Int32 op1, Int32 op2) { return op1 == op2; }
229 public bool Inequality (Int32 op1, Int32 op2) { return op1 != op2; }
230 public bool GreaterThan (Int32 op1, Int32 op2) { return op1 > op2; }
231 public bool GreaterThanOrEqual(Int32 op1, Int32 op2) { return op1 >= op2; }
232 public bool LessThan (Int32 op1, Int32 op2) { return op1 < op2; }
233 public bool LessThanOrEqual (Int32 op1, Int32 op2) { return op1 <= op2; }
234 }
235
236 #endregion
237
238 #region Int64
239
240 private class S64 : IOperable<Int64>
241 {
242 public Int64 Addition (Int64 op1, Int64 op2) { return (op1 + op2); }
243 public Int64 Subtraction (Int64 op1, Int64 op2) { return (op1 - op2); }
244 public Int64 Multiply (Int64 op1, Int64 op2) { return (op1 * op2); }
245 public Int64 Division (Int64 op1, Int64 op2) { return (op1 / op2); }
246 public Int64 Modulus (Int64 op1, Int64 op2) { return (op1 % op2); }
247
248 public Int64 BitwiseAnd (Int64 op1, Int64 op2) { return (op1 & op2); }
249 public Int64 BitwiseOr (Int64 op1, Int64 op2) { return (op1 | op2); }
250 public Int64 ExclusiveOr (Int64 op1, Int64 op2) { return (op1 ^ op2); }
251
252 public Int64 UnaryNegation (Int64 op) { return (-op); }
253 public Int64 OnesComplement (Int64 op) { return (~op); }
254
255 public bool Equality (Int64 op1, Int64 op2) { return op1 == op2; }
256 public bool Inequality (Int64 op1, Int64 op2) { return op1 != op2; }
257 public bool GreaterThan (Int64 op1, Int64 op2) { return op1 > op2; }
258 public bool GreaterThanOrEqual(Int64 op1, Int64 op2) { return op1 >= op2; }
259 public bool LessThan (Int64 op1, Int64 op2) { return op1 < op2; }
260 public bool LessThanOrEqual (Int64 op1, Int64 op2) { return op1 <= op2; }
261 }
262
263 #endregion
264
265 #region Byte
266
267 private class U8 : IOperable<Byte>
268 {
269 public Byte Addition (Byte op1, Byte op2) { return (Byte)(op1 + op2); }
270 public Byte Subtraction (Byte op1, Byte op2) { return (Byte)(op1 - op2); }
271 public Byte Multiply (Byte op1, Byte op2) { return (Byte)(op1 * op2); }
272 public Byte Division (Byte op1, Byte op2) { return (Byte)(op1 / op2); }
273 public Byte Modulus (Byte op1, Byte op2) { return (Byte)(op1 % op2); }
274
275 public Byte BitwiseAnd (Byte op1, Byte op2) { return (Byte)(op1 & op2); }
276 public Byte BitwiseOr (Byte op1, Byte op2) { return (Byte)(op1 | op2); }
277 public Byte ExclusiveOr (Byte op1, Byte op2) { return (Byte)(op1 ^ op2); }
278
279 public Byte UnaryNegation (Byte op) { throw new InvalidOperationException(); }
280 public Byte OnesComplement (Byte op) { return (Byte)(~op); }
281
282 public bool Equality (Byte op1, Byte op2) { return op1 == op2; }
283 public bool Inequality (Byte op1, Byte op2) { return op1 != op2; }
284 public bool GreaterThan (Byte op1, Byte op2) { return op1 > op2; }
285 public bool GreaterThanOrEqual(Byte op1, Byte op2) { return op1 >= op2; }
286 public bool LessThan (Byte op1, Byte op2) { return op1 < op2; }
287 public bool LessThanOrEqual (Byte op1, Byte op2) { return op1 <= op2; }
288 }
289
290 #endregion
291
292 #region UInt16
293
294 private class U16 : IOperable<UInt16>
295 {
296 public UInt16 Addition (UInt16 op1, UInt16 op2) { return (UInt16)(op1 + op2); }
297 public UInt16 Subtraction (UInt16 op1, UInt16 op2) { return (UInt16)(op1 - op2); }
298 public UInt16 Multiply (UInt16 op1, UInt16 op2) { return (UInt16)(op1 * op2); }
299 public UInt16 Division (UInt16 op1, UInt16 op2) { return (UInt16)(op1 / op2); }
300 public UInt16 Modulus (UInt16 op1, UInt16 op2) { return (UInt16)(op1 % op2); }
301
302 public UInt16 BitwiseAnd (UInt16 op1, UInt16 op2) { return (UInt16)(op1 & op2); }
303 public UInt16 BitwiseOr (UInt16 op1, UInt16 op2) { return (UInt16)(op1 | op2); }
304 public UInt16 ExclusiveOr (UInt16 op1, UInt16 op2) { return (UInt16)(op1 ^ op2); }
305
306 public UInt16 UnaryNegation (UInt16 op) { throw new InvalidOperationException(); }
307 public UInt16 OnesComplement (UInt16 op) { return (UInt16)(~op); }
308
309 public bool Equality (UInt16 op1, UInt16 op2) { return op1 == op2; }
310 public bool Inequality (UInt16 op1, UInt16 op2) { return op1 != op2; }
311 public bool GreaterThan (UInt16 op1, UInt16 op2) { return op1 > op2; }
312 public bool GreaterThanOrEqual(UInt16 op1, UInt16 op2) { return op1 >= op2; }
313 public bool LessThan (UInt16 op1, UInt16 op2) { return op1 < op2; }
314 public bool LessThanOrEqual (UInt16 op1, UInt16 op2) { return op1 <= op2; }
315 }
316
317 #endregion
318
319 #region UInt32
320
321 private class U32 : IOperable<UInt32>
322 {
323 public UInt32 Addition (UInt32 op1, UInt32 op2) { return (op1 + op2); }
324 public UInt32 Subtraction (UInt32 op1, UInt32 op2) { return (op1 - op2); }
325 public UInt32 Multiply (UInt32 op1, UInt32 op2) { return (op1 * op2); }
326 public UInt32 Division (UInt32 op1, UInt32 op2) { return (op1 / op2); }
327 public UInt32 Modulus (UInt32 op1, UInt32 op2) { return (op1 % op2); }
328
329 public UInt32 BitwiseAnd (UInt32 op1, UInt32 op2) { return (op1 & op2); }
330 public UInt32 BitwiseOr (UInt32 op1, UInt32 op2) { return (op1 | op2); }
331 public UInt32 ExclusiveOr (UInt32 op1, UInt32 op2) { return (op1 ^ op2); }
332
333 public UInt32 UnaryNegation (UInt32 op) { throw new InvalidOperationException(); }
334 public UInt32 OnesComplement (UInt32 op) { return (~op); }
335
336 public bool Equality (UInt32 op1, UInt32 op2) { return op1 == op2; }
337 public bool Inequality (UInt32 op1, UInt32 op2) { return op1 != op2; }
338 public bool GreaterThan (UInt32 op1, UInt32 op2) { return op1 > op2; }
339 public bool GreaterThanOrEqual(UInt32 op1, UInt32 op2) { return op1 >= op2; }
340 public bool LessThan (UInt32 op1, UInt32 op2) { return op1 < op2; }
341 public bool LessThanOrEqual (UInt32 op1, UInt32 op2) { return op1 <= op2; }
342 }
343
344 #endregion
345
346 #region UInt64
347
348 private class U64 : IOperable<UInt64>
349 {
350 public UInt64 Addition (UInt64 op1, UInt64 op2) { return (op1 + op2); }
351 public UInt64 Subtraction (UInt64 op1, UInt64 op2) { return (op1 - op2); }
352 public UInt64 Multiply (UInt64 op1, UInt64 op2) { return (op1 * op2); }
353 public UInt64 Division (UInt64 op1, UInt64 op2) { return (op1 / op2); }
354 public UInt64 Modulus (UInt64 op1, UInt64 op2) { return (op1 % op2); }
355
356 public UInt64 BitwiseAnd (UInt64 op1, UInt64 op2) { return (op1 & op2); }
357 public UInt64 BitwiseOr (UInt64 op1, UInt64 op2) { return (op1 | op2); }
358 public UInt64 ExclusiveOr (UInt64 op1, UInt64 op2) { return (op1 ^ op2); }
359
360 public UInt64 UnaryNegation (UInt64 op) { throw new InvalidOperationException(); }
361 public UInt64 OnesComplement (UInt64 op) { return (~op); }
362
363 public bool Equality (UInt64 op1, UInt64 op2) { return op1 == op2; }
364 public bool Inequality (UInt64 op1, UInt64 op2) { return op1 != op2; }
365 public bool GreaterThan (UInt64 op1, UInt64 op2) { return op1 > op2; }
366 public bool GreaterThanOrEqual(UInt64 op1, UInt64 op2) { return op1 >= op2; }
367 public bool LessThan (UInt64 op1, UInt64 op2) { return op1 < op2; }
368 public bool LessThanOrEqual (UInt64 op1, UInt64 op2) { return op1 <= op2; }
369 }
370
371 #endregion
372
373 #region Boolean
374
375 private class B : IOperable<Boolean>
376 {
377 public Boolean Addition (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
378 public Boolean Subtraction (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
379 public Boolean Multiply (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
380 public Boolean Division (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
381 public Boolean Modulus (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
382
383 public Boolean BitwiseAnd (Boolean op1, Boolean op2) { return (op1 & op2); }
384 public Boolean BitwiseOr (Boolean op1, Boolean op2) { return (op1 | op2); }
385 public Boolean ExclusiveOr (Boolean op1, Boolean op2) { return (op1 ^ op2); }
386
387 public Boolean UnaryNegation (Boolean op) { throw new InvalidOperationException(); }
388 public Boolean OnesComplement (Boolean op) { return !op; }
389
390 public bool Equality (Boolean op1, Boolean op2) { return op1 == op2; }
391 public bool Inequality (Boolean op1, Boolean op2) { return op1 != op2; }
392 public bool GreaterThan (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
393 public bool GreaterThanOrEqual(Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
394 public bool LessThan (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
395 public bool LessThanOrEqual (Boolean op1, Boolean op2) { throw new InvalidOperationException(); }
396 }
397
398 #endregion
399
400 #region Char
401
402 private class C : IOperable<Char>
403 {
404 public Char Addition (Char op1, Char op2) { return (Char)(op1 + op2); }
405 public Char Subtraction (Char op1, Char op2) { return (Char)(op1 - op2); }
406 public Char Multiply (Char op1, Char op2) { return (Char)(op1 * op2); }
407 public Char Division (Char op1, Char op2) { return (Char)(op1 / op2); }
408 public Char Modulus (Char op1, Char op2) { return (Char)(op1 % op2); }
409
410 public Char BitwiseAnd (Char op1, Char op2) { return (Char)(op1 & op2); }
411 public Char BitwiseOr (Char op1, Char op2) { return (Char)(op1 | op2); }
412 public Char ExclusiveOr (Char op1, Char op2) { return (Char)(op1 ^ op2); }
413
414 public Char UnaryNegation (Char op) { return (Char)(-op); }
415 public Char OnesComplement (Char op) { return (Char)(~op); }
416
417 public bool Equality (Char op1, Char op2) { return op1 == op2; }
418 public bool Inequality (Char op1, Char op2) { return op1 != op2; }
419 public bool GreaterThan (Char op1, Char op2) { return op1 > op2; }
420 public bool GreaterThanOrEqual(Char op1, Char op2) { return op1 >= op2; }
421 public bool LessThan (Char op1, Char op2) { return op1 < op2; }
422 public bool LessThanOrEqual (Char op1, Char op2) { return op1 <= op2; }
423 }
424
425 #endregion
426
427 #region Single
428
429 private class R4 : IOperable<Single>
430 {
431 public Single Addition (Single op1, Single op2) { return (op1 + op2); }
432 public Single Subtraction (Single op1, Single op2) { return (op1 - op2); }
433 public Single Multiply (Single op1, Single op2) { return (op1 * op2); }
434 public Single Division (Single op1, Single op2) { return (op1 / op2); }
435 public Single Modulus (Single op1, Single op2) { return (op1 % op2); }
436
437 public Single BitwiseAnd (Single op1, Single op2) { throw new InvalidOperationException(); }
438 public Single BitwiseOr (Single op1, Single op2) { throw new InvalidOperationException(); }
439 public Single ExclusiveOr (Single op1, Single op2) { throw new InvalidOperationException(); }
440
441 public Single UnaryNegation (Single op) { return (-op); }
442 public Single OnesComplement (Single op) { throw new InvalidOperationException(); }
443
444 public bool Equality (Single op1, Single op2) { return op1 == op2; }
445 public bool Inequality (Single op1, Single op2) { return op1 != op2; }
446 public bool GreaterThan (Single op1, Single op2) { return op1 > op2; }
447 public bool GreaterThanOrEqual(Single op1, Single op2) { return op1 >= op2; }
448 public bool LessThan (Single op1, Single op2) { return op1 < op2; }
449 public bool LessThanOrEqual (Single op1, Single op2) { return op1 <= op2; }
450 }
451
452 #endregion
453
454 #region Double
455
456 private class R8 : IOperable<Double>
457 {
458 public Double Addition (Double op1, Double op2) { return (op1 + op2); }
459 public Double Subtraction (Double op1, Double op2) { return (op1 - op2); }
460 public Double Multiply (Double op1, Double op2) { return (op1 * op2); }
461 public Double Division (Double op1, Double op2) { return (op1 / op2); }
462 public Double Modulus (Double op1, Double op2) { return (op1 % op2); }
463
464 public Double BitwiseAnd (Double op1, Double op2) { throw new InvalidOperationException(); }
465 public Double BitwiseOr (Double op1, Double op2) { throw new InvalidOperationException(); }
466 public Double ExclusiveOr (Double op1, Double op2) { throw new InvalidOperationException(); }
467
468 public Double UnaryNegation (Double op) { return (-op); }
469 public Double OnesComplement (Double op) { throw new InvalidOperationException(); }
470
471 public bool Equality (Double op1, Double op2) { return op1 == op2; }
472 public bool Inequality (Double op1, Double op2) { return op1 != op2; }
473 public bool GreaterThan (Double op1, Double op2) { return op1 > op2; }
474 public bool GreaterThanOrEqual(Double op1, Double op2) { return op1 >= op2; }
475 public bool LessThan (Double op1, Double op2) { return op1 < op2; }
476 public bool LessThanOrEqual (Double op1, Double op2) { return op1 <= op2; }
477 }
478
479 #endregion
480
481 #region Decimal
482
483 private class D : IOperable<Decimal>
484 {
485 public Decimal Addition (Decimal op1, Decimal op2) { return (op1 + op2); }
486 public Decimal Subtraction (Decimal op1, Decimal op2) { return (op1 - op2); }
487 public Decimal Multiply (Decimal op1, Decimal op2) { return (op1 * op2); }
488 public Decimal Division (Decimal op1, Decimal op2) { return (op1 / op2); }
489 public Decimal Modulus (Decimal op1, Decimal op2) { return (op1 % op2); }
490
491 public Decimal BitwiseAnd (Decimal op1, Decimal op2) { throw new InvalidOperationException(); }
492 public Decimal BitwiseOr (Decimal op1, Decimal op2) { throw new InvalidOperationException(); }
493 public Decimal ExclusiveOr (Decimal op1, Decimal op2) { throw new InvalidOperationException(); }
494
495 public Decimal UnaryNegation (Decimal op) { return (-op); }
496 public Decimal OnesComplement (Decimal op) { throw new InvalidOperationException(); }
497
498 public bool Equality (Decimal op1, Decimal op2) { return op1 == op2; }
499 public bool Inequality (Decimal op1, Decimal op2) { return op1 != op2; }
500 public bool GreaterThan (Decimal op1, Decimal op2) { return op1 > op2; }
501 public bool GreaterThanOrEqual(Decimal op1, Decimal op2) { return op1 >= op2; }
502 public bool LessThan (Decimal op1, Decimal op2) { return op1 < op2; }
503 public bool LessThanOrEqual (Decimal op1, Decimal op2) { return op1 <= op2; }
504 }
505
506 #endregion
507
508 #region DateTime
509
510 private class DT : IOperable<DateTime>
511 {
512 public DateTime Addition (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
513 public DateTime Subtraction (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
514 public DateTime Multiply (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
515 public DateTime Division (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
516 public DateTime Modulus (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
517
518 public DateTime BitwiseAnd (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
519 public DateTime BitwiseOr (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
520 public DateTime ExclusiveOr (DateTime op1, DateTime op2) { throw new InvalidOperationException(); }
521
522 public DateTime UnaryNegation (DateTime op) { throw new InvalidOperationException(); }
523 public DateTime OnesComplement(DateTime op) { throw new InvalidOperationException(); }
524
525 public bool Equality (DateTime op1, DateTime op2) { return op1 == op2; }
526 public bool Inequality (DateTime op1, DateTime op2) { return op1 != op2; }
527 public bool GreaterThan (DateTime op1, DateTime op2) { return op1 > op2; }
528 public bool GreaterThanOrEqual(DateTime op1, DateTime op2) { return op1 >= op2; }
529 public bool LessThan (DateTime op1, DateTime op2) { return op1 < op2; }
530 public bool LessThanOrEqual (DateTime op1, DateTime op2) { return op1 <= op2; }
531 }
532
533 #endregion
534
535 #region TimeSpan
536
537 private class TS : IOperable<TimeSpan>
538 {
539 public TimeSpan Addition (TimeSpan op1, TimeSpan op2) { return (op1 + op2); }
540 public TimeSpan Subtraction (TimeSpan op1, TimeSpan op2) { return (op1 - op2); }
541 public TimeSpan Multiply (TimeSpan op1, TimeSpan op2) { throw new InvalidOperationException(); }
542 public TimeSpan Division (TimeSpan op1, TimeSpan op2) { throw new InvalidOperationException(); }
543 public TimeSpan Modulus (TimeSpan op1, TimeSpan op2) { throw new InvalidOperationException(); }
544
545 public TimeSpan BitwiseAnd (TimeSpan op1, TimeSpan op2) { throw new InvalidOperationException(); }
546 public TimeSpan BitwiseOr (TimeSpan op1, TimeSpan op2) { throw new InvalidOperationException(); }
547 public TimeSpan ExclusiveOr (TimeSpan op1, TimeSpan op2) { throw new InvalidOperationException(); }
548
549 public TimeSpan UnaryNegation (TimeSpan op) { return (-op); }
550 public TimeSpan OnesComplement(TimeSpan op) { throw new InvalidOperationException(); }
551
552 public bool Equality (TimeSpan op1, TimeSpan op2) { return op1 == op2; }
553 public bool Inequality (TimeSpan op1, TimeSpan op2) { return op1 != op2; }
554 public bool GreaterThan (TimeSpan op1, TimeSpan op2) { return op1 > op2; }
555 public bool GreaterThanOrEqual(TimeSpan op1, TimeSpan op2) { return op1 >= op2; }
556 public bool LessThan (TimeSpan op1, TimeSpan op2) { return op1 < op2; }
557 public bool LessThanOrEqual (TimeSpan op1, TimeSpan op2) { return op1 <= op2; }
558 }
559
560 #endregion
561
562 #region Guid
563
564 private class G : IOperable<Guid>
565 {
566 public Guid Addition (Guid op1, Guid op2) { throw new InvalidOperationException(); }
567 public Guid Subtraction (Guid op1, Guid op2) { throw new InvalidOperationException(); }
568 public Guid Multiply (Guid op1, Guid op2) { throw new InvalidOperationException(); }
569 public Guid Division (Guid op1, Guid op2) { throw new InvalidOperationException(); }
570 public Guid Modulus (Guid op1, Guid op2) { throw new InvalidOperationException(); }
571
572 public Guid BitwiseAnd (Guid op1, Guid op2) { throw new InvalidOperationException(); }
573 public Guid BitwiseOr (Guid op1, Guid op2) { throw new InvalidOperationException(); }
574 public Guid ExclusiveOr (Guid op1, Guid op2) { throw new InvalidOperationException(); }
575
576 public Guid UnaryNegation (Guid op) { throw new InvalidOperationException(); }
577 public Guid OnesComplement (Guid op) { throw new InvalidOperationException(); }
578
579 public bool Equality (Guid op1, Guid op2) { return op1 == op2; }
580 public bool Inequality (Guid op1, Guid op2) { return op1 != op2; }
581 public bool GreaterThan (Guid op1, Guid op2) { throw new InvalidOperationException(); }
582 public bool GreaterThanOrEqual(Guid op1, Guid op2) { throw new InvalidOperationException(); }
583 public bool LessThan (Guid op1, Guid op2) { throw new InvalidOperationException(); }
584 public bool LessThanOrEqual (Guid op1, Guid op2) { throw new InvalidOperationException(); }
585 }
586
587 #endregion
588
589 #endregion
590
591 #region Nullable Types.
592
593 #region SByte
594
595 private class NS8 : IOperable<SByte?>
596 {
597 public SByte? Addition (SByte? op1, SByte? op2) { return (SByte?)(op1 + op2); }
598 public SByte? Subtraction (SByte? op1, SByte? op2) { return (SByte?)(op1 - op2); }
599 public SByte? Multiply (SByte? op1, SByte? op2) { return (SByte?)(op1 * op2); }
600 public SByte? Division (SByte? op1, SByte? op2) { return (SByte?)(op1 / op2); }
601 public SByte? Modulus (SByte? op1, SByte? op2) { return (SByte?)(op1 % op2); }
602
603 public SByte? BitwiseAnd (SByte? op1, SByte? op2) { return (SByte?)(op1 & op2); }
604 public SByte? BitwiseOr (SByte? op1, SByte? op2) { return (SByte?)(op1 | op2); }
605 public SByte? ExclusiveOr (SByte? op1, SByte? op2) { return (SByte?)(op1 ^ op2); }
606
607 public SByte? UnaryNegation (SByte? op) { return (SByte)(- op); }
608 public SByte? OnesComplement (SByte? op) { return (SByte)(~op); }
609
610 public bool Equality (SByte? op1, SByte? op2) { return op1 == op2; }
611 public bool Inequality (SByte? op1, SByte? op2) { return op1 != op2; }
612 public bool GreaterThan (SByte? op1, SByte? op2) { return op1 > op2; }
613 public bool GreaterThanOrEqual(SByte? op1, SByte? op2) { return op1 >= op2; }
614 public bool LessThan (SByte? op1, SByte? op2) { return op1 < op2; }
615 public bool LessThanOrEqual (SByte? op1, SByte? op2) { return op1 <= op2; }
616 }
617
618 #endregion
619
620 #region Int16
621
622 private class NS16 : IOperable<Int16?>
623 {
624 public Int16? Addition (Int16? op1, Int16? op2) { return (Int16?)(op1 + op2); }
625 public Int16? Subtraction (Int16? op1, Int16? op2) { return (Int16?)(op1 - op2); }
626 public Int16? Multiply (Int16? op1, Int16? op2) { return (Int16?)(op1 * op2); }
627 public Int16? Division (Int16? op1, Int16? op2) { return (Int16?)(op1 / op2); }
628 public Int16? Modulus (Int16? op1, Int16? op2) { return (Int16?)(op1 % op2); }
629
630 public Int16? BitwiseAnd (Int16? op1, Int16? op2) { return (Int16?)(op1 & op2); }
631 public Int16? BitwiseOr (Int16? op1, Int16? op2) { return (Int16?)(op1 | op2); }
632 public Int16? ExclusiveOr (Int16? op1, Int16? op2) { return (Int16?)(op1 ^ op2); }
633
634 public Int16? UnaryNegation (Int16? op) { return (Int16)(- op); }
635 public Int16? OnesComplement (Int16? op) { return (Int16)(~op); }
636
637 public bool Equality (Int16? op1, Int16? op2) { return op1 == op2; }
638 public bool Inequality (Int16? op1, Int16? op2) { return op1 != op2; }
639 public bool GreaterThan (Int16? op1, Int16? op2) { return op1 > op2; }
640 public bool GreaterThanOrEqual(Int16? op1, Int16? op2) { return op1 >= op2; }
641 public bool LessThan (Int16? op1, Int16? op2) { return op1 < op2; }
642 public bool LessThanOrEqual (Int16? op1, Int16? op2) { return op1 <= op2; }
643 }
644
645 #endregion
646
647 #region Int32
648
649 private class NS32 : IOperable<Int32?>
650 {
651 public Int32? Addition (Int32? op1, Int32? op2) { return (op1 + op2); }
652 public Int32? Subtraction (Int32? op1, Int32? op2) { return (op1 - op2); }
653 public Int32? Multiply (Int32? op1, Int32? op2) { return (op1 * op2); }
654 public Int32? Division (Int32? op1, Int32? op2) { return (op1 / op2); }
655 public Int32? Modulus (Int32? op1, Int32? op2) { return (op1 % op2); }
656
657 public Int32? BitwiseAnd (Int32? op1, Int32? op2) { return (op1 & op2); }
658 public Int32? BitwiseOr (Int32? op1, Int32? op2) { return (op1 | op2); }
659 public Int32? ExclusiveOr (Int32? op1, Int32? op2) { return (op1 ^ op2); }
660
661 public Int32? UnaryNegation (Int32? op) { return (- op); }
662 public Int32? OnesComplement (Int32? op) { return (~op); }
663
664 public bool Equality (Int32? op1, Int32? op2) { return op1 == op2; }
665 public bool Inequality (Int32? op1, Int32? op2) { return op1 != op2; }
666 public bool GreaterThan (Int32? op1, Int32? op2) { return op1 > op2; }
667 public bool GreaterThanOrEqual(Int32? op1, Int32? op2) { return op1 >= op2; }
668 public bool LessThan (Int32? op1, Int32? op2) { return op1 < op2; }
669 public bool LessThanOrEqual (Int32? op1, Int32? op2) { return op1 <= op2; }
670 }
671
672 #endregion
673
674 #region Int64
675
676 private class NS64 : IOperable<Int64?>
677 {
678 public Int64? Addition (Int64? op1, Int64? op2) { return (op1 + op2); }
679 public Int64? Subtraction (Int64? op1, Int64? op2) { return (op1 - op2); }
680 public Int64? Multiply (Int64? op1, Int64? op2) { return (op1 * op2); }
681 public Int64? Division (Int64? op1, Int64? op2) { return (op1 / op2); }
682 public Int64? Modulus (Int64? op1, Int64? op2) { return (op1 % op2); }
683
684 public Int64? BitwiseAnd (Int64? op1, Int64? op2) { return (op1 & op2); }
685 public Int64? BitwiseOr (Int64? op1, Int64? op2) { return (op1 | op2); }
686 public Int64? ExclusiveOr (Int64? op1, Int64? op2) { return (op1 ^ op2); }
687
688 public Int64? UnaryNegation (Int64? op) { return (- op); }
689 public Int64? OnesComplement (Int64? op) { return (~op); }
690
691 public bool Equality (Int64? op1, Int64? op2) { return op1 == op2; }
692 public bool Inequality (Int64? op1, Int64? op2) { return op1 != op2; }
693 public bool GreaterThan (Int64? op1, Int64? op2) { return op1 > op2; }
694 public bool GreaterThanOrEqual(Int64? op1, Int64? op2) { return op1 >= op2; }
695 public bool LessThan (Int64? op1, Int64? op2) { return op1 < op2; }
696 public bool LessThanOrEqual (Int64? op1, Int64? op2) { return op1 <= op2; }
697 }
698
699 #endregion
700
701 #region Byte
702
703 private class NU8 : IOperable<Byte?>
704 {
705 public Byte? Addition (Byte? op1, Byte? op2) { return (Byte?)(op1 + op2); }
706 public Byte? Subtraction (Byte? op1, Byte? op2) { return (Byte?)(op1 - op2); }
707 public Byte? Multiply (Byte? op1, Byte? op2) { return (Byte?)(op1 * op2); }
708 public Byte? Division (Byte? op1, Byte? op2) { return (Byte?)(op1 / op2); }
709 public Byte? Modulus (Byte? op1, Byte? op2) { return (Byte?)(op1 % op2); }
710
711 public Byte? BitwiseAnd (Byte? op1, Byte? op2) { return (Byte?)(op1 & op2); }
712 public Byte? BitwiseOr (Byte? op1, Byte? op2) { return (Byte?)(op1 | op2); }
713 public Byte? ExclusiveOr (Byte? op1, Byte? op2) { return (Byte?)(op1 ^ op2); }
714
715 public Byte? UnaryNegation (Byte? op) { throw new InvalidOperationException(); }
716 public Byte? OnesComplement (Byte? op) { return (Byte?)(~op); }
717
718 public bool Equality (Byte? op1, Byte? op2) { return op1 == op2; }
719 public bool Inequality (Byte? op1, Byte? op2) { return op1 != op2; }
720 public bool GreaterThan (Byte? op1, Byte? op2) { return op1 > op2; }
721 public bool GreaterThanOrEqual(Byte? op1, Byte? op2) { return op1 >= op2; }
722 public bool LessThan (Byte? op1, Byte? op2) { return op1 < op2; }
723 public bool LessThanOrEqual (Byte? op1, Byte? op2) { return op1 <= op2; }
724 }
725
726 #endregion
727
728 #region UInt16
729
730 private class NU16 : IOperable<UInt16?>
731 {
732 public UInt16? Addition (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 + op2); }
733 public UInt16? Subtraction (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 - op2); }
734 public UInt16? Multiply (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 * op2); }
735 public UInt16? Division (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 / op2); }
736 public UInt16? Modulus (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 % op2); }
737
738 public UInt16? BitwiseAnd (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 & op2); }
739 public UInt16? BitwiseOr (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 | op2); }
740 public UInt16? ExclusiveOr (UInt16? op1, UInt16? op2) { return (UInt16?)(op1 ^ op2); }
741
742 public UInt16? UnaryNegation (UInt16? op) { throw new InvalidOperationException(); }
743 public UInt16? OnesComplement (UInt16? op) { return (UInt16?)(~op); }
744
745 public bool Equality (UInt16? op1, UInt16? op2) { return op1 == op2; }
746 public bool Inequality (UInt16? op1, UInt16? op2) { return op1 != op2; }
747 public bool GreaterThan (UInt16? op1, UInt16? op2) { return op1 > op2; }
748 public bool GreaterThanOrEqual(UInt16? op1, UInt16? op2) { return op1 >= op2; }
749 public bool LessThan (UInt16? op1, UInt16? op2) { return op1 < op2; }
750 public bool LessThanOrEqual (UInt16? op1, UInt16? op2) { return op1 <= op2; }
751 }
752
753 #endregion
754
755 #region UInt32
756
757 private class NU32 : IOperable<UInt32?>
758 {
759 public UInt32? Addition (UInt32? op1, UInt32? op2) { return (op1 + op2); }
760 public UInt32? Subtraction (UInt32? op1, UInt32? op2) { return (op1 - op2); }
761 public UInt32? Multiply (UInt32? op1, UInt32? op2) { return (op1 * op2); }
762 public UInt32? Division (UInt32? op1, UInt32? op2) { return (op1 / op2); }
763 public UInt32? Modulus (UInt32? op1, UInt32? op2) { return (op1 % op2); }
764
765 public UInt32? BitwiseAnd (UInt32? op1, UInt32? op2) { return (op1 & op2); }
766 public UInt32? BitwiseOr (UInt32? op1, UInt32? op2) { return (op1 | op2); }
767 public UInt32? ExclusiveOr (UInt32? op1, UInt32? op2) { return (op1 ^ op2); }
768
769 public UInt32? UnaryNegation (UInt32? op) { throw new InvalidOperationException(); }
770 public UInt32? OnesComplement (UInt32? op) { return (~op); }
771
772 public bool Equality (UInt32? op1, UInt32? op2) { return op1 == op2; }
773 public bool Inequality (UInt32? op1, UInt32? op2) { return op1 != op2; }
774 public bool GreaterThan (UInt32? op1, UInt32? op2) { return op1 > op2; }
775 public bool GreaterThanOrEqual(UInt32? op1, UInt32? op2) { return op1 >= op2; }
776 public bool LessThan (UInt32? op1, UInt32? op2) { return op1 < op2; }
777 public bool LessThanOrEqual (UInt32? op1, UInt32? op2) { return op1 <= op2; }
778 }
779
780 #endregion
781
782 #region UInt64
783
784 private class NU64 : IOperable<UInt64?>
785 {
786 public UInt64? Addition (UInt64? op1, UInt64? op2) { return (op1 + op2); }
787 public UInt64? Subtraction (UInt64? op1, UInt64? op2) { return (op1 - op2); }
788 public UInt64? Multiply (UInt64? op1, UInt64? op2) { return (op1 * op2); }
789 public UInt64? Division (UInt64? op1, UInt64? op2) { return (op1 / op2); }
790 public UInt64? Modulus (UInt64? op1, UInt64? op2) { return (op1 % op2); }
791
792 public UInt64? BitwiseAnd (UInt64? op1, UInt64? op2) { return (op1 & op2); }
793 public UInt64? BitwiseOr (UInt64? op1, UInt64? op2) { return (op1 | op2); }
794 public UInt64? ExclusiveOr (UInt64? op1, UInt64? op2) { return (op1 ^ op2); }
795
796 public UInt64? UnaryNegation (UInt64? op) { throw new InvalidOperationException(); }
797 public UInt64? OnesComplement (UInt64? op) { return (~op); }
798
799 public bool Equality (UInt64? op1, UInt64? op2) { return op1 == op2; }
800 public bool Inequality (UInt64? op1, UInt64? op2) { return op1 != op2; }
801 public bool GreaterThan (UInt64? op1, UInt64? op2) { return op1 > op2; }
802 public bool GreaterThanOrEqual(UInt64? op1, UInt64? op2) { return op1 >= op2; }
803 public bool LessThan (UInt64? op1, UInt64? op2) { return op1 < op2; }
804 public bool LessThanOrEqual (UInt64? op1, UInt64? op2) { return op1 <= op2; }
805 }
806
807 #endregion
808
809 #region Boolean
810
811 private class NB : IOperable<Boolean?>
812 {
813 public Boolean? Addition (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
814 public Boolean? Subtraction (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
815 public Boolean? Multiply (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
816 public Boolean? Division (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
817 public Boolean? Modulus (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
818
819 public Boolean? BitwiseAnd (Boolean? op1, Boolean? op2) { return (op1 & op2); }
820 public Boolean? BitwiseOr (Boolean? op1, Boolean? op2) { return (op1 | op2); }
821 public Boolean? ExclusiveOr (Boolean? op1, Boolean? op2) { return (op1 ^ op2); }
822
823 public Boolean? UnaryNegation (Boolean? op) { throw new InvalidOperationException(); }
824 public Boolean? OnesComplement(Boolean? op) { return !op; }
825
826 public bool Equality (Boolean? op1, Boolean? op2) { return op1 == op2; }
827 public bool Inequality (Boolean? op1, Boolean? op2) { return op1 != op2; }
828 public bool GreaterThan (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
829 public bool GreaterThanOrEqual(Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
830 public bool LessThan (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
831 public bool LessThanOrEqual (Boolean? op1, Boolean? op2) { throw new InvalidOperationException(); }
832 }
833
834 #endregion
835
836 #region Char
837
838 private class NC : IOperable<Char?>
839 {
840 public Char? Addition (Char? op1, Char? op2) { return (Char?)(op1 + op2); }
841 public Char? Subtraction (Char? op1, Char? op2) { return (Char?)(op1 - op2); }
842 public Char? Multiply (Char? op1, Char? op2) { return (Char?)(op1 * op2); }
843 public Char? Division (Char? op1, Char? op2) { return (Char?)(op1 / op2); }
844 public Char? Modulus (Char? op1, Char? op2) { return (Char?)(op1 % op2); }
845
846 public Char? BitwiseAnd (Char? op1, Char? op2) { return (Char?)(op1 & op2); }
847 public Char? BitwiseOr (Char? op1, Char? op2) { return (Char?)(op1 | op2); }
848 public Char? ExclusiveOr (Char? op1, Char? op2) { return (Char?)(op1 ^ op2); }
849
850 public Char? UnaryNegation (Char? op) { return (Char?)(-op); }
851 public Char? OnesComplement (Char? op) { return (Char?)(~op); }
852
853 public bool Equality (Char? op1, Char? op2) { return op1 == op2; }
854 public bool Inequality (Char? op1, Char? op2) { return op1 != op2; }
855 public bool GreaterThan (Char? op1, Char? op2) { return op1 > op2; }
856 public bool GreaterThanOrEqual(Char? op1, Char? op2) { return op1 >= op2; }
857 public bool LessThan (Char? op1, Char? op2) { return op1 < op2; }
858 public bool LessThanOrEqual (Char? op1, Char? op2) { return op1 <= op2; }
859 }
860
861 #endregion
862
863 #region Single
864
865 private class NR4 : IOperable<Single?>
866 {
867 public Single? Addition (Single? op1, Single? op2) { return (op1 + op2); }
868 public Single? Subtraction (Single? op1, Single? op2) { return (op1 - op2); }
869 public Single? Multiply (Single? op1, Single? op2) { return (op1 * op2); }
870 public Single? Division (Single? op1, Single? op2) { return (op1 / op2); }
871 public Single? Modulus (Single? op1, Single? op2) { return (op1 % op2); }
872
873 public Single? BitwiseAnd (Single? op1, Single? op2) { throw new InvalidOperationException(); }
874 public Single? BitwiseOr (Single? op1, Single? op2) { throw new InvalidOperationException(); }
875 public Single? ExclusiveOr (Single? op1, Single? op2) { throw new InvalidOperationException(); }
876
877 public Single? UnaryNegation (Single? op) { return (- op); }
878 public Single? OnesComplement (Single? op) { throw new InvalidOperationException(); }
879
880 public bool Equality (Single? op1, Single? op2) { return op1 == op2; }
881 public bool Inequality (Single? op1, Single? op2) { return op1 != op2; }
882 public bool GreaterThan (Single? op1, Single? op2) { return op1 > op2; }
883 public bool GreaterThanOrEqual(Single? op1, Single? op2) { return op1 >= op2; }
884 public bool LessThan (Single? op1, Single? op2) { return op1 < op2; }
885 public bool LessThanOrEqual (Single? op1, Single? op2) { return op1 <= op2; }
886 }
887
888 #endregion
889
890 #region Double
891
892 private class NR8 : IOperable<Double?>
893 {
894 public Double? Addition (Double? op1, Double? op2) { return (op1 + op2); }
895 public Double? Subtraction (Double? op1, Double? op2) { return (op1 - op2); }
896 public Double? Multiply (Double? op1, Double? op2) { return (op1 * op2); }
897 public Double? Division (Double? op1, Double? op2) { return (op1 / op2); }
898 public Double? Modulus (Double? op1, Double? op2) { return (op1 % op2); }
899
900 public Double? BitwiseAnd (Double? op1, Double? op2) { throw new InvalidOperationException(); }
901 public Double? BitwiseOr (Double? op1, Double? op2) { throw new InvalidOperationException(); }
902 public Double? ExclusiveOr (Double? op1, Double? op2) { throw new InvalidOperationException(); }
903
904 public Double? UnaryNegation (Double? op) { return (- op); }
905 public Double? OnesComplement (Double? op) { throw new InvalidOperationException(); }
906
907 public bool Equality (Double? op1, Double? op2) { return op1 == op2; }
908 public bool Inequality (Double? op1, Double? op2) { return op1 != op2; }
909 public bool GreaterThan (Double? op1, Double? op2) { return op1 > op2; }
910 public bool GreaterThanOrEqual(Double? op1, Double? op2) { return op1 >= op2; }
911 public bool LessThan (Double? op1, Double? op2) { return op1 < op2; }
912 public bool LessThanOrEqual (Double? op1, Double? op2) { return op1 <= op2; }
913 }
914
915 #endregion
916
917 #region Decimal
918
919 private class ND : IOperable<Decimal?>
920 {
921 public Decimal? Addition (Decimal? op1, Decimal? op2) { return (op1 + op2); }
922 public Decimal? Subtraction (Decimal? op1, Decimal? op2) { return (op1 - op2); }
923 public Decimal? Multiply (Decimal? op1, Decimal? op2) { return (op1 * op2); }
924 public Decimal? Division (Decimal? op1, Decimal? op2) { return (op1 / op2); }
925 public Decimal? Modulus (Decimal? op1, Decimal? op2) { return (op1 % op2); }
926
927 public Decimal? BitwiseAnd (Decimal? op1, Decimal? op2) { throw new InvalidOperationException(); }
928 public Decimal? BitwiseOr (Decimal? op1, Decimal? op2) { throw new InvalidOperationException(); }
929 public Decimal? ExclusiveOr (Decimal? op1, Decimal? op2) { throw new InvalidOperationException(); }
930
931 public Decimal? UnaryNegation (Decimal? op) { return (- op); }
932 public Decimal? OnesComplement(Decimal? op) { throw new InvalidOperationException(); }
933
934 public bool Equality (Decimal? op1, Decimal? op2) { return op1 == op2; }
935 public bool Inequality (Decimal? op1, Decimal? op2) { return op1 != op2; }
936 public bool GreaterThan (Decimal? op1, Decimal? op2) { return op1 > op2; }
937 public bool GreaterThanOrEqual(Decimal? op1, Decimal? op2) { return op1 >= op2; }
938 public bool LessThan (Decimal? op1, Decimal? op2) { return op1 < op2; }
939 public bool LessThanOrEqual (Decimal? op1, Decimal? op2) { return op1 <= op2; }
940 }
941
942 #endregion
943
944 #region DateTime
945
946 private class NDT : IOperable<DateTime?>
947 {
948 public DateTime? Addition (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
949 public DateTime? Subtraction (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
950 public DateTime? Multiply (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
951 public DateTime? Division (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
952 public DateTime? Modulus (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
953
954 public DateTime? BitwiseAnd (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
955 public DateTime? BitwiseOr (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
956 public DateTime? ExclusiveOr (DateTime? op1, DateTime? op2) { throw new InvalidOperationException(); }
957
958 public DateTime? UnaryNegation (DateTime? op) { throw new InvalidOperationException(); }
959 public DateTime? OnesComplement(DateTime? op) { throw new InvalidOperationException(); }
960
961 public bool Equality (DateTime? op1, DateTime? op2) { return op1 == op2; }
962 public bool Inequality (DateTime? op1, DateTime? op2) { return op1 != op2; }
963 public bool GreaterThan (DateTime? op1, DateTime? op2) { return op1 > op2; }
964 public bool GreaterThanOrEqual (DateTime? op1, DateTime? op2) { return op1 >= op2; }
965 public bool LessThan (DateTime? op1, DateTime? op2) { return op1 < op2; }
966 public bool LessThanOrEqual (DateTime? op1, DateTime? op2) { return op1 <= op2; }
967 }
968
969 #endregion
970
971 #region TimeSpan
972
973 private class NTS : IOperable<TimeSpan?>
974 {
975 public TimeSpan? Addition (TimeSpan? op1, TimeSpan? op2) { return (op1 + op2); }
976 public TimeSpan? Subtraction (TimeSpan? op1, TimeSpan? op2) { return (op1 - op2); }
977 public TimeSpan? Multiply (TimeSpan? op1, TimeSpan? op2) { throw new InvalidOperationException(); }
978 public TimeSpan? Division (TimeSpan? op1, TimeSpan? op2) { throw new InvalidOperationException(); }
979 public TimeSpan? Modulus (TimeSpan? op1, TimeSpan? op2) { throw new InvalidOperationException(); }
980
981 public TimeSpan? BitwiseAnd (TimeSpan? op1, TimeSpan? op2) { throw new InvalidOperationException(); }
982 public TimeSpan? BitwiseOr (TimeSpan? op1, TimeSpan? op2) { throw new InvalidOperationException(); }
983 public TimeSpan? ExclusiveOr (TimeSpan? op1, TimeSpan? op2) { throw new InvalidOperationException(); }
984
985 public TimeSpan? UnaryNegation (TimeSpan? op) { return (- op); }
986 public TimeSpan? OnesComplement(TimeSpan? op) { throw new InvalidOperationException(); }
987
988 public bool Equality (TimeSpan? op1, TimeSpan? op2) { return op1 == op2; }
989 public bool Inequality (TimeSpan? op1, TimeSpan? op2) { return op1 != op2; }
990 public bool GreaterThan (TimeSpan? op1, TimeSpan? op2) { return op1 > op2; }
991 public bool GreaterThanOrEqual (TimeSpan? op1, TimeSpan? op2) { return op1 >= op2; }
992 public bool LessThan (TimeSpan? op1, TimeSpan? op2) { return op1 < op2; }
993 public bool LessThanOrEqual (TimeSpan? op1, TimeSpan? op2) { return op1 <= op2; }
994 }
995
996 #endregion
997
998 #region Guid?
999
1000 private class NG : IOperable<Guid?>
1001 {
1002 public Guid? Addition (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1003 public Guid? Subtraction (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1004 public Guid? Multiply (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1005 public Guid? Division (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1006 public Guid? Modulus (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1007
1008 public Guid? BitwiseAnd (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1009 public Guid? BitwiseOr (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1010 public Guid? ExclusiveOr (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1011
1012 public Guid? UnaryNegation (Guid? op) { throw new InvalidOperationException(); }
1013 public Guid? OnesComplement (Guid? op) { throw new InvalidOperationException(); }
1014
1015 public bool Equality (Guid? op1, Guid? op2) { return op1 == op2; }
1016 public bool Inequality (Guid? op1, Guid? op2) { return op1 != op2; }
1017 public bool GreaterThan (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1018 public bool GreaterThanOrEqual(Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1019 public bool LessThan (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1020 public bool LessThanOrEqual (Guid? op1, Guid? op2) { throw new InvalidOperationException(); }
1021 }
1022
1023 #endregion
1024
1025 #endregion
1026
1027 #region Sql types.
1028
1029 #region SqlString
1030
1031 private class DBS : IOperable<SqlString>
1032 {
1033 public SqlString Addition (SqlString op1, SqlString op2) { return (op1 + op2); }
1034 public SqlString Subtraction (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1035 public SqlString Multiply (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1036 public SqlString Division (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1037 public SqlString Modulus (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1038
1039 public SqlString BitwiseAnd (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1040 public SqlString BitwiseOr (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1041 public SqlString ExclusiveOr (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1042
1043 public SqlString UnaryNegation (SqlString op) { throw new InvalidOperationException(); }
1044 public SqlString OnesComplement(SqlString op) { throw new InvalidOperationException(); }
1045
1046 public bool Equality (SqlString op1, SqlString op2) { return (op1 == op2).IsTrue; }
1047 public bool Inequality (SqlString op1, SqlString op2) { return (op1 != op2).IsTrue; }
1048 public bool GreaterThan (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1049 public bool GreaterThanOrEqual (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1050 public bool LessThan (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1051 public bool LessThanOrEqual (SqlString op1, SqlString op2) { throw new InvalidOperationException(); }
1052 }
1053
1054 #endregion
1055
1056 #region SqlByte
1057
1058 private class DBU8 : IOperable<SqlByte>
1059 {
1060 public SqlByte Addition (SqlByte op1, SqlByte op2) { return (op1 + op2); }
1061 public SqlByte Subtraction (SqlByte op1, SqlByte op2) { return (op1 - op2); }
1062 public SqlByte Multiply (SqlByte op1, SqlByte op2) { return (op1 * op2); }
1063 public SqlByte Division (SqlByte op1, SqlByte op2) { return (op1 / op2); }
1064 public SqlByte Modulus (SqlByte op1, SqlByte op2) { return (op1 % op2); }
1065
1066 public SqlByte BitwiseAnd (SqlByte op1, SqlByte op2) { return (op1 & op2); }
1067 public SqlByte BitwiseOr (SqlByte op1, SqlByte op2) { return (op1 | op2); }
1068 public SqlByte ExclusiveOr (SqlByte op1, SqlByte op2) { return (op1 ^ op2); }
1069
1070 public SqlByte UnaryNegation (SqlByte op) { throw new InvalidOperationException(); }
1071 public SqlByte OnesComplement (SqlByte op) { return (~op); }
1072
1073 public bool Equality (SqlByte op1, SqlByte op2) { return (op1 == op2).IsTrue; }
1074 public bool Inequality (SqlByte op1, SqlByte op2) { return (op1 != op2).IsTrue; }
1075 public bool GreaterThan (SqlByte op1, SqlByte op2) { return (op1 > op2).IsTrue; }
1076 public bool GreaterThanOrEqual(SqlByte op1, SqlByte op2) { return (op1 >= op2).IsTrue; }
1077 public bool LessThan (SqlByte op1, SqlByte op2) { return (op1 < op2).IsTrue; }
1078 public bool LessThanOrEqual (SqlByte op1, SqlByte op2) { return (op1 <= op2).IsTrue; }
1079 }
1080
1081 #endregion
1082
1083 #region Int16
1084
1085 private class DBS16 : IOperable<SqlInt16>
1086 {
1087 public SqlInt16 Addition (SqlInt16 op1, SqlInt16 op2) { return (op1 + op2); }
1088 public SqlInt16 Subtraction (SqlInt16 op1, SqlInt16 op2) { return (op1 - op2); }
1089 public SqlInt16 Multiply (SqlInt16 op1, SqlInt16 op2) { return (op1 * op2); }
1090 public SqlInt16 Division (SqlInt16 op1, SqlInt16 op2) { return (op1 / op2); }
1091 public SqlInt16 Modulus (SqlInt16 op1, SqlInt16 op2) { return (op1 % op2); }
1092
1093 public SqlInt16 BitwiseAnd (SqlInt16 op1, SqlInt16 op2) { return (op1 & op2); }
1094 public SqlInt16 BitwiseOr (SqlInt16 op1, SqlInt16 op2) { return (op1 | op2); }
1095 public SqlInt16 ExclusiveOr (SqlInt16 op1, SqlInt16 op2) { return (op1 ^ op2); }
1096
1097 public SqlInt16 UnaryNegation (SqlInt16 op) { return (-op); }
1098 public SqlInt16 OnesComplement(SqlInt16 op) { return (~op); }
1099
1100 public bool Equality (SqlInt16 op1, SqlInt16 op2) { return (op1 == op2).IsTrue; }
1101 public bool Inequality (SqlInt16 op1, SqlInt16 op2) { return (op1 != op2).IsTrue; }
1102 public bool GreaterThan (SqlInt16 op1, SqlInt16 op2) { return (op1 > op2).IsTrue; }
1103 public bool GreaterThanOrEqual(SqlInt16 op1, SqlInt16 op2) { return (op1 >= op2).IsTrue; }
1104 public bool LessThan (SqlInt16 op1, SqlInt16 op2) { return (op1 < op2).IsTrue; }
1105 public bool LessThanOrEqual (SqlInt16 op1, SqlInt16 op2) { return (op1 <= op2).IsTrue; }
1106 }
1107
1108 #endregion
1109
1110 #region SqlInt32
1111
1112 private class DBS32 : IOperable<SqlInt32>
1113 {
1114 public SqlInt32 Addition (SqlInt32 op1, SqlInt32 op2) { return (op1 + op2); }
1115 public SqlInt32 Subtraction (SqlInt32 op1, SqlInt32 op2) { return (op1 - op2); }
1116 public SqlInt32 Multiply (SqlInt32 op1, SqlInt32 op2) { return (op1 * op2); }
1117 public SqlInt32 Division (SqlInt32 op1, SqlInt32 op2) { return (op1 / op2); }
1118 public SqlInt32 Modulus (SqlInt32 op1, SqlInt32 op2) { return (op1 % op2); }
1119
1120 public SqlInt32 BitwiseAnd (SqlInt32 op1, SqlInt32 op2) { return (op1 & op2); }
1121 public SqlInt32 BitwiseOr (SqlInt32 op1, SqlInt32 op2) { return (op1 | op2); }
1122 public SqlInt32 ExclusiveOr (SqlInt32 op1, SqlInt32 op2) { return (op1 ^ op2); }
1123
1124 public SqlInt32 UnaryNegation (SqlInt32 op) { return (-op); }
1125 public SqlInt32 OnesComplement(SqlInt32 op) { return (~op); }
1126
1127 public bool Equality (SqlInt32 op1, SqlInt32 op2) { return (op1 == op2).IsTrue; }
1128 public bool Inequality (SqlInt32 op1, SqlInt32 op2) { return (op1 != op2).IsTrue; }
1129 public bool GreaterThan (SqlInt32 op1, SqlInt32 op2) { return (op1 > op2).IsTrue; }
1130 public bool GreaterThanOrEqual(SqlInt32 op1, SqlInt32 op2) { return (op1 >= op2).IsTrue; }
1131 public bool LessThan (SqlInt32 op1, SqlInt32 op2) { return (op1 < op2).IsTrue; }
1132 public bool LessThanOrEqual (SqlInt32 op1, SqlInt32 op2) { return (op1 <= op2).IsTrue; }
1133 }
1134
1135 #endregion
1136
1137 #region SqlInt64
1138
1139 private class DBS64 : IOperable<SqlInt64>
1140 {
1141 public SqlInt64 Addition (SqlInt64 op1, SqlInt64 op2) { return (op1 + op2); }
1142 public SqlInt64 Subtraction (SqlInt64 op1, SqlInt64 op2) { return (op1 - op2); }
1143 public SqlInt64 Multiply (SqlInt64 op1, SqlInt64 op2) { return (op1 * op2); }
1144 public SqlInt64 Division (SqlInt64 op1, SqlInt64 op2) { return (op1 / op2); }
1145 public SqlInt64 Modulus (SqlInt64 op1, SqlInt64 op2) { return (op1 % op2); }
1146
1147 public SqlInt64 BitwiseAnd (SqlInt64 op1, SqlInt64 op2) { return (op1 & op2); }
1148 public SqlInt64 BitwiseOr (SqlInt64 op1, SqlInt64 op2) { return (op1 | op2); }
1149 public SqlInt64 ExclusiveOr (SqlInt64 op1, SqlInt64 op2) { return (op1 ^ op2); }
1150
1151 public SqlInt64 UnaryNegation (SqlInt64 op) { return (-op); }
1152 public SqlInt64 OnesComplement(SqlInt64 op) { return (~op); }
1153
1154 public bool Equality (SqlInt64 op1, SqlInt64 op2) { return (op1 == op2).IsTrue; }
1155 public bool Inequality (SqlInt64 op1, SqlInt64 op2) { return (op1 != op2).IsTrue; }
1156 public bool GreaterThan (SqlInt64 op1, SqlInt64 op2) { return (op1 > op2).IsTrue; }
1157 public bool GreaterThanOrEqual(SqlInt64 op1, SqlInt64 op2) { return (op1 >= op2).IsTrue; }
1158 public bool LessThan (SqlInt64 op1, SqlInt64 op2) { return (op1 < op2).IsTrue; }
1159 public bool LessThanOrEqual (SqlInt64 op1, SqlInt64 op2) { return (op1 <= op2).IsTrue; }
1160 }
1161
1162 #endregion
1163
1164 #region SqlBoolean
1165
1166 private class DBB : IOperable<SqlBoolean>
1167 {
1168 public SqlBoolean Addition (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1169 public SqlBoolean Subtraction (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1170 public SqlBoolean Multiply (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1171 public SqlBoolean Division (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1172 public SqlBoolean Modulus (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1173
1174 public SqlBoolean BitwiseAnd (SqlBoolean op1, SqlBoolean op2) { return (op1 & op2); }
1175 public SqlBoolean BitwiseOr (SqlBoolean op1, SqlBoolean op2) { return (op1 | op2); }
1176 public SqlBoolean ExclusiveOr (SqlBoolean op1, SqlBoolean op2) { return (op1 ^ op2); }
1177
1178 public SqlBoolean UnaryNegation (SqlBoolean op) { throw new InvalidOperationException(); }
1179 public SqlBoolean OnesComplement(SqlBoolean op) { return !op; }
1180
1181 public bool Equality (SqlBoolean op1, SqlBoolean op2) { return (op1 == op2).IsTrue; }
1182 public bool Inequality (SqlBoolean op1, SqlBoolean op2) { return (op1 != op2).IsTrue; }
1183 public bool GreaterThan (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1184 public bool GreaterThanOrEqual (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1185 public bool LessThan (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1186 public bool LessThanOrEqual (SqlBoolean op1, SqlBoolean op2) { throw new InvalidOperationException(); }
1187 }
1188
1189 #endregion
1190
1191 #region SqlSingle
1192
1193 private class DBR4 : IOperable<SqlSingle>
1194 {
1195 public SqlSingle Addition (SqlSingle op1, SqlSingle op2) { return (op1 + op2); }
1196 public SqlSingle Subtraction (SqlSingle op1, SqlSingle op2) { return (op1 - op2); }
1197 public SqlSingle Multiply (SqlSingle op1, SqlSingle op2) { return (op1 * op2); }
1198 public SqlSingle Division (SqlSingle op1, SqlSingle op2) { return (op1 / op2); }
1199 public SqlSingle Modulus (SqlSingle op1, SqlSingle op2) { throw new InvalidOperationException(); }
1200
1201 public SqlSingle BitwiseAnd (SqlSingle op1, SqlSingle op2) { throw new InvalidOperationException(); }
1202 public SqlSingle BitwiseOr (SqlSingle op1, SqlSingle op2) { throw new InvalidOperationException(); }
1203 public SqlSingle ExclusiveOr (SqlSingle op1, SqlSingle op2) { throw new InvalidOperationException(); }
1204
1205 public SqlSingle UnaryNegation (SqlSingle op) { return (-op); }
1206 public SqlSingle OnesComplement(SqlSingle op) { throw new InvalidOperationException(); }
1207
1208 public bool Equality (SqlSingle op1, SqlSingle op2) { return (op1 == op2).IsTrue; }
1209 public bool Inequality (SqlSingle op1, SqlSingle op2) { return (op1 != op2).IsTrue; }
1210 public bool GreaterThan (SqlSingle op1, SqlSingle op2) { return (op1 > op2).IsTrue; }
1211 public bool GreaterThanOrEqual (SqlSingle op1, SqlSingle op2) { return (op1 >= op2).IsTrue; }
1212 public bool LessThan (SqlSingle op1, SqlSingle op2) { return (op1 < op2).IsTrue; }
1213 public bool LessThanOrEqual (SqlSingle op1, SqlSingle op2) { return (op1 <= op2).IsTrue; }
1214 }
1215
1216 #endregion
1217
1218 #region SqlDouble
1219
1220 private class DBR8 : IOperable<SqlDouble>
1221 {
1222 public SqlDouble Addition (SqlDouble op1, SqlDouble op2) { return (op1 + op2); }
1223 public SqlDouble Subtraction (SqlDouble op1, SqlDouble op2) { return (op1 - op2); }
1224 public SqlDouble Multiply (SqlDouble op1, SqlDouble op2) { return (op1 * op2); }
1225 public SqlDouble Division (SqlDouble op1, SqlDouble op2) { return (op1 / op2); }
1226 public SqlDouble Modulus (SqlDouble op1, SqlDouble op2) { throw new InvalidOperationException(); }
1227
1228 public SqlDouble BitwiseAnd (SqlDouble op1, SqlDouble op2) { throw new InvalidOperationException(); }
1229 public SqlDouble BitwiseOr (SqlDouble op1, SqlDouble op2) { throw new InvalidOperationException(); }
1230 public SqlDouble ExclusiveOr (SqlDouble op1, SqlDouble op2) { throw new InvalidOperationException(); }
1231
1232 public SqlDouble UnaryNegation (SqlDouble op) { return (-op); }
1233 public SqlDouble OnesComplement(SqlDouble op) { throw new InvalidOperationException(); }
1234
1235 public bool Equality (SqlDouble op1, SqlDouble op2) { return (op1 == op2).IsTrue; }
1236 public bool Inequality (SqlDouble op1, SqlDouble op2) { return (op1 != op2).IsTrue; }
1237 public bool GreaterThan (SqlDouble op1, SqlDouble op2) { return (op1 > op2).IsTrue; }
1238 public bool GreaterThanOrEqual (SqlDouble op1, SqlDouble op2) { return (op1 >= op2).IsTrue; }
1239 public bool LessThan (SqlDouble op1, SqlDouble op2) { return (op1 < op2).IsTrue; }
1240 public bool LessThanOrEqual (SqlDouble op1, SqlDouble op2) { return (op1 <= op2).IsTrue; }
1241 }
1242
1243 #endregion
1244
1245 #region SqlDecimal
1246
1247 private class DBD : IOperable<SqlDecimal>
1248 {
1249 public SqlDecimal Addition (SqlDecimal op1, SqlDecimal op2) { return (op1 + op2); }
1250 public SqlDecimal Subtraction (SqlDecimal op1, SqlDecimal op2) { return (op1 - op2); }
1251 public SqlDecimal Multiply (SqlDecimal op1, SqlDecimal op2) { return (op1 * op2); }
1252 public SqlDecimal Division (SqlDecimal op1, SqlDecimal op2) { return (op1 / op2); }
1253 public SqlDecimal Modulus (SqlDecimal op1, SqlDecimal op2) { throw new InvalidOperationException(); }
1254
1255 public SqlDecimal BitwiseAnd (SqlDecimal op1, SqlDecimal op2) { throw new InvalidOperationException(); }
1256 public SqlDecimal BitwiseOr (SqlDecimal op1, SqlDecimal op2) { throw new InvalidOperationException(); }
1257 public SqlDecimal ExclusiveOr (SqlDecimal op1, SqlDecimal op2) { throw new InvalidOperationException(); }
1258
1259 public SqlDecimal UnaryNegation (SqlDecimal op) { return (-op); }
1260 public SqlDecimal OnesComplement(SqlDecimal op) { throw new InvalidOperationException(); }
1261
1262 public bool Equality (SqlDecimal op1, SqlDecimal op2) { return (op1 == op2).IsTrue; }
1263 public bool Inequality (SqlDecimal op1, SqlDecimal op2) { return (op1 != op2).IsTrue; }
1264 public bool GreaterThan (SqlDecimal op1, SqlDecimal op2) { return (op1 > op2).IsTrue; }
1265 public bool GreaterThanOrEqual (SqlDecimal op1, SqlDecimal op2) { return (op1 >= op2).IsTrue; }
1266 public bool LessThan (SqlDecimal op1, SqlDecimal op2) { return (op1 < op2).IsTrue; }
1267 public bool LessThanOrEqual (SqlDecimal op1, SqlDecimal op2) { return (op1 <= op2).IsTrue; }
1268 }
1269
1270 #endregion
1271
1272 #region SqlMoney
1273
1274 private class DBM : IOperable<SqlMoney>
1275 {
1276 public SqlMoney Addition (SqlMoney op1, SqlMoney op2) { return (op1 + op2); }
1277 public SqlMoney Subtraction (SqlMoney op1, SqlMoney op2) { return (op1 - op2); }
1278 public SqlMoney Multiply (SqlMoney op1, SqlMoney op2) { return (op1 * op2); }
1279 public SqlMoney Division (SqlMoney op1, SqlMoney op2) { return (op1 / op2); }
1280 public SqlMoney Modulus (SqlMoney op1, SqlMoney op2) { throw new InvalidOperationException(); }
1281
1282 public SqlMoney BitwiseAnd (SqlMoney op1, SqlMoney op2) { throw new InvalidOperationException(); }
1283 public SqlMoney BitwiseOr (SqlMoney op1, SqlMoney op2) { throw new InvalidOperationException(); }
1284 public SqlMoney ExclusiveOr (SqlMoney op1, SqlMoney op2) { throw new InvalidOperationException(); }
1285
1286 public SqlMoney UnaryNegation (SqlMoney op) { return (-op); }
1287 public SqlMoney OnesComplement(SqlMoney op) { throw new InvalidOperationException(); }
1288
1289 public bool Equality (SqlMoney op1, SqlMoney op2) { return (op1 == op2).IsTrue; }
1290 public bool Inequality (SqlMoney op1, SqlMoney op2) { return (op1 != op2).IsTrue; }
1291 public bool GreaterThan (SqlMoney op1, SqlMoney op2) { return (op1 > op2).IsTrue; }
1292 public bool GreaterThanOrEqual(SqlMoney op1, SqlMoney op2) { return (op1 >= op2).IsTrue; }
1293 public bool LessThan (SqlMoney op1, SqlMoney op2) { return (op1 < op2).IsTrue; }
1294 public bool LessThanOrEqual (SqlMoney op1, SqlMoney op2) { return (op1 <= op2).IsTrue; }
1295 }
1296
1297 #endregion
1298
1299 #region SqlDateTime
1300
1301 private class DBDT : IOperable<SqlDateTime>
1302 {
1303 public SqlDateTime Addition (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1304 public SqlDateTime Subtraction (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1305 public SqlDateTime Multiply (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1306 public SqlDateTime Division (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1307 public SqlDateTime Modulus (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1308
1309 public SqlDateTime BitwiseAnd (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1310 public SqlDateTime BitwiseOr (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1311 public SqlDateTime ExclusiveOr (SqlDateTime op1, SqlDateTime op2) { throw new InvalidOperationException(); }
1312
1313 public SqlDateTime UnaryNegation (SqlDateTime op) { throw new InvalidOperationException(); }
1314 public SqlDateTime OnesComplement(SqlDateTime op) { throw new InvalidOperationException(); }
1315
1316 public bool Equality (SqlDateTime op1, SqlDateTime op2) { return (op1 == op2).IsTrue; }
1317 public bool Inequality (SqlDateTime op1, SqlDateTime op2) { return (op1 != op2).IsTrue; }
1318 public bool GreaterThan (SqlDateTime op1, SqlDateTime op2) { return (op1 > op2).IsTrue; }
1319 public bool GreaterThanOrEqual (SqlDateTime op1, SqlDateTime op2) { return (op1 >= op2).IsTrue; }
1320 public bool LessThan (SqlDateTime op1, SqlDateTime op2) { return (op1 < op2).IsTrue; }
1321 public bool LessThanOrEqual (SqlDateTime op1, SqlDateTime op2) { return (op1 <= op2).IsTrue; }
1322 }
1323
1324 #endregion
1325
1326 #region SqlBinary
1327
1328 private class DBBin : IOperable<SqlBinary>
1329 {
1330 public SqlBinary Addition (SqlBinary op1, SqlBinary op2) { return (op1 + op2); }
1331 public SqlBinary Subtraction (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1332 public SqlBinary Multiply (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1333 public SqlBinary Division (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1334 public SqlBinary Modulus (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1335
1336 public SqlBinary BitwiseAnd (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1337 public SqlBinary BitwiseOr (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1338 public SqlBinary ExclusiveOr (SqlBinary op1, SqlBinary op2) { throw new InvalidOperationException(); }
1339
1340 public SqlBinary UnaryNegation (SqlBinary op) { throw new InvalidOperationException(); }
1341 public SqlBinary OnesComplement(SqlBinary op) { throw new InvalidOperationException(); }
1342
1343 public bool Equality (SqlBinary op1, SqlBinary op2) { return (op1 == op2).IsTrue; }
1344 public bool Inequality (SqlBinary op1, SqlBinary op2) { return (op1 != op2).IsTrue; }
1345 public bool GreaterThan (SqlBinary op1, SqlBinary op2) { return (op1 > op2).IsTrue; }
1346 public bool GreaterThanOrEqual (SqlBinary op1, SqlBinary op2) { return (op1 >= op2).IsTrue; }
1347 public bool LessThan (SqlBinary op1, SqlBinary op2) { return (op1 < op2).IsTrue; }
1348 public bool LessThanOrEqual (SqlBinary op1, SqlBinary op2) { return (op1 <= op2).IsTrue; }
1349 }
1350
1351 #endregion
1352
1353 #region SqlGuid
1354
1355 private class DBG : IOperable<SqlGuid>
1356 {
1357 public SqlGuid Addition (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1358 public SqlGuid Subtraction (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1359 public SqlGuid Multiply (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1360 public SqlGuid Division (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1361 public SqlGuid Modulus (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1362
1363 public SqlGuid BitwiseAnd (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1364 public SqlGuid BitwiseOr (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1365 public SqlGuid ExclusiveOr (SqlGuid op1, SqlGuid op2) { throw new InvalidOperationException(); }
1366
1367 public SqlGuid UnaryNegation (SqlGuid op) { throw new InvalidOperationException(); }
1368 public SqlGuid OnesComplement (SqlGuid op) { throw new InvalidOperationException(); }
1369
1370 public bool Equality (SqlGuid op1, SqlGuid op2) { return (op1 == op2).IsTrue; }
1371 public bool Inequality (SqlGuid op1, SqlGuid op2) { return (op1 != op2).IsTrue; }
1372 public bool GreaterThan (SqlGuid op1, SqlGuid op2) { return (op1 > op2).IsTrue; }
1373 public bool GreaterThanOrEqual(SqlGuid op1, SqlGuid op2) { return (op1 >= op2).IsTrue; }
1374 public bool LessThan (SqlGuid op1, SqlGuid op2) { return (op1 < op2).IsTrue; }
1375 public bool LessThanOrEqual (SqlGuid op1, SqlGuid op2) { return (op1 <= op2).IsTrue; }
1376 }
1377
1378 #endregion
1379
1380 #endregion
1381 }
1382
1383 public static class Operator
1384 {
1385 public static T Addition <T>(T a, T b) { return Operator<T>.Op.Addition (a, b); }
1386 public static T Subtraction <T>(T a, T b) { return Operator<T>.Op.Subtraction (a, b); }
1387 public static T Multiply <T>(T a, T b) { return Operator<T>.Op.Multiply (a, b); }
1388 public static T Division <T>(T a, T b) { return Operator<T>.Op.Division (a, b); }
1389 public static T Modulus <T>(T a, T b) { return Operator<T>.Op.Modulus (a, b); }
1390
1391 public static T BitwiseAnd <T>(T a, T b) { return Operator<T>.Op.BitwiseAnd (a, b); }
1392 public static T BitwiseOr <T>(T a, T b) { return Operator<T>.Op.BitwiseOr (a, b); }
1393 public static T ExclusiveOr <T>(T a, T b) { return Operator<T>.Op.ExclusiveOr (a, b); }
1394
1395 public static T UnaryNegation <T>(T a) { return Operator<T>.Op.UnaryNegation (a); }
1396 public static T OnesComplement <T>(T a) { return Operator<T>.Op.OnesComplement (a); }
1397
1398 public static bool Equality <T>(T a, T b) { return Operator<T>.Op.Equality (a, b); }
1399 public static bool Inequality <T>(T a, T b) { return Operator<T>.Op.Inequality (a, b); }
1400 public static bool GreaterThan <T>(T a, T b) { return Operator<T>.Op.GreaterThan (a, b); }
1401 public static bool GreaterThanOrEqual<T>(T a, T b) { return Operator<T>.Op.GreaterThanOrEqual(a, b); }
1402 public static bool LessThan <T>(T a, T b) { return Operator<T>.Op.LessThan (a, b); }
1403 public static bool LessThanOrEqual <T>(T a, T b) { return Operator<T>.Op.LessThanOrEqual (a, b); }
1404 }
1405 }