1 // ---------------------------------------------------------------------------
2 // Copyright (C) 2005 Microsoft Corporation All Rights Reserved
3 // ---------------------------------------------------------------------------
4 
5 #define CODE_ANALYSIS
6 using System.CodeDom;
7 using System.Collections.Generic;
8 using System.Diagnostics;
9 using System.Diagnostics.CodeAnalysis;
10 using System.Globalization;
11 using System.Reflection;
12 using System.Workflow.ComponentModel;
13 using System.Workflow.ComponentModel.Compiler;
14 using System.Workflow.Activities.Common;
15 
16 namespace System.Workflow.Activities.Rules
17 {
18     #region Literal Class
19     /// <summary>
20     /// Represents a typed literal value and is the base class for all type specific literal classes
21     /// </summary>
22     internal abstract class Literal
23     {
24         #region Properties
25         /// <summary>
26         /// A delegate for literal factory methods
27         /// </summary>
LiteralMaker(object literalValue)28         private delegate Literal LiteralMaker(object literalValue);
29 
30         /// <summary>
31         /// Collection of literal factory methods indexed by type
32         /// </summary>
33         static private Dictionary<Type, LiteralMaker> types = CreateMakersDictionary();
34 
35         /// <summary>
36         /// The type of the literal
37         /// </summary>
38         protected internal Type m_type;
39 
40         /// <summary>
41         /// Get the boxed literal
42         /// </summary>
43         internal abstract object Value { get; }
44 
45         /// <summary>
46         /// Group types by similar characteristics so we can check if comparisons succeed
47         /// </summary>
48         [Flags()]
49         enum TypeFlags
50         {
51             SignedNumbers = 0x01,
52             UnsignedNumbers = 0x02,
53             ULong = 0x04,
54             Float = 0x08,
55             Decimal = 0x10,
56             String = 0x20,
57             Bool = 0x40
58         };
59 
60         /// <summary>
61         /// Collection of TypeFlags for the supported value types indexed by type
62         /// </summary>
63         private static Dictionary<Type, TypeFlags> supportedTypes = CreateTypesDictionary();
64 
CreateMakersDictionary()65         private static Dictionary<Type, LiteralMaker> CreateMakersDictionary()
66         {
67             // Create the literal class factory delegates
68             Dictionary<Type, LiteralMaker> dictionary = new Dictionary<Type, LiteralMaker>(32);
69             dictionary.Add(typeof(byte), new LiteralMaker(Literal.MakeByte));
70             dictionary.Add(typeof(sbyte), new LiteralMaker(Literal.MakeSByte));
71             dictionary.Add(typeof(short), new LiteralMaker(Literal.MakeShort));
72             dictionary.Add(typeof(int), new LiteralMaker(Literal.MakeInt));
73             dictionary.Add(typeof(long), new LiteralMaker(Literal.MakeLong));
74             dictionary.Add(typeof(ushort), new LiteralMaker(Literal.MakeUShort));
75             dictionary.Add(typeof(uint), new LiteralMaker(Literal.MakeUInt));
76             dictionary.Add(typeof(ulong), new LiteralMaker(Literal.MakeULong));
77             dictionary.Add(typeof(float), new LiteralMaker(Literal.MakeFloat));
78             dictionary.Add(typeof(double), new LiteralMaker(Literal.MakeDouble));
79             dictionary.Add(typeof(char), new LiteralMaker(Literal.MakeChar));
80             dictionary.Add(typeof(string), new LiteralMaker(Literal.MakeString));
81             dictionary.Add(typeof(decimal), new LiteralMaker(Literal.MakeDecimal));
82             dictionary.Add(typeof(bool), new LiteralMaker(Literal.MakeBool));
83             dictionary.Add(typeof(byte?), new LiteralMaker(Literal.MakeByte));
84             dictionary.Add(typeof(sbyte?), new LiteralMaker(Literal.MakeSByte));
85             dictionary.Add(typeof(short?), new LiteralMaker(Literal.MakeShort));
86             dictionary.Add(typeof(int?), new LiteralMaker(Literal.MakeInt));
87             dictionary.Add(typeof(long?), new LiteralMaker(Literal.MakeLong));
88             dictionary.Add(typeof(ushort?), new LiteralMaker(Literal.MakeUShort));
89             dictionary.Add(typeof(uint?), new LiteralMaker(Literal.MakeUInt));
90             dictionary.Add(typeof(ulong?), new LiteralMaker(Literal.MakeULong));
91             dictionary.Add(typeof(float?), new LiteralMaker(Literal.MakeFloat));
92             dictionary.Add(typeof(double?), new LiteralMaker(Literal.MakeDouble));
93             dictionary.Add(typeof(char?), new LiteralMaker(Literal.MakeChar));
94             dictionary.Add(typeof(decimal?), new LiteralMaker(Literal.MakeDecimal));
95             dictionary.Add(typeof(bool?), new LiteralMaker(Literal.MakeBool));
96             return dictionary;
97         }
98 
CreateTypesDictionary()99         private static Dictionary<Type, TypeFlags> CreateTypesDictionary()
100         {
101             // Create the literal class factory delegates
102             Dictionary<Type, TypeFlags> dictionary = new Dictionary<Type, TypeFlags>(32);
103             dictionary.Add(typeof(byte), TypeFlags.UnsignedNumbers);
104             dictionary.Add(typeof(byte?), TypeFlags.UnsignedNumbers);
105             dictionary.Add(typeof(sbyte), TypeFlags.SignedNumbers);
106             dictionary.Add(typeof(sbyte?), TypeFlags.SignedNumbers);
107             dictionary.Add(typeof(short), TypeFlags.SignedNumbers);
108             dictionary.Add(typeof(short?), TypeFlags.SignedNumbers);
109             dictionary.Add(typeof(int), TypeFlags.SignedNumbers);
110             dictionary.Add(typeof(int?), TypeFlags.SignedNumbers);
111             dictionary.Add(typeof(long), TypeFlags.SignedNumbers);
112             dictionary.Add(typeof(long?), TypeFlags.SignedNumbers);
113             dictionary.Add(typeof(ushort), TypeFlags.UnsignedNumbers);
114             dictionary.Add(typeof(ushort?), TypeFlags.UnsignedNumbers);
115             dictionary.Add(typeof(uint), TypeFlags.UnsignedNumbers);
116             dictionary.Add(typeof(uint?), TypeFlags.UnsignedNumbers);
117             dictionary.Add(typeof(ulong), TypeFlags.ULong);
118             dictionary.Add(typeof(ulong?), TypeFlags.ULong);
119             dictionary.Add(typeof(float), TypeFlags.Float);
120             dictionary.Add(typeof(float?), TypeFlags.Float);
121             dictionary.Add(typeof(double), TypeFlags.Float);
122             dictionary.Add(typeof(double?), TypeFlags.Float);
123             dictionary.Add(typeof(char), TypeFlags.UnsignedNumbers);
124             dictionary.Add(typeof(char?), TypeFlags.UnsignedNumbers);
125             dictionary.Add(typeof(string), TypeFlags.String);
126             dictionary.Add(typeof(decimal), TypeFlags.Decimal);
127             dictionary.Add(typeof(decimal?), TypeFlags.Decimal);
128             dictionary.Add(typeof(bool), TypeFlags.Bool);
129             dictionary.Add(typeof(bool?), TypeFlags.Bool);
130             return dictionary;
131         }
132         #endregion
133 
134         #region Factory Methods
MakeLiteral(Type literalType, object literalValue)135         internal static Literal MakeLiteral(Type literalType, object literalValue)
136         {
137             if (literalValue == null)
138                 return new NullLiteral(literalType);
139 
140             LiteralMaker f;
141             if (types.TryGetValue(literalType, out f))
142             {
143                 try
144                 {
145                     return f(literalValue);
146                 }
147                 catch (InvalidCastException e)
148                 {
149                     throw new RuleEvaluationIncompatibleTypesException(
150                         string.Format(CultureInfo.CurrentCulture,
151                             Messages.InvalidCast,
152                             RuleDecompiler.DecompileType(literalValue.GetType()),
153                             RuleDecompiler.DecompileType(literalType)),
154                         literalType,
155                         CodeBinaryOperatorType.Assign,
156                         literalValue.GetType(),
157                         e);
158                 }
159             }
160             return null;
161         }
162 
163         /// <summary>
164         /// Factory function for a boolean type
165         /// </summary>
166         /// <param name="literalValue"></param>
167         /// <param name="readOnly"></param>
MakeBool(object literalValue)168         private static Literal MakeBool(object literalValue)
169         {
170             return new BoolLiteral((bool)literalValue);
171         }
172 
173         /// <summary>
174         /// Factory function for a byte type
175         /// </summary>
176         /// <param name="literalValue"></param>
177         /// <param name="readOnly"></param>
MakeByte(object literalValue)178         private static Literal MakeByte(object literalValue)
179         {
180             return new ByteLiteral((byte)literalValue);
181         }
182 
183         /// <summary>
184         /// Factory function for a sbyte type
185         /// </summary>
186         /// <param name="literalValue"></param>
187         /// <param name="readOnly"></param>
MakeSByte(object literalValue)188         private static Literal MakeSByte(object literalValue)
189         {
190             return new SByteLiteral((sbyte)literalValue);
191         }
192 
193         /// <summary>
194         /// Factory function for a char type
195         /// </summary>
196         /// <param name="literalValue"></param>
197         /// <param name="readOnly"></param>
MakeChar(object literalValue)198         private static Literal MakeChar(object literalValue)
199         {
200             return new CharLiteral((char)literalValue);
201         }
202 
203         /// <summary>
204         /// Factory function for a decimal type
205         /// </summary>
206         /// <param name="literalValue"></param>
207         /// <param name="readOnly"></param>
MakeDecimal(object literalValue)208         private static Literal MakeDecimal(object literalValue)
209         {
210             return new DecimalLiteral((decimal)literalValue);
211         }
212 
213         /// <summary>
214         /// Factory function for an Int16 type
215         /// </summary>
216         /// <param name="literalValue"></param>
217         /// <param name="readOnly"></param>
MakeShort(object literalValue)218         private static Literal MakeShort(object literalValue)
219         {
220             return new ShortLiteral((short)literalValue);
221         }
222 
223         /// <summary>
224         /// Factory function for an Int32 type
225         /// </summary>
226         /// <param name="literalValue"></param>
227         /// <param name="readOnly"></param>
MakeInt(object literalValue)228         private static Literal MakeInt(object literalValue)
229         {
230             return new IntLiteral((int)literalValue);
231         }
232 
233         /// <summary>
234         /// Factory function for an Int64 type
235         /// </summary>
236         /// <param name="literalValue"></param>
237         /// <param name="readOnly"></param>
MakeLong(object literalValue)238         private static Literal MakeLong(object literalValue)
239         {
240             return new LongLiteral((long)literalValue);
241         }
242 
243         /// <summary>
244         /// Factory function for an UInt16 type
245         /// </summary>
246         /// <param name="literalValue"></param>
247         /// <param name="readOnly"></param>
MakeUShort(object literalValue)248         private static Literal MakeUShort(object literalValue)
249         {
250             return new UShortLiteral((ushort)literalValue);
251         }
252 
253         /// <summary>
254         /// Factory function for an UInt32 type
255         /// </summary>
256         /// <param name="literalValue"></param>
257         /// <param name="readOnly"></param>
MakeUInt(object literalValue)258         private static Literal MakeUInt(object literalValue)
259         {
260             return new UIntLiteral((uint)literalValue);
261         }
262 
263         /// <summary>
264         /// Factory function for an UInt64 type
265         /// </summary>
266         /// <param name="literalValue"></param>
267         /// <param name="readOnly"></param>
MakeULong(object literalValue)268         private static Literal MakeULong(object literalValue)
269         {
270             return new ULongLiteral((ulong)literalValue);
271         }
272 
273         /// <summary>
274         /// Factory function for a float type
275         /// </summary>
276         /// <param name="literalValue"></param>
277         /// <param name="readOnly"></param>
MakeFloat(object literalValue)278         private static Literal MakeFloat(object literalValue)
279         {
280             return new FloatLiteral((float)literalValue);
281         }
282 
283         /// <summary>
284         /// Factory function for a double type
285         /// </summary>
286         /// <param name="literalValue"></param>
287         /// <param name="readOnly"></param>
MakeDouble(object literalValue)288         private static Literal MakeDouble(object literalValue)
289         {
290             return new DoubleLiteral((double)literalValue);
291         }
292 
293         /// <summary>
294         /// Factory function for a string type
295         /// </summary>
296         /// <param name="literalValue"></param>
297         /// <param name="readOnly"></param>
MakeString(object literalValue)298         private static Literal MakeString(object literalValue)
299         {
300             return new StringLiteral((string)literalValue);
301         }
302         #endregion
303 
304         #region Default Operators
305         internal static class DefaultOperators
306         {
Addition(int x, int y)307             public static int Addition(int x, int y) { return x + y; }
Addition(uint x, uint y)308             public static uint Addition(uint x, uint y) { return x + y; }
Addition(long x, long y)309             public static long Addition(long x, long y) { return x + y; }
Addition(ulong x, ulong y)310             public static ulong Addition(ulong x, ulong y) { return x + y; }
Addition(float x, float y)311             public static float Addition(float x, float y) { return x + y; }
Addition(double x, double y)312             public static double Addition(double x, double y) { return x + y; }
Addition(decimal x, decimal y)313             public static decimal Addition(decimal x, decimal y) { return x + y; }
Addition(string x, string y)314             public static string Addition(string x, string y) { return x + y; }
Addition(string x, object y)315             public static string Addition(string x, object y) { return x + y; }
Addition(object x, string y)316             public static string Addition(object x, string y) { return x + y; }
317 
Subtraction(int x, int y)318             public static int Subtraction(int x, int y) { return x - y; }
Subtraction(uint x, uint y)319             public static uint Subtraction(uint x, uint y) { return x - y; }
Subtraction(long x, long y)320             public static long Subtraction(long x, long y) { return x - y; }
Subtraction(ulong x, ulong y)321             public static ulong Subtraction(ulong x, ulong y) { return x - y; }
Subtraction(float x, float y)322             public static float Subtraction(float x, float y) { return x - y; }
Subtraction(double x, double y)323             public static double Subtraction(double x, double y) { return x - y; }
Subtraction(decimal x, decimal y)324             public static decimal Subtraction(decimal x, decimal y) { return x - y; }
325 
Multiply(int x, int y)326             public static int Multiply(int x, int y) { return x * y; }
Multiply(uint x, uint y)327             public static uint Multiply(uint x, uint y) { return x * y; }
Multiply(long x, long y)328             public static long Multiply(long x, long y) { return x * y; }
Multiply(ulong x, ulong y)329             public static ulong Multiply(ulong x, ulong y) { return x * y; }
Multiply(float x, float y)330             public static float Multiply(float x, float y) { return x * y; }
Multiply(double x, double y)331             public static double Multiply(double x, double y) { return x * y; }
Multiply(decimal x, decimal y)332             public static decimal Multiply(decimal x, decimal y) { return x * y; }
333 
Division(int x, int y)334             public static int Division(int x, int y) { return x / y; }
Division(uint x, uint y)335             public static uint Division(uint x, uint y) { return x / y; }
Division(long x, long y)336             public static long Division(long x, long y) { return x / y; }
Division(ulong x, ulong y)337             public static ulong Division(ulong x, ulong y) { return x / y; }
Division(float x, float y)338             public static float Division(float x, float y) { return x / y; }
Division(double x, double y)339             public static double Division(double x, double y) { return x / y; }
Division(decimal x, decimal y)340             public static decimal Division(decimal x, decimal y) { return x / y; }
341 
Modulus(int x, int y)342             public static int Modulus(int x, int y) { return x % y; }
Modulus(uint x, uint y)343             public static uint Modulus(uint x, uint y) { return x % y; }
Modulus(long x, long y)344             public static long Modulus(long x, long y) { return x % y; }
Modulus(ulong x, ulong y)345             public static ulong Modulus(ulong x, ulong y) { return x % y; }
Modulus(float x, float y)346             public static float Modulus(float x, float y) { return x % y; }
Modulus(double x, double y)347             public static double Modulus(double x, double y) { return x % y; }
Modulus(decimal x, decimal y)348             public static decimal Modulus(decimal x, decimal y) { return x % y; }
349 
BitwiseAnd(int x, int y)350             public static int BitwiseAnd(int x, int y) { return x & y; }
BitwiseAnd(uint x, uint y)351             public static uint BitwiseAnd(uint x, uint y) { return x & y; }
BitwiseAnd(long x, long y)352             public static long BitwiseAnd(long x, long y) { return x & y; }
BitwiseAnd(ulong x, ulong y)353             public static ulong BitwiseAnd(ulong x, ulong y) { return x & y; }
BitwiseAnd(bool x, bool y)354             public static bool BitwiseAnd(bool x, bool y) { return x & y; }
355 
BitwiseOr(int x, int y)356             public static int BitwiseOr(int x, int y) { return x | y; }
BitwiseOr(uint x, uint y)357             public static uint BitwiseOr(uint x, uint y) { return x | y; }
BitwiseOr(long x, long y)358             public static long BitwiseOr(long x, long y) { return x | y; }
BitwiseOr(ulong x, ulong y)359             public static ulong BitwiseOr(ulong x, ulong y) { return x | y; }
BitwiseOr(bool x, bool y)360             public static bool BitwiseOr(bool x, bool y) { return x | y; }
361 
Equality(int x, int y)362             public static bool Equality(int x, int y) { return x == y; }
Equality(uint x, uint y)363             public static bool Equality(uint x, uint y) { return x == y; }
Equality(long x, long y)364             public static bool Equality(long x, long y) { return x == y; }
Equality(ulong x, ulong y)365             public static bool Equality(ulong x, ulong y) { return x == y; }
Equality(float x, float y)366             public static bool Equality(float x, float y) { return x == y; }
Equality(double x, double y)367             public static bool Equality(double x, double y) { return x == y; }
Equality(decimal x, decimal y)368             public static bool Equality(decimal x, decimal y) { return x == y; }
Equality(bool x, bool y)369             public static bool Equality(bool x, bool y) { return x == y; }
Equality(string x, string y)370             public static bool Equality(string x, string y) { return x == y; }
371             // mark object == object since it has special rules
ObjectEquality(object x, object y)372             public static bool ObjectEquality(object x, object y) { return x == y; }
373 
GreaterThan(int x, int y)374             public static bool GreaterThan(int x, int y) { return x > y; }
GreaterThan(uint x, uint y)375             public static bool GreaterThan(uint x, uint y) { return x > y; }
GreaterThan(long x, long y)376             public static bool GreaterThan(long x, long y) { return x > y; }
GreaterThan(ulong x, ulong y)377             public static bool GreaterThan(ulong x, ulong y) { return x > y; }
GreaterThan(float x, float y)378             public static bool GreaterThan(float x, float y) { return x > y; }
GreaterThan(double x, double y)379             public static bool GreaterThan(double x, double y) { return x > y; }
GreaterThan(decimal x, decimal y)380             public static bool GreaterThan(decimal x, decimal y) { return x > y; }
381 
GreaterThanOrEqual(int x, int y)382             public static bool GreaterThanOrEqual(int x, int y) { return x >= y; }
GreaterThanOrEqual(uint x, uint y)383             public static bool GreaterThanOrEqual(uint x, uint y) { return x >= y; }
GreaterThanOrEqual(long x, long y)384             public static bool GreaterThanOrEqual(long x, long y) { return x >= y; }
GreaterThanOrEqual(ulong x, ulong y)385             public static bool GreaterThanOrEqual(ulong x, ulong y) { return x >= y; }
GreaterThanOrEqual(float x, float y)386             public static bool GreaterThanOrEqual(float x, float y) { return x >= y; }
GreaterThanOrEqual(double x, double y)387             public static bool GreaterThanOrEqual(double x, double y) { return x >= y; }
GreaterThanOrEqual(decimal x, decimal y)388             public static bool GreaterThanOrEqual(decimal x, decimal y) { return x >= y; }
389 
LessThan(int x, int y)390             public static bool LessThan(int x, int y) { return x < y; }
LessThan(uint x, uint y)391             public static bool LessThan(uint x, uint y) { return x < y; }
LessThan(long x, long y)392             public static bool LessThan(long x, long y) { return x < y; }
LessThan(ulong x, ulong y)393             public static bool LessThan(ulong x, ulong y) { return x < y; }
LessThan(float x, float y)394             public static bool LessThan(float x, float y) { return x < y; }
LessThan(double x, double y)395             public static bool LessThan(double x, double y) { return x < y; }
LessThan(decimal x, decimal y)396             public static bool LessThan(decimal x, decimal y) { return x < y; }
397 
LessThanOrEqual(int x, int y)398             public static bool LessThanOrEqual(int x, int y) { return x <= y; }
LessThanOrEqual(uint x, uint y)399             public static bool LessThanOrEqual(uint x, uint y) { return x <= y; }
LessThanOrEqual(long x, long y)400             public static bool LessThanOrEqual(long x, long y) { return x <= y; }
LessThanOrEqual(ulong x, ulong y)401             public static bool LessThanOrEqual(ulong x, ulong y) { return x <= y; }
LessThanOrEqual(float x, float y)402             public static bool LessThanOrEqual(float x, float y) { return x <= y; }
LessThanOrEqual(double x, double y)403             public static bool LessThanOrEqual(double x, double y) { return x <= y; }
LessThanOrEqual(decimal x, decimal y)404             public static bool LessThanOrEqual(decimal x, decimal y) { return x <= y; }
405         }
406         #endregion
407 
408         #region Type Checking Methods
409 
410         [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
AllowedComparison( Type lhs, CodeExpression lhsExpression, Type rhs, CodeExpression rhsExpression, CodeBinaryOperatorType comparison, RuleValidation validator, out ValidationError error)411         internal static RuleBinaryExpressionInfo AllowedComparison(
412             Type lhs,
413             CodeExpression lhsExpression,
414             Type rhs,
415             CodeExpression rhsExpression,
416             CodeBinaryOperatorType comparison,
417             RuleValidation validator,
418             out ValidationError error)
419         {
420             // note that null values come in as a NullLiteral type
421             TypeFlags lhsFlags, rhsFlags;
422 
423             // are the types supported?
424             if ((supportedTypes.TryGetValue(lhs, out lhsFlags)) && (supportedTypes.TryGetValue(rhs, out rhsFlags)))
425             {
426                 // both sides supported
427                 if (lhsFlags == rhsFlags)
428                 {
429                     // both sides the same type, so it's allowed
430                     // only allow equality on booleans
431                     if ((lhsFlags == TypeFlags.Bool) && (comparison != CodeBinaryOperatorType.ValueEquality))
432                     {
433                         string message = string.Format(CultureInfo.CurrentCulture, Messages.RelationalOpBadTypes, comparison.ToString(),
434                             RuleDecompiler.DecompileType(lhs),
435                             RuleDecompiler.DecompileType(rhs));
436                         error = new ValidationError(message, ErrorNumbers.Error_OperandTypesIncompatible);
437                         return null;
438                     }
439                     error = null;
440                     return new RuleBinaryExpressionInfo(lhs, rhs, typeof(bool));
441                 }
442 
443                 // if not the same, only certain combinations allowed
444                 switch (lhsFlags | rhsFlags)
445                 {
446                     case TypeFlags.Decimal | TypeFlags.SignedNumbers:
447                     case TypeFlags.Decimal | TypeFlags.UnsignedNumbers:
448                     case TypeFlags.Decimal | TypeFlags.ULong:
449                     case TypeFlags.Float | TypeFlags.SignedNumbers:
450                     case TypeFlags.Float | TypeFlags.UnsignedNumbers:
451                     case TypeFlags.Float | TypeFlags.ULong:
452                     case TypeFlags.ULong | TypeFlags.UnsignedNumbers:
453                     case TypeFlags.SignedNumbers | TypeFlags.UnsignedNumbers:
454                         error = null;
455                         return new RuleBinaryExpressionInfo(lhs, rhs, typeof(bool));
456                 }
457                 string message2 = string.Format(CultureInfo.CurrentCulture, Messages.RelationalOpBadTypes, comparison.ToString(),
458                     (lhs == typeof(NullLiteral)) ? Messages.NullValue : RuleDecompiler.DecompileType(lhs),
459                     (rhs == typeof(NullLiteral)) ? Messages.NullValue : RuleDecompiler.DecompileType(rhs));
460                 error = new ValidationError(message2, ErrorNumbers.Error_OperandTypesIncompatible);
461                 return null;
462             }
463             else
464             {
465                 // see if they override the operator
466                 MethodInfo operatorOverride = MapOperatorToMethod(comparison, lhs, lhsExpression, rhs, rhsExpression, validator, out error);
467                 if (operatorOverride != null)
468                     return new RuleBinaryExpressionInfo(lhs, rhs, operatorOverride);
469 
470                 // unable to evaluate, so return false
471                 return null;
472             }
473         }
474 
475         internal enum OperatorGrouping
476         {
477             Arithmetic,
478             Equality,
479             Relational
480         }
481 
482         internal static MethodInfo ObjectEquality = typeof(DefaultOperators).GetMethod("ObjectEquality");
483 
484         [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
485         [SuppressMessage("Microsoft.Performance", "CA1803:AvoidCostlyCallsWherePossible")]
486         [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]     // bogus since the casts are in different case statements
MapOperatorToMethod( CodeBinaryOperatorType op, Type lhs, CodeExpression lhsExpression, Type rhs, CodeExpression rhsExpression, RuleValidation validator, out ValidationError error)487         internal static MethodInfo MapOperatorToMethod(
488             CodeBinaryOperatorType op,
489             Type lhs,
490             CodeExpression lhsExpression,
491             Type rhs,
492             CodeExpression rhsExpression,
493             RuleValidation validator,
494             out ValidationError error)
495         {
496             // determine what the method name should be
497             string methodName;
498             string message;
499             OperatorGrouping group;
500 
501             switch (op)
502             {
503                 case CodeBinaryOperatorType.ValueEquality:
504                     methodName = "op_Equality";
505                     group = OperatorGrouping.Equality;
506                     break;
507                 case CodeBinaryOperatorType.GreaterThan:
508                     methodName = "op_GreaterThan";
509                     group = OperatorGrouping.Relational;
510                     break;
511                 case CodeBinaryOperatorType.GreaterThanOrEqual:
512                     methodName = "op_GreaterThanOrEqual";
513                     group = OperatorGrouping.Relational;
514                     break;
515                 case CodeBinaryOperatorType.LessThan:
516                     methodName = "op_LessThan";
517                     group = OperatorGrouping.Relational;
518                     break;
519                 case CodeBinaryOperatorType.LessThanOrEqual:
520                     methodName = "op_LessThanOrEqual";
521                     group = OperatorGrouping.Relational;
522                     break;
523                 case CodeBinaryOperatorType.Add:
524                     methodName = "op_Addition";
525                     group = OperatorGrouping.Arithmetic;
526                     break;
527                 case CodeBinaryOperatorType.Subtract:
528                     methodName = "op_Subtraction";
529                     group = OperatorGrouping.Arithmetic;
530                     break;
531                 case CodeBinaryOperatorType.Multiply:
532                     methodName = "op_Multiply";
533                     group = OperatorGrouping.Arithmetic;
534                     break;
535                 case CodeBinaryOperatorType.Divide:
536                     methodName = "op_Division";
537                     group = OperatorGrouping.Arithmetic;
538                     break;
539                 case CodeBinaryOperatorType.Modulus:
540                     methodName = "op_Modulus";
541                     group = OperatorGrouping.Arithmetic;
542                     break;
543                 case CodeBinaryOperatorType.BitwiseAnd:
544                     methodName = "op_BitwiseAnd";
545                     group = OperatorGrouping.Arithmetic;
546                     break;
547                 case CodeBinaryOperatorType.BitwiseOr:
548                     methodName = "op_BitwiseOr";
549                     group = OperatorGrouping.Arithmetic;
550                     break;
551                 default:
552                     Debug.Assert(false, "Operator " + op.ToString() + " not implemented");
553                     message = string.Format(CultureInfo.CurrentCulture, Messages.BinaryOpNotSupported, op.ToString());
554                     error = new ValidationError(message, ErrorNumbers.Error_CodeExpressionNotHandled);
555                     return null;
556             }
557 
558             // NOTE: types maybe NullLiteral, which signifies the constant "null"
559             List<MethodInfo> candidates = new List<MethodInfo>();
560             bool lhsNullable = ConditionHelper.IsNullableValueType(lhs);
561             bool rhsNullable = ConditionHelper.IsNullableValueType(rhs);
562             Type lhsType0 = (lhsNullable) ? Nullable.GetUnderlyingType(lhs) : lhs;
563             Type rhsType0 = (rhsNullable) ? Nullable.GetUnderlyingType(rhs) : rhs;
564 
565             // special cases for enums
566             if (lhsType0.IsEnum)
567             {
568                 // only 3 cases (U = underlying type of E):
569                 //    E = E + U
570                 //    U = E - E
571                 //    E = E - U
572                 // plus the standard comparisons (E == E, E > E, etc.)
573                 // need to also allow E == 0
574                 Type underlyingType;
575                 switch (op)
576                 {
577                     case CodeBinaryOperatorType.Add:
578                         underlyingType = EnumHelper.GetUnderlyingType(lhsType0);
579                         if ((underlyingType != null) &&
580                             (RuleValidation.TypesAreAssignable(rhsType0, underlyingType, rhsExpression, out error)))
581                         {
582                             error = null;
583                             return new EnumOperationMethodInfo(lhs, op, rhs, false);
584                         }
585                         break;
586                     case CodeBinaryOperatorType.Subtract:
587                         underlyingType = EnumHelper.GetUnderlyingType(lhsType0);
588                         if (underlyingType != null)
589                         {
590                             if (lhsType0 == rhsType0)
591                             {
592                                 // E - E
593                                 error = null;
594                                 return new EnumOperationMethodInfo(lhs, op, rhs, false);
595                             }
596                             else if (DecimalIntegerLiteralZero(rhs, rhsExpression as CodePrimitiveExpression))
597                             {
598                                 // E - 0, can convert 0 to E
599                                 error = null;
600                                 return new EnumOperationMethodInfo(lhs, op, rhs, true);
601                             }
602                             else if (RuleValidation.TypesAreAssignable(rhsType0, underlyingType, rhsExpression, out error))
603                             {
604                                 // expression not passed to TypesAreAssignable, so not looking for constants (since 0 is all we care about)
605                                 error = null;
606                                 return new EnumOperationMethodInfo(lhs, op, rhs, false);
607                             }
608                         }
609                         break;
610                     case CodeBinaryOperatorType.ValueEquality:
611                     case CodeBinaryOperatorType.LessThan:
612                     case CodeBinaryOperatorType.LessThanOrEqual:
613                     case CodeBinaryOperatorType.GreaterThan:
614                     case CodeBinaryOperatorType.GreaterThanOrEqual:
615                         if (lhsType0 == rhsType0)
616                         {
617                             error = null;
618                             return new EnumOperationMethodInfo(lhs, op, rhs, false);
619                         }
620                         else if (lhsNullable && (rhs == typeof(NullLiteral)))
621                         {
622                             // handle enum? op null
623                             // treat the rhs as the same nullable enum
624                             error = null;
625                             return new EnumOperationMethodInfo(lhs, op, lhs, false);
626                         }
627                         else if (DecimalIntegerLiteralZero(rhs, rhsExpression as CodePrimitiveExpression))
628                         {
629                             error = null;
630                             return new EnumOperationMethodInfo(lhs, op, rhs, true);
631                         }
632                         break;
633                 }
634                 // can't do it, sorry
635                 // but check if there is a user-defined operator that works
636             }
637             else if (rhsType0.IsEnum)
638             {
639                 // lhs != enum, so only 2 cases (U = underlying type of E):
640                 //    E = U + E
641                 //    E = U - E
642                 // comparisons are E == E, etc., so if the lhs is not an enum, too bad
643                 // although we need to check for 0 == E
644                 Type underlyingType;
645                 switch (op)
646                 {
647                     case CodeBinaryOperatorType.Add:
648                         underlyingType = EnumHelper.GetUnderlyingType(rhsType0);
649                         if ((underlyingType != null) &&
650                             (RuleValidation.TypesAreAssignable(lhsType0, underlyingType, lhsExpression, out error)))
651                         {
652                             error = null;
653                             return new EnumOperationMethodInfo(lhs, op, rhs, false);
654                         }
655                         break;
656 
657                     case CodeBinaryOperatorType.Subtract:
658                         underlyingType = EnumHelper.GetUnderlyingType(rhsType0);
659                         if (underlyingType != null)
660                         {
661                             CodePrimitiveExpression primitive = lhsExpression as CodePrimitiveExpression;
662                             if (DecimalIntegerLiteralZero(lhs, primitive))
663                             {
664                                 // 0 - E, can convert 0 to E
665                                 error = null;
666                                 return new EnumOperationMethodInfo(lhs, op, rhs, true);
667                             }
668                             else if (RuleValidation.TypesAreAssignable(lhsType0, underlyingType, lhsExpression, out error))
669                             {
670                                 // expression not passed to TypesAreAssignable, so not looking for constants (since 0 is all we care about)
671                                 error = null;
672                                 return new EnumOperationMethodInfo(lhs, op, rhs, false);
673                             }
674                         }
675                         break;
676 
677                     case CodeBinaryOperatorType.ValueEquality:
678                     case CodeBinaryOperatorType.LessThan:
679                     case CodeBinaryOperatorType.LessThanOrEqual:
680                     case CodeBinaryOperatorType.GreaterThan:
681                     case CodeBinaryOperatorType.GreaterThanOrEqual:
682                         if (rhsNullable && (lhs == typeof(NullLiteral)))
683                         {
684                             // handle null op enum?
685                             // treat the lhs as the same nullable enum type
686                             error = null;
687                             return new EnumOperationMethodInfo(rhs, op, rhs, false);
688                         }
689                         else if (DecimalIntegerLiteralZero(lhs, lhsExpression as CodePrimitiveExpression))
690                         {
691                             error = null;
692                             return new EnumOperationMethodInfo(lhs, op, rhs, true);
693                         }
694                         break;
695                 }
696 
697                 // can't do it, sorry
698                 // but check if there is a user-defined operator that works
699             }
700 
701             // enum specific operations already handled, see if one side (or both) define operators
702             AddOperatorOverloads(lhsType0, methodName, lhs, rhs, candidates);
703             AddOperatorOverloads(rhsType0, methodName, lhs, rhs, candidates);
704             if (lhsNullable || rhsNullable || (lhs == typeof(NullLiteral)) || (rhs == typeof(NullLiteral)))
705             {
706                 // need to add in lifted methods
707                 AddLiftedOperators(lhsType0, methodName, group, lhsType0, rhsType0, candidates);
708                 AddLiftedOperators(rhsType0, methodName, group, lhsType0, rhsType0, candidates);
709             }
710 
711             if (candidates.Count == 0)
712             {
713                 // no overrides, so get the default list
714                 methodName = methodName.Substring(3);       // strip off the op_
715                 foreach (MethodInfo mi in typeof(DefaultOperators).GetMethods())
716                 {
717                     if (mi.Name == methodName)
718                     {
719                         ParameterInfo[] parameters = mi.GetParameters();
720                         Type parm1 = parameters[0].ParameterType;
721                         Type parm2 = parameters[1].ParameterType;
722                         if (RuleValidation.ImplicitConversion(lhs, parm1) &&
723                             RuleValidation.ImplicitConversion(rhs, parm2))
724                         {
725                             candidates.Add(mi);
726                         }
727                     }
728                 }
729 
730                 // if no candidates and ==, can we use object == object?
731                 if ((candidates.Count == 0) && ("Equality" == methodName))
732                 {
733                     // C# 7.9.6
734                     // references must be compatible
735                     // no boxing
736                     // value types can't be compared
737                     if ((!lhs.IsValueType) && (!rhs.IsValueType))
738                     {
739                         // they are not classes, so references need to be compatible
740                         // also check for null (which is NullLiteral type) -- null is compatible with any object type
741                         if ((lhs == typeof(NullLiteral)) || (rhs == typeof(NullLiteral)) ||
742                             (lhs.IsAssignableFrom(rhs)) || (rhs.IsAssignableFrom(lhs)))
743                         {
744                             candidates.Add(ObjectEquality);
745                         }
746                     }
747                 }
748 
749                 // if no candidates and nullable, add lifted operators
750                 if ((candidates.Count == 0) && ((lhsNullable || rhsNullable || (lhs == typeof(NullLiteral)) || (rhs == typeof(NullLiteral)))))
751                 {
752                     foreach (MethodInfo mi in typeof(DefaultOperators).GetMethods())
753                     {
754                         if (mi.Name == methodName)
755                         {
756                             ParameterInfo[] parameters = mi.GetParameters();
757                             MethodInfo liftedMethod = EvaluateLiftedMethod(mi, parameters, group, lhsType0, rhsType0);
758                             if (liftedMethod != null)
759                                 candidates.Add(liftedMethod);
760                         }
761                     }
762                 }
763             }
764             if (candidates.Count == 1)
765             {
766                 // only 1, so it is it
767                 error = null;
768                 return candidates[0];
769             }
770             else if (candidates.Count == 0)
771             {
772                 // nothing matched
773                 message = string.Format(CultureInfo.CurrentCulture,
774                     (group == OperatorGrouping.Arithmetic) ? Messages.ArithOpBadTypes : Messages.RelationalOpBadTypes,
775                     op.ToString(),
776                     (lhs == typeof(NullLiteral)) ? Messages.NullValue : RuleDecompiler.DecompileType(lhs),
777                     (rhs == typeof(NullLiteral)) ? Messages.NullValue : RuleDecompiler.DecompileType(rhs));
778                 error = new ValidationError(message, ErrorNumbers.Error_OperandTypesIncompatible);
779                 return null;
780             }
781             else
782             {
783                 // more than 1, so pick the best one
784                 MethodInfo bestFit = validator.FindBestCandidate(null, candidates, lhs, rhs);
785                 if (bestFit != null)
786                 {
787                     error = null;
788                     return bestFit;
789                 }
790                 // must be ambiguous. Since there are at least 2 choices, show only the first 2
791                 message = string.Format(CultureInfo.CurrentCulture,
792                     Messages.AmbiguousOperator,
793                     op.ToString(),
794                     RuleDecompiler.DecompileMethod(candidates[0]),
795                     RuleDecompiler.DecompileMethod(candidates[1]));
796                 error = new ValidationError(message, ErrorNumbers.Error_OperandTypesIncompatible);
797                 return null;
798             }
799         }
800 
DecimalIntegerLiteralZero(Type type, CodePrimitiveExpression expression)801         private static bool DecimalIntegerLiteralZero(Type type, CodePrimitiveExpression expression)
802         {
803             if (expression != null)
804             {
805                 if (type == typeof(int))
806                     return expression.Value.Equals(0);
807                 else if (type == typeof(uint))
808                     return expression.Value.Equals(0U);
809                 else if (type == typeof(long))
810                     return expression.Value.Equals(0L);
811                 else if (type == typeof(ulong))
812                     return expression.Value.Equals(0UL);
813             }
814             return false;
815         }
816 
AddOperatorOverloads(Type type, string methodName, Type arg1, Type arg2, List<MethodInfo> candidates)817         private static void AddOperatorOverloads(Type type, string methodName, Type arg1, Type arg2, List<MethodInfo> candidates)
818         {
819             // append the list of methods that match the name specified
820             int numAdded = 0;
821             MethodInfo[] possible = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
822             foreach (MethodInfo mi in possible)
823             {
824                 ParameterInfo[] parameters = mi.GetParameters();
825                 if ((mi.Name == methodName) && (parameters.Length == 2))
826                 {
827                     if (EvaluateMethod(parameters, arg1, arg2))
828                     {
829                         ++numAdded;
830                         if (!candidates.Contains(mi))
831                             candidates.Add(mi);
832                     }
833                 }
834             }
835             if ((numAdded > 0) || (type == typeof(object)))
836                 return;
837 
838             // no matches, check direct base class (if there is one)
839             type = type.BaseType;
840             if (type != null)
841             {
842                 possible = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
843                 foreach (MethodInfo mi in possible)
844                 {
845                     ParameterInfo[] parameters = mi.GetParameters();
846                     if ((mi.Name == methodName) && (parameters.Length == 2))
847                     {
848                         if (EvaluateMethod(parameters, arg1, arg2))
849                         {
850                             if (!candidates.Contains(mi))
851                                 candidates.Add(mi);
852                         }
853                     }
854                 }
855             }
856         }
857 
AddLiftedOperators(Type type, string methodName, OperatorGrouping group, Type arg1, Type arg2, List<MethodInfo> candidates)858         private static void AddLiftedOperators(Type type, string methodName, OperatorGrouping group, Type arg1, Type arg2, List<MethodInfo> candidates)
859         {
860             // append the list of lifted methods that match the name specified
861             int numAdded = 0;
862             MethodInfo[] possible = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
863             foreach (MethodInfo mi in possible)
864             {
865                 ParameterInfo[] parameters = mi.GetParameters();
866                 if ((mi.Name == methodName) && (parameters.Length == 2))
867                 {
868                     MethodInfo liftedMethod = EvaluateLiftedMethod(mi, parameters, group, arg1, arg2);
869                     if (liftedMethod != null)
870                     {
871                         ++numAdded;
872                         if (!candidates.Contains(liftedMethod))
873                             candidates.Add(liftedMethod);
874                     }
875                 }
876             }
877             if ((numAdded > 0) || (type == typeof(object)))
878                 return;
879 
880             // no matches, check direct base class (if there is one)
881             type = type.BaseType;
882             if (type != null)
883             {
884                 possible = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
885                 foreach (MethodInfo mi in possible)
886                 {
887                     ParameterInfo[] parameters = mi.GetParameters();
888                     if ((mi.Name == methodName) && (parameters.Length == 2))
889                     {
890                         MethodInfo liftedMethod = EvaluateLiftedMethod(mi, parameters, group, arg1, arg2);
891                         if ((liftedMethod != null) && !candidates.Contains(liftedMethod))
892                             candidates.Add(liftedMethod);
893                     }
894                 }
895             }
896         }
897 
EvaluateMethod(ParameterInfo[] parameters, Type arg1, Type arg2)898         private static bool EvaluateMethod(ParameterInfo[] parameters, Type arg1, Type arg2)
899         {
900             Type parm1 = parameters[0].ParameterType;
901             Type parm2 = parameters[1].ParameterType;
902             return (RuleValidation.ImplicitConversion(arg1, parm1) &&
903                     RuleValidation.ImplicitConversion(arg2, parm2));
904         }
905 
EvaluateLiftedMethod(MethodInfo mi, ParameterInfo[] parameters, OperatorGrouping group, Type arg1, Type arg2)906         private static MethodInfo EvaluateLiftedMethod(MethodInfo mi, ParameterInfo[] parameters, OperatorGrouping group, Type arg1, Type arg2)
907         {
908             Type parm1 = parameters[0].ParameterType;
909             Type parm2 = parameters[1].ParameterType;
910             if (ConditionHelper.IsNonNullableValueType(parm1) && ConditionHelper.IsNonNullableValueType(parm2))
911             {
912                 // lift the parameters for testing conversions, if possible
913                 parm1 = typeof(Nullable<>).MakeGenericType(parm1);
914                 parm2 = typeof(Nullable<>).MakeGenericType(parm2);
915                 switch (group)
916                 {
917                     case OperatorGrouping.Equality:     // for == !=
918                         if (mi.ReturnType == typeof(bool) &&
919                             RuleValidation.ImplicitConversion(arg1, parm1) &&
920                             RuleValidation.ImplicitConversion(arg2, parm2))
921                         {
922                             return new LiftedEqualityOperatorMethodInfo(mi);
923                         }
924                         break;
925                     case OperatorGrouping.Relational:       // for < > <= >=
926                         if (mi.ReturnType == typeof(bool) &&
927                             RuleValidation.ImplicitConversion(arg1, parm1) &&
928                             RuleValidation.ImplicitConversion(arg2, parm2))
929                         {
930                             return new LiftedRelationalOperatorMethodInfo(mi);
931                         }
932                         break;
933                     case OperatorGrouping.Arithmetic:       // for + - * / % & ^
934                         if (ConditionHelper.IsNonNullableValueType(mi.ReturnType) &&
935                             RuleValidation.ImplicitConversion(arg1, parm1) &&
936                             RuleValidation.ImplicitConversion(arg2, parm2))
937                         {
938                             return new LiftedArithmeticOperatorMethodInfo(mi);
939                         }
940                         break;
941                 }
942             }
943             return null;
944         }
945         #endregion
946 
947         #region Value Type Dispatch Methods
948 
949         /// <summary>
950         /// Relational equal operator
951         /// Value-equality if we can do it, otherwise reference-equality
952         /// </summary>
953         /// <param name="rhs"></param>
954         /// <returns></returns>
Equal(Literal rhs)955         internal abstract bool Equal(Literal rhs);
Equal(byte literalValue)956         internal virtual bool Equal(byte literalValue)
957         {
958             return false;
959         }
Equal(sbyte literalValue)960         internal virtual bool Equal(sbyte literalValue)
961         {
962             return false;
963         }
Equal(short literalValue)964         internal virtual bool Equal(short literalValue)
965         {
966             return false;
967         }
Equal(int literalValue)968         internal virtual bool Equal(int literalValue)
969         {
970             return false;
971         }
Equal(long literalValue)972         internal virtual bool Equal(long literalValue)
973         {
974             return false;
975         }
Equal(ushort literalValue)976         internal virtual bool Equal(ushort literalValue)
977         {
978             return false;
979         }
Equal(uint literalValue)980         internal virtual bool Equal(uint literalValue)
981         {
982             return false;
983         }
Equal(ulong literalValue)984         internal virtual bool Equal(ulong literalValue)
985         {
986             return false;
987         }
Equal(float literalValue)988         internal virtual bool Equal(float literalValue)
989         {
990             return false;
991         }
Equal(double literalValue)992         internal virtual bool Equal(double literalValue)
993         {
994             return false;
995         }
Equal(char literalValue)996         internal virtual bool Equal(char literalValue)
997         {
998             return false;
999         }
Equal(string literalValue)1000         internal virtual bool Equal(string literalValue)
1001         {
1002             return false;
1003         }
Equal(decimal literalValue)1004         internal virtual bool Equal(decimal literalValue)
1005         {
1006             return false;
1007         }
Equal(bool literalValue)1008         internal virtual bool Equal(bool literalValue)
1009         {
1010             return false;
1011         }
1012 
1013         /// <summary>
1014         /// Relational less than operator
1015         /// </summary>
1016         /// <param name="rhs"></param>
1017         /// <returns></returns>
LessThan(Literal rhs)1018         internal abstract bool LessThan(Literal rhs);
LessThan()1019         internal virtual bool LessThan()
1020         {
1021             return false;
1022         }
LessThan(byte literalValue)1023         internal virtual bool LessThan(byte literalValue)
1024         {
1025             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1026             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1027         }
LessThan(char literalValue)1028         internal virtual bool LessThan(char literalValue)
1029         {
1030             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1031             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1032         }
LessThan(sbyte literalValue)1033         internal virtual bool LessThan(sbyte literalValue)
1034         {
1035             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1036             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1037         }
LessThan(short literalValue)1038         internal virtual bool LessThan(short literalValue)
1039         {
1040             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1041             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1042         }
LessThan(int literalValue)1043         internal virtual bool LessThan(int literalValue)
1044         {
1045             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1046             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1047         }
LessThan(long literalValue)1048         internal virtual bool LessThan(long literalValue)
1049         {
1050             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1051             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1052         }
LessThan(ushort literalValue)1053         internal virtual bool LessThan(ushort literalValue)
1054         {
1055             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1056             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1057         }
LessThan(uint literalValue)1058         internal virtual bool LessThan(uint literalValue)
1059         {
1060             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1061             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1062         }
LessThan(ulong literalValue)1063         internal virtual bool LessThan(ulong literalValue)
1064         {
1065             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1066             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1067         }
LessThan(float literalValue)1068         internal virtual bool LessThan(float literalValue)
1069         {
1070             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1071             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1072         }
LessThan(double literalValue)1073         internal virtual bool LessThan(double literalValue)
1074         {
1075             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1076             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1077         }
LessThan(string literalValue)1078         internal virtual bool LessThan(string literalValue)
1079         {
1080             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1081             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1082         }
LessThan(decimal literalValue)1083         internal virtual bool LessThan(decimal literalValue)
1084         {
1085             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1086             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1087         }
LessThan(bool literalValue)1088         internal virtual bool LessThan(bool literalValue)
1089         {
1090             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1091             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThan, m_type);
1092         }
1093 
1094         /// <summary>
1095         /// Relational greater than operator
1096         /// </summary>
1097         /// <param name="rhs"></param>
1098         /// <returns></returns>
GreaterThan(Literal rhs)1099         internal abstract bool GreaterThan(Literal rhs);
GreaterThan()1100         internal virtual bool GreaterThan()
1101         {
1102             return false;
1103         }
GreaterThan(byte literalValue)1104         internal virtual bool GreaterThan(byte literalValue)
1105         {
1106             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1107             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1108         }
GreaterThan(char literalValue)1109         internal virtual bool GreaterThan(char literalValue)
1110         {
1111             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1112             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1113         }
GreaterThan(sbyte literalValue)1114         internal virtual bool GreaterThan(sbyte literalValue)
1115         {
1116             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1117             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1118         }
GreaterThan(short literalValue)1119         internal virtual bool GreaterThan(short literalValue)
1120         {
1121             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1122             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1123         }
GreaterThan(int literalValue)1124         internal virtual bool GreaterThan(int literalValue)
1125         {
1126             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1127             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1128         }
GreaterThan(long literalValue)1129         internal virtual bool GreaterThan(long literalValue)
1130         {
1131             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1132             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1133         }
GreaterThan(ushort literalValue)1134         internal virtual bool GreaterThan(ushort literalValue)
1135         {
1136             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1137             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1138         }
GreaterThan(uint literalValue)1139         internal virtual bool GreaterThan(uint literalValue)
1140         {
1141             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1142             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1143         }
GreaterThan(ulong literalValue)1144         internal virtual bool GreaterThan(ulong literalValue)
1145         {
1146             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1147             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1148         }
GreaterThan(float literalValue)1149         internal virtual bool GreaterThan(float literalValue)
1150         {
1151             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1152             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1153         }
GreaterThan(double literalValue)1154         internal virtual bool GreaterThan(double literalValue)
1155         {
1156             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1157             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1158         }
GreaterThan(string literalValue)1159         internal virtual bool GreaterThan(string literalValue)
1160         {
1161             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1162             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1163         }
GreaterThan(decimal literalValue)1164         internal virtual bool GreaterThan(decimal literalValue)
1165         {
1166             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1167             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1168         }
GreaterThan(bool literalValue)1169         internal virtual bool GreaterThan(bool literalValue)
1170         {
1171             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1172             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThan, m_type);
1173         }
1174 
1175         /// <summary>
1176         /// Relational less than or equal to operator
1177         /// </summary>
1178         /// <param name="rhs"></param>
1179         /// <returns></returns>
LessThanOrEqual(Literal rhs)1180         internal abstract bool LessThanOrEqual(Literal rhs);
LessThanOrEqual()1181         internal virtual bool LessThanOrEqual()
1182         {
1183             return false;
1184         }
LessThanOrEqual(byte literalValue)1185         internal virtual bool LessThanOrEqual(byte literalValue)
1186         {
1187             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1188             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1189         }
LessThanOrEqual(char literalValue)1190         internal virtual bool LessThanOrEqual(char literalValue)
1191         {
1192             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1193             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1194         }
LessThanOrEqual(sbyte literalValue)1195         internal virtual bool LessThanOrEqual(sbyte literalValue)
1196         {
1197             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1198             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1199         }
LessThanOrEqual(short literalValue)1200         internal virtual bool LessThanOrEqual(short literalValue)
1201         {
1202             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1203             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1204         }
LessThanOrEqual(int literalValue)1205         internal virtual bool LessThanOrEqual(int literalValue)
1206         {
1207             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1208             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1209         }
LessThanOrEqual(long literalValue)1210         internal virtual bool LessThanOrEqual(long literalValue)
1211         {
1212             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1213             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1214         }
LessThanOrEqual(ushort literalValue)1215         internal virtual bool LessThanOrEqual(ushort literalValue)
1216         {
1217             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1218             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1219         }
LessThanOrEqual(uint literalValue)1220         internal virtual bool LessThanOrEqual(uint literalValue)
1221         {
1222             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1223             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1224         }
LessThanOrEqual(ulong literalValue)1225         internal virtual bool LessThanOrEqual(ulong literalValue)
1226         {
1227             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1228             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1229         }
LessThanOrEqual(float literalValue)1230         internal virtual bool LessThanOrEqual(float literalValue)
1231         {
1232             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1233             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1234         }
LessThanOrEqual(double literalValue)1235         internal virtual bool LessThanOrEqual(double literalValue)
1236         {
1237             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1238             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1239         }
LessThanOrEqual(string literalValue)1240         internal virtual bool LessThanOrEqual(string literalValue)
1241         {
1242             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1243             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1244         }
LessThanOrEqual(decimal literalValue)1245         internal virtual bool LessThanOrEqual(decimal literalValue)
1246         {
1247             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1248             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1249         }
LessThanOrEqual(bool literalValue)1250         internal virtual bool LessThanOrEqual(bool literalValue)
1251         {
1252             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1253             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.LessThanOrEqual, m_type);
1254         }
1255 
1256         /// <summary>
1257         /// Relational greater than or equal to operator
1258         /// </summary>
1259         /// <param name="rhs"></param>
1260         /// <returns></returns>
GreaterThanOrEqual(Literal rhs)1261         internal abstract bool GreaterThanOrEqual(Literal rhs);
GreaterThanOrEqual()1262         internal virtual bool GreaterThanOrEqual()
1263         {
1264             return false;
1265         }
GreaterThanOrEqual(byte literalValue)1266         internal virtual bool GreaterThanOrEqual(byte literalValue)
1267         {
1268             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1269             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1270         }
GreaterThanOrEqual(char literalValue)1271         internal virtual bool GreaterThanOrEqual(char literalValue)
1272         {
1273             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1274             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1275         }
GreaterThanOrEqual(sbyte literalValue)1276         internal virtual bool GreaterThanOrEqual(sbyte literalValue)
1277         {
1278             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1279             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1280         }
GreaterThanOrEqual(short literalValue)1281         internal virtual bool GreaterThanOrEqual(short literalValue)
1282         {
1283             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1284             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1285         }
GreaterThanOrEqual(int literalValue)1286         internal virtual bool GreaterThanOrEqual(int literalValue)
1287         {
1288             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1289             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1290         }
GreaterThanOrEqual(long literalValue)1291         internal virtual bool GreaterThanOrEqual(long literalValue)
1292         {
1293             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1294             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1295         }
GreaterThanOrEqual(ushort literalValue)1296         internal virtual bool GreaterThanOrEqual(ushort literalValue)
1297         {
1298             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1299             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1300         }
GreaterThanOrEqual(uint literalValue)1301         internal virtual bool GreaterThanOrEqual(uint literalValue)
1302         {
1303             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1304             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1305         }
GreaterThanOrEqual(ulong literalValue)1306         internal virtual bool GreaterThanOrEqual(ulong literalValue)
1307         {
1308             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1309             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1310         }
GreaterThanOrEqual(float literalValue)1311         internal virtual bool GreaterThanOrEqual(float literalValue)
1312         {
1313             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1314             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1315         }
GreaterThanOrEqual(double literalValue)1316         internal virtual bool GreaterThanOrEqual(double literalValue)
1317         {
1318             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1319             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1320         }
GreaterThanOrEqual(string literalValue)1321         internal virtual bool GreaterThanOrEqual(string literalValue)
1322         {
1323             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1324             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1325         }
GreaterThanOrEqual(decimal literalValue)1326         internal virtual bool GreaterThanOrEqual(decimal literalValue)
1327         {
1328             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1329             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1330         }
GreaterThanOrEqual(bool literalValue)1331         internal virtual bool GreaterThanOrEqual(bool literalValue)
1332         {
1333             string message = string.Format(CultureInfo.CurrentCulture, Messages.IncompatibleComparisonTypes, literalValue.GetType(), m_type);
1334             throw new RuleEvaluationIncompatibleTypesException(message, literalValue.GetType(), CodeBinaryOperatorType.GreaterThanOrEqual, m_type);
1335         }
1336         #endregion
1337     }
1338     #endregion
1339 
1340     #region Null Literal Class
1341     /// <summary>
1342     /// Represents an null literal
1343     /// </summary>
1344     internal class NullLiteral : Literal
1345     {
1346         // NOTE (from MSDN page on IComparable.CompareTo Method):
1347         // By definition, any object compares greater than a null reference
1348         // But C# (24.3.1) doesn't -- if either side is null, result is false
1349 
NullLiteral(Type type)1350         internal NullLiteral(Type type)
1351         {
1352             m_type = type;
1353         }
1354 
1355         internal override object Value
1356         {
1357             get { return null; }
1358         }
1359 
Equal(Literal rhs)1360         internal override bool Equal(Literal rhs)
1361         {
1362             return rhs.Value == null;
1363         }
1364 
LessThan(Literal rhs)1365         internal override bool LessThan(Literal rhs)
1366         {
1367             return rhs.GreaterThan();
1368         }
LessThan(byte literalValue)1369         internal override bool LessThan(byte literalValue)
1370         {
1371             return false;
1372         }
LessThan(char literalValue)1373         internal override bool LessThan(char literalValue)
1374         {
1375             return false;
1376         }
LessThan(sbyte literalValue)1377         internal override bool LessThan(sbyte literalValue)
1378         {
1379             return false;
1380         }
LessThan(short literalValue)1381         internal override bool LessThan(short literalValue)
1382         {
1383             return false;
1384         }
LessThan(int literalValue)1385         internal override bool LessThan(int literalValue)
1386         {
1387             return false;
1388         }
LessThan(long literalValue)1389         internal override bool LessThan(long literalValue)
1390         {
1391             return false;
1392         }
LessThan(ushort literalValue)1393         internal override bool LessThan(ushort literalValue)
1394         {
1395             return false;
1396         }
LessThan(uint literalValue)1397         internal override bool LessThan(uint literalValue)
1398         {
1399             return false;
1400         }
LessThan(ulong literalValue)1401         internal override bool LessThan(ulong literalValue)
1402         {
1403             return false;
1404         }
LessThan(float literalValue)1405         internal override bool LessThan(float literalValue)
1406         {
1407             return false;
1408         }
LessThan(double literalValue)1409         internal override bool LessThan(double literalValue)
1410         {
1411             return false;
1412         }
LessThan(string literalValue)1413         internal override bool LessThan(string literalValue)
1414         {
1415             // for strings, maintain compatibility with v1
1416             return true;
1417         }
LessThan(decimal literalValue)1418         internal override bool LessThan(decimal literalValue)
1419         {
1420             return false;
1421         }
1422 
GreaterThan(Literal rhs)1423         internal override bool GreaterThan(Literal rhs)
1424         {
1425             return rhs.LessThan();
1426         }
GreaterThan(byte literalValue)1427         internal override bool GreaterThan(byte literalValue)
1428         {
1429             return false;
1430         }
GreaterThan(char literalValue)1431         internal override bool GreaterThan(char literalValue)
1432         {
1433             return false;
1434         }
GreaterThan(sbyte literalValue)1435         internal override bool GreaterThan(sbyte literalValue)
1436         {
1437             return false;
1438         }
GreaterThan(short literalValue)1439         internal override bool GreaterThan(short literalValue)
1440         {
1441             return false;
1442         }
GreaterThan(int literalValue)1443         internal override bool GreaterThan(int literalValue)
1444         {
1445             return false;
1446         }
GreaterThan(long literalValue)1447         internal override bool GreaterThan(long literalValue)
1448         {
1449             return false;
1450         }
GreaterThan(ushort literalValue)1451         internal override bool GreaterThan(ushort literalValue)
1452         {
1453             return false;
1454         }
GreaterThan(uint literalValue)1455         internal override bool GreaterThan(uint literalValue)
1456         {
1457             return false;
1458         }
GreaterThan(ulong literalValue)1459         internal override bool GreaterThan(ulong literalValue)
1460         {
1461             return false;
1462         }
GreaterThan(float literalValue)1463         internal override bool GreaterThan(float literalValue)
1464         {
1465             return false;
1466         }
GreaterThan(double literalValue)1467         internal override bool GreaterThan(double literalValue)
1468         {
1469             return false;
1470         }
GreaterThan(string literalValue)1471         internal override bool GreaterThan(string literalValue)
1472         {
1473             return false;
1474         }
GreaterThan(decimal literalValue)1475         internal override bool GreaterThan(decimal literalValue)
1476         {
1477             return false;
1478         }
1479 
1480         /// <summary>
1481         /// Relational less than or equal to operator
1482         /// </summary>
1483         /// <param name="rhs"></param>
1484         /// <returns></returns>
LessThanOrEqual(Literal rhs)1485         internal override bool LessThanOrEqual(Literal rhs)
1486         {
1487             return rhs.GreaterThanOrEqual();
1488         }
LessThanOrEqual()1489         internal override bool LessThanOrEqual()
1490         {
1491             return (m_type == typeof(string));      // null == null for strings only
1492         }
LessThanOrEqual(byte literalValue)1493         internal override bool LessThanOrEqual(byte literalValue)
1494         {
1495             return false;
1496         }
LessThanOrEqual(char literalValue)1497         internal override bool LessThanOrEqual(char literalValue)
1498         {
1499             return false;
1500         }
LessThanOrEqual(sbyte literalValue)1501         internal override bool LessThanOrEqual(sbyte literalValue)
1502         {
1503             return false;
1504         }
LessThanOrEqual(short literalValue)1505         internal override bool LessThanOrEqual(short literalValue)
1506         {
1507             return false;
1508         }
LessThanOrEqual(int literalValue)1509         internal override bool LessThanOrEqual(int literalValue)
1510         {
1511             return false;
1512         }
LessThanOrEqual(long literalValue)1513         internal override bool LessThanOrEqual(long literalValue)
1514         {
1515             return false;
1516         }
LessThanOrEqual(ushort literalValue)1517         internal override bool LessThanOrEqual(ushort literalValue)
1518         {
1519             return false;
1520         }
LessThanOrEqual(uint literalValue)1521         internal override bool LessThanOrEqual(uint literalValue)
1522         {
1523             return false;
1524         }
LessThanOrEqual(ulong literalValue)1525         internal override bool LessThanOrEqual(ulong literalValue)
1526         {
1527             return false;
1528         }
LessThanOrEqual(float literalValue)1529         internal override bool LessThanOrEqual(float literalValue)
1530         {
1531             return false;
1532         }
LessThanOrEqual(double literalValue)1533         internal override bool LessThanOrEqual(double literalValue)
1534         {
1535             return false;
1536         }
LessThanOrEqual(string literalValue)1537         internal override bool LessThanOrEqual(string literalValue)
1538         {
1539             // for strings, maintain compatibility with v1
1540             return true;
1541         }
LessThanOrEqual(decimal literalValue)1542         internal override bool LessThanOrEqual(decimal literalValue)
1543         {
1544             return false;
1545         }
1546 
GreaterThanOrEqual(Literal rhs)1547         internal override bool GreaterThanOrEqual(Literal rhs)
1548         {
1549             return rhs.LessThanOrEqual();
1550         }
GreaterThanOrEqual()1551         internal override bool GreaterThanOrEqual()
1552         {
1553             return (m_type == typeof(string));      // null == null for strings only
1554         }
GreaterThanOrEqual(byte literalValue)1555         internal override bool GreaterThanOrEqual(byte literalValue)
1556         {
1557             return false;
1558         }
GreaterThanOrEqual(char literalValue)1559         internal override bool GreaterThanOrEqual(char literalValue)
1560         {
1561             return false;
1562         }
GreaterThanOrEqual(sbyte literalValue)1563         internal override bool GreaterThanOrEqual(sbyte literalValue)
1564         {
1565             return false;
1566         }
GreaterThanOrEqual(short literalValue)1567         internal override bool GreaterThanOrEqual(short literalValue)
1568         {
1569             return false;
1570         }
GreaterThanOrEqual(int literalValue)1571         internal override bool GreaterThanOrEqual(int literalValue)
1572         {
1573             return false;
1574         }
GreaterThanOrEqual(long literalValue)1575         internal override bool GreaterThanOrEqual(long literalValue)
1576         {
1577             return false;
1578         }
GreaterThanOrEqual(ushort literalValue)1579         internal override bool GreaterThanOrEqual(ushort literalValue)
1580         {
1581             return false;
1582         }
GreaterThanOrEqual(uint literalValue)1583         internal override bool GreaterThanOrEqual(uint literalValue)
1584         {
1585             return false;
1586         }
GreaterThanOrEqual(ulong literalValue)1587         internal override bool GreaterThanOrEqual(ulong literalValue)
1588         {
1589             return false;
1590         }
GreaterThanOrEqual(float literalValue)1591         internal override bool GreaterThanOrEqual(float literalValue)
1592         {
1593             return false;
1594         }
GreaterThanOrEqual(double literalValue)1595         internal override bool GreaterThanOrEqual(double literalValue)
1596         {
1597             return false;
1598         }
GreaterThanOrEqual(string literalValue)1599         internal override bool GreaterThanOrEqual(string literalValue)
1600         {
1601             return false;
1602         }
GreaterThanOrEqual(decimal literalValue)1603         internal override bool GreaterThanOrEqual(decimal literalValue)
1604         {
1605             return false;
1606         }
1607     }
1608     #endregion
1609 
1610     #region Boolean Literal Class
1611     /// <summary>
1612     /// Represents a boolean literal
1613     /// </summary>
1614     internal class BoolLiteral : Literal
1615     {
1616         private bool m_value;
1617 
1618         internal override object Value
1619         {
1620             get { return m_value; }
1621         }
1622 
BoolLiteral(bool literalValue)1623         internal BoolLiteral(bool literalValue)
1624         {
1625             m_value = literalValue;
1626             m_type = typeof(bool);
1627         }
1628 
Equal(Literal rhs)1629         internal override bool Equal(Literal rhs)
1630         {
1631             return rhs.Equal(m_value);
1632         }
Equal(bool rhs)1633         internal override bool Equal(bool rhs)
1634         {
1635             return m_value == rhs;
1636         }
1637 
LessThan(Literal rhs)1638         internal override bool LessThan(Literal rhs)
1639         {
1640             return rhs.GreaterThan(m_value);
1641         }
1642 
GreaterThan(Literal rhs)1643         internal override bool GreaterThan(Literal rhs)
1644         {
1645             return rhs.LessThan(m_value);
1646         }
1647 
LessThanOrEqual(Literal rhs)1648         internal override bool LessThanOrEqual(Literal rhs)
1649         {
1650             return rhs.GreaterThanOrEqual(m_value);
1651         }
1652 
GreaterThanOrEqual(Literal rhs)1653         internal override bool GreaterThanOrEqual(Literal rhs)
1654         {
1655             return rhs.LessThanOrEqual(m_value);
1656         }
1657     }
1658     #endregion
1659 
1660     #region Byte Literal Class
1661     /// <summary>
1662     /// Represents a byte literal
1663     /// </summary>
1664     internal class ByteLiteral : Literal
1665     {
1666         private byte m_value;
1667 
1668         internal override object Value
1669         {
1670             get { return m_value; }
1671         }
1672 
ByteLiteral(byte literalValue)1673         internal ByteLiteral(byte literalValue)
1674         {
1675             m_value = literalValue;
1676             m_type = typeof(byte);
1677         }
1678 
Equal(Literal rhs)1679         internal override bool Equal(Literal rhs)
1680         {
1681             return rhs.Equal(m_value);
1682         }
Equal(sbyte rhs)1683         internal override bool Equal(sbyte rhs)
1684         {
1685             return m_value == rhs;
1686         }
Equal(byte rhs)1687         internal override bool Equal(byte rhs)
1688         {
1689             return m_value == rhs;
1690         }
Equal(char rhs)1691         internal override bool Equal(char rhs)
1692         {
1693             return m_value == rhs;
1694         }
Equal(short rhs)1695         internal override bool Equal(short rhs)
1696         {
1697             return m_value == rhs;
1698         }
Equal(ushort rhs)1699         internal override bool Equal(ushort rhs)
1700         {
1701             return m_value == rhs;
1702         }
Equal(int rhs)1703         internal override bool Equal(int rhs)
1704         {
1705             return m_value == rhs;
1706         }
Equal(uint rhs)1707         internal override bool Equal(uint rhs)
1708         {
1709             return m_value == rhs;
1710         }
Equal(long rhs)1711         internal override bool Equal(long rhs)
1712         {
1713             return m_value == rhs;
1714         }
Equal(ulong rhs)1715         internal override bool Equal(ulong rhs)
1716         {
1717             return m_value == rhs;
1718         }
Equal(float rhs)1719         internal override bool Equal(float rhs)
1720         {
1721             return m_value == rhs;
1722         }
Equal(double rhs)1723         internal override bool Equal(double rhs)
1724         {
1725             return m_value == rhs;
1726         }
Equal(decimal rhs)1727         internal override bool Equal(decimal rhs)
1728         {
1729             return m_value == rhs;
1730         }
1731 
LessThan(Literal rhs)1732         internal override bool LessThan(Literal rhs)
1733         {
1734             return rhs.GreaterThan(m_value);
1735         }
LessThan(sbyte rhs)1736         internal override bool LessThan(sbyte rhs)
1737         {
1738             return m_value < rhs;
1739         }
LessThan(byte rhs)1740         internal override bool LessThan(byte rhs)
1741         {
1742             return m_value < rhs;
1743         }
LessThan(char rhs)1744         internal override bool LessThan(char rhs)
1745         {
1746             return m_value < rhs;
1747         }
LessThan(short rhs)1748         internal override bool LessThan(short rhs)
1749         {
1750             return m_value < rhs;
1751         }
LessThan(ushort rhs)1752         internal override bool LessThan(ushort rhs)
1753         {
1754             return m_value < rhs;
1755         }
LessThan(int rhs)1756         internal override bool LessThan(int rhs)
1757         {
1758             return m_value < rhs;
1759         }
LessThan(uint rhs)1760         internal override bool LessThan(uint rhs)
1761         {
1762             return m_value < rhs;
1763         }
LessThan(long rhs)1764         internal override bool LessThan(long rhs)
1765         {
1766             return m_value < rhs;
1767         }
LessThan(ulong rhs)1768         internal override bool LessThan(ulong rhs)
1769         {
1770             return m_value < rhs;
1771         }
LessThan(float rhs)1772         internal override bool LessThan(float rhs)
1773         {
1774             return m_value < rhs;
1775         }
LessThan(double rhs)1776         internal override bool LessThan(double rhs)
1777         {
1778             return m_value < rhs;
1779         }
LessThan(decimal rhs)1780         internal override bool LessThan(decimal rhs)
1781         {
1782             return m_value < rhs;
1783         }
1784 
GreaterThan(Literal rhs)1785         internal override bool GreaterThan(Literal rhs)
1786         {
1787             return rhs.LessThan(m_value);
1788         }
GreaterThan(sbyte rhs)1789         internal override bool GreaterThan(sbyte rhs)
1790         {
1791             return m_value > rhs;
1792         }
GreaterThan(byte rhs)1793         internal override bool GreaterThan(byte rhs)
1794         {
1795             return m_value > rhs;
1796         }
GreaterThan(char rhs)1797         internal override bool GreaterThan(char rhs)
1798         {
1799             return m_value > rhs;
1800         }
GreaterThan(short rhs)1801         internal override bool GreaterThan(short rhs)
1802         {
1803             return m_value > rhs;
1804         }
GreaterThan(ushort rhs)1805         internal override bool GreaterThan(ushort rhs)
1806         {
1807             return m_value > rhs;
1808         }
GreaterThan(int rhs)1809         internal override bool GreaterThan(int rhs)
1810         {
1811             return m_value > rhs;
1812         }
GreaterThan(uint rhs)1813         internal override bool GreaterThan(uint rhs)
1814         {
1815             return m_value > rhs;
1816         }
GreaterThan(long rhs)1817         internal override bool GreaterThan(long rhs)
1818         {
1819             return m_value > rhs;
1820         }
GreaterThan(ulong rhs)1821         internal override bool GreaterThan(ulong rhs)
1822         {
1823             return m_value > rhs;
1824         }
GreaterThan(float rhs)1825         internal override bool GreaterThan(float rhs)
1826         {
1827             return m_value > rhs;
1828         }
GreaterThan(double rhs)1829         internal override bool GreaterThan(double rhs)
1830         {
1831             return m_value > rhs;
1832         }
GreaterThan(decimal rhs)1833         internal override bool GreaterThan(decimal rhs)
1834         {
1835             return m_value > rhs;
1836         }
1837 
LessThanOrEqual(Literal rhs)1838         internal override bool LessThanOrEqual(Literal rhs)
1839         {
1840             return rhs.GreaterThanOrEqual(m_value);
1841         }
LessThanOrEqual(sbyte rhs)1842         internal override bool LessThanOrEqual(sbyte rhs)
1843         {
1844             return m_value <= rhs;
1845         }
LessThanOrEqual(byte rhs)1846         internal override bool LessThanOrEqual(byte rhs)
1847         {
1848             return m_value <= rhs;
1849         }
LessThanOrEqual(short rhs)1850         internal override bool LessThanOrEqual(short rhs)
1851         {
1852             return m_value <= rhs;
1853         }
LessThanOrEqual(char rhs)1854         internal override bool LessThanOrEqual(char rhs)
1855         {
1856             return m_value <= rhs;
1857         }
LessThanOrEqual(ushort rhs)1858         internal override bool LessThanOrEqual(ushort rhs)
1859         {
1860             return m_value <= rhs;
1861         }
LessThanOrEqual(int rhs)1862         internal override bool LessThanOrEqual(int rhs)
1863         {
1864             return m_value <= rhs;
1865         }
LessThanOrEqual(uint rhs)1866         internal override bool LessThanOrEqual(uint rhs)
1867         {
1868             return m_value <= rhs;
1869         }
LessThanOrEqual(long rhs)1870         internal override bool LessThanOrEqual(long rhs)
1871         {
1872             return m_value <= rhs;
1873         }
LessThanOrEqual(ulong rhs)1874         internal override bool LessThanOrEqual(ulong rhs)
1875         {
1876             return m_value <= rhs;
1877         }
LessThanOrEqual(float rhs)1878         internal override bool LessThanOrEqual(float rhs)
1879         {
1880             return m_value <= rhs;
1881         }
LessThanOrEqual(double rhs)1882         internal override bool LessThanOrEqual(double rhs)
1883         {
1884             return m_value <= rhs;
1885         }
LessThanOrEqual(decimal rhs)1886         internal override bool LessThanOrEqual(decimal rhs)
1887         {
1888             return m_value <= rhs;
1889         }
1890 
GreaterThanOrEqual(Literal rhs)1891         internal override bool GreaterThanOrEqual(Literal rhs)
1892         {
1893             return rhs.LessThanOrEqual(m_value);
1894         }
GreaterThanOrEqual(sbyte rhs)1895         internal override bool GreaterThanOrEqual(sbyte rhs)
1896         {
1897             return m_value >= rhs;
1898         }
GreaterThanOrEqual(byte rhs)1899         internal override bool GreaterThanOrEqual(byte rhs)
1900         {
1901             return m_value >= rhs;
1902         }
GreaterThanOrEqual(char rhs)1903         internal override bool GreaterThanOrEqual(char rhs)
1904         {
1905             return m_value >= rhs;
1906         }
GreaterThanOrEqual(short rhs)1907         internal override bool GreaterThanOrEqual(short rhs)
1908         {
1909             return m_value >= rhs;
1910         }
GreaterThanOrEqual(ushort rhs)1911         internal override bool GreaterThanOrEqual(ushort rhs)
1912         {
1913             return m_value >= rhs;
1914         }
1915 
GreaterThanOrEqual(int rhs)1916         internal override bool GreaterThanOrEqual(int rhs)
1917         {
1918             return m_value >= rhs;
1919         }
GreaterThanOrEqual(uint rhs)1920         internal override bool GreaterThanOrEqual(uint rhs)
1921         {
1922             return m_value >= rhs;
1923         }
GreaterThanOrEqual(long rhs)1924         internal override bool GreaterThanOrEqual(long rhs)
1925         {
1926             return m_value >= rhs;
1927         }
GreaterThanOrEqual(ulong rhs)1928         internal override bool GreaterThanOrEqual(ulong rhs)
1929         {
1930             return m_value >= rhs;
1931         }
GreaterThanOrEqual(float rhs)1932         internal override bool GreaterThanOrEqual(float rhs)
1933         {
1934             return m_value >= rhs;
1935         }
GreaterThanOrEqual(double rhs)1936         internal override bool GreaterThanOrEqual(double rhs)
1937         {
1938             return m_value >= rhs;
1939         }
GreaterThanOrEqual(decimal rhs)1940         internal override bool GreaterThanOrEqual(decimal rhs)
1941         {
1942             return m_value >= rhs;
1943         }
1944     }
1945     #endregion
1946 
1947     #region SByte Literal Class
1948     /// <summary>
1949     /// Represents a byte literal
1950     /// </summary>
1951     internal class SByteLiteral : Literal
1952     {
1953         private sbyte m_value;
1954 
1955         internal override object Value
1956         {
1957             get { return m_value; }
1958         }
1959 
SByteLiteral(sbyte literalValue)1960         internal SByteLiteral(sbyte literalValue)
1961         {
1962             m_value = literalValue;
1963             m_type = typeof(sbyte);
1964         }
1965 
Equal(Literal rhs)1966         internal override bool Equal(Literal rhs)
1967         {
1968             return rhs.Equal(m_value);
1969         }
Equal(sbyte rhs)1970         internal override bool Equal(sbyte rhs)
1971         {
1972             return m_value == rhs;
1973         }
Equal(byte rhs)1974         internal override bool Equal(byte rhs)
1975         {
1976             return m_value == rhs;
1977         }
Equal(char rhs)1978         internal override bool Equal(char rhs)
1979         {
1980             return m_value == rhs;
1981         }
Equal(short rhs)1982         internal override bool Equal(short rhs)
1983         {
1984             return m_value == rhs;
1985         }
Equal(ushort rhs)1986         internal override bool Equal(ushort rhs)
1987         {
1988             return m_value == rhs;
1989         }
Equal(ulong rhs)1990         internal override bool Equal(ulong rhs)
1991         {
1992             return (m_value >= 0) && ((ulong)m_value == rhs);
1993         }
Equal(int rhs)1994         internal override bool Equal(int rhs)
1995         {
1996             return m_value == rhs;
1997         }
Equal(uint rhs)1998         internal override bool Equal(uint rhs)
1999         {
2000             return m_value == rhs;
2001         }
Equal(long rhs)2002         internal override bool Equal(long rhs)
2003         {
2004             return m_value == rhs;
2005         }
Equal(float rhs)2006         internal override bool Equal(float rhs)
2007         {
2008             return m_value == rhs;
2009         }
Equal(double rhs)2010         internal override bool Equal(double rhs)
2011         {
2012             return m_value == rhs;
2013         }
Equal(decimal rhs)2014         internal override bool Equal(decimal rhs)
2015         {
2016             return m_value == rhs;
2017         }
2018 
LessThan(Literal rhs)2019         internal override bool LessThan(Literal rhs)
2020         {
2021             return rhs.GreaterThan(m_value);
2022         }
LessThan(sbyte rhs)2023         internal override bool LessThan(sbyte rhs)
2024         {
2025             return m_value < rhs;
2026         }
LessThan(byte rhs)2027         internal override bool LessThan(byte rhs)
2028         {
2029             return m_value < rhs;
2030         }
LessThan(char rhs)2031         internal override bool LessThan(char rhs)
2032         {
2033             return m_value < rhs;
2034         }
LessThan(short rhs)2035         internal override bool LessThan(short rhs)
2036         {
2037             return m_value < rhs;
2038         }
LessThan(ushort rhs)2039         internal override bool LessThan(ushort rhs)
2040         {
2041             return m_value < rhs;
2042         }
LessThan(int rhs)2043         internal override bool LessThan(int rhs)
2044         {
2045             return m_value < rhs;
2046         }
LessThan(uint rhs)2047         internal override bool LessThan(uint rhs)
2048         {
2049             return m_value < rhs;
2050         }
LessThan(long rhs)2051         internal override bool LessThan(long rhs)
2052         {
2053             return m_value < rhs;
2054         }
LessThan(float rhs)2055         internal override bool LessThan(float rhs)
2056         {
2057             return m_value < rhs;
2058         }
LessThan(double rhs)2059         internal override bool LessThan(double rhs)
2060         {
2061             return m_value < rhs;
2062         }
LessThan(decimal rhs)2063         internal override bool LessThan(decimal rhs)
2064         {
2065             return m_value < rhs;
2066         }
2067 
GreaterThan(Literal rhs)2068         internal override bool GreaterThan(Literal rhs)
2069         {
2070             return rhs.LessThan(m_value);
2071         }
GreaterThan(sbyte rhs)2072         internal override bool GreaterThan(sbyte rhs)
2073         {
2074             return m_value > rhs;
2075         }
GreaterThan(byte rhs)2076         internal override bool GreaterThan(byte rhs)
2077         {
2078             return m_value > rhs;
2079         }
GreaterThan(char rhs)2080         internal override bool GreaterThan(char rhs)
2081         {
2082             return m_value > rhs;
2083         }
GreaterThan(short rhs)2084         internal override bool GreaterThan(short rhs)
2085         {
2086             return m_value > rhs;
2087         }
GreaterThan(ushort rhs)2088         internal override bool GreaterThan(ushort rhs)
2089         {
2090             return m_value > rhs;
2091         }
GreaterThan(int rhs)2092         internal override bool GreaterThan(int rhs)
2093         {
2094             return m_value > rhs;
2095         }
GreaterThan(uint rhs)2096         internal override bool GreaterThan(uint rhs)
2097         {
2098             return m_value > rhs;
2099         }
GreaterThan(long rhs)2100         internal override bool GreaterThan(long rhs)
2101         {
2102             return m_value > rhs;
2103         }
GreaterThan(float rhs)2104         internal override bool GreaterThan(float rhs)
2105         {
2106             return m_value > rhs;
2107         }
GreaterThan(double rhs)2108         internal override bool GreaterThan(double rhs)
2109         {
2110             return m_value > rhs;
2111         }
GreaterThan(decimal rhs)2112         internal override bool GreaterThan(decimal rhs)
2113         {
2114             return m_value > rhs;
2115         }
2116 
LessThanOrEqual(Literal rhs)2117         internal override bool LessThanOrEqual(Literal rhs)
2118         {
2119             return rhs.GreaterThanOrEqual(m_value);
2120         }
LessThanOrEqual(sbyte rhs)2121         internal override bool LessThanOrEqual(sbyte rhs)
2122         {
2123             return m_value <= rhs;
2124         }
LessThanOrEqual(byte rhs)2125         internal override bool LessThanOrEqual(byte rhs)
2126         {
2127             return m_value <= rhs;
2128         }
LessThanOrEqual(short rhs)2129         internal override bool LessThanOrEqual(short rhs)
2130         {
2131             return m_value <= rhs;
2132         }
LessThanOrEqual(char rhs)2133         internal override bool LessThanOrEqual(char rhs)
2134         {
2135             return m_value <= rhs;
2136         }
LessThanOrEqual(ushort rhs)2137         internal override bool LessThanOrEqual(ushort rhs)
2138         {
2139             return m_value <= rhs;
2140         }
LessThanOrEqual(int rhs)2141         internal override bool LessThanOrEqual(int rhs)
2142         {
2143             return m_value <= rhs;
2144         }
LessThanOrEqual(uint rhs)2145         internal override bool LessThanOrEqual(uint rhs)
2146         {
2147             return m_value <= rhs;
2148         }
LessThanOrEqual(long rhs)2149         internal override bool LessThanOrEqual(long rhs)
2150         {
2151             return m_value <= rhs;
2152         }
LessThanOrEqual(float rhs)2153         internal override bool LessThanOrEqual(float rhs)
2154         {
2155             return m_value <= rhs;
2156         }
LessThanOrEqual(double rhs)2157         internal override bool LessThanOrEqual(double rhs)
2158         {
2159             return m_value <= rhs;
2160         }
LessThanOrEqual(decimal rhs)2161         internal override bool LessThanOrEqual(decimal rhs)
2162         {
2163             return m_value <= rhs;
2164         }
2165 
GreaterThanOrEqual(Literal rhs)2166         internal override bool GreaterThanOrEqual(Literal rhs)
2167         {
2168             return rhs.LessThanOrEqual(m_value);
2169         }
GreaterThanOrEqual(sbyte rhs)2170         internal override bool GreaterThanOrEqual(sbyte rhs)
2171         {
2172             return m_value >= rhs;
2173         }
GreaterThanOrEqual(byte rhs)2174         internal override bool GreaterThanOrEqual(byte rhs)
2175         {
2176             return m_value >= rhs;
2177         }
GreaterThanOrEqual(char rhs)2178         internal override bool GreaterThanOrEqual(char rhs)
2179         {
2180             return m_value >= rhs;
2181         }
GreaterThanOrEqual(short rhs)2182         internal override bool GreaterThanOrEqual(short rhs)
2183         {
2184             return m_value >= rhs;
2185         }
GreaterThanOrEqual(ushort rhs)2186         internal override bool GreaterThanOrEqual(ushort rhs)
2187         {
2188             return m_value >= rhs;
2189 
2190         }
GreaterThanOrEqual(int rhs)2191         internal override bool GreaterThanOrEqual(int rhs)
2192         {
2193             return m_value >= rhs;
2194         }
GreaterThanOrEqual(uint rhs)2195         internal override bool GreaterThanOrEqual(uint rhs)
2196         {
2197             return m_value >= rhs;
2198         }
GreaterThanOrEqual(long rhs)2199         internal override bool GreaterThanOrEqual(long rhs)
2200         {
2201             return m_value >= rhs;
2202         }
GreaterThanOrEqual(float rhs)2203         internal override bool GreaterThanOrEqual(float rhs)
2204         {
2205             return m_value >= rhs;
2206         }
GreaterThanOrEqual(double rhs)2207         internal override bool GreaterThanOrEqual(double rhs)
2208         {
2209             return m_value >= rhs;
2210         }
GreaterThanOrEqual(decimal rhs)2211         internal override bool GreaterThanOrEqual(decimal rhs)
2212         {
2213             return m_value >= rhs;
2214         }
2215     }
2216     #endregion
2217 
2218     #region Char Literal Class
2219     /// <summary>
2220     /// Represents a byte literal
2221     /// </summary>
2222     internal class CharLiteral : Literal
2223     {
2224         private char m_value;
2225 
2226         internal override object Value
2227         {
2228             get { return m_value; }
2229         }
2230 
CharLiteral(char literalValue)2231         internal CharLiteral(char literalValue)
2232         {
2233             m_value = literalValue;
2234             m_type = typeof(char);
2235         }
2236 
Equal(Literal rhs)2237         internal override bool Equal(Literal rhs)
2238         {
2239             return rhs.Equal(m_value);
2240         }
Equal(sbyte rhs)2241         internal override bool Equal(sbyte rhs)
2242         {
2243             return m_value == rhs;
2244         }
Equal(byte rhs)2245         internal override bool Equal(byte rhs)
2246         {
2247             return m_value == rhs;
2248         }
Equal(char rhs)2249         internal override bool Equal(char rhs)
2250         {
2251             return m_value == rhs;
2252         }
Equal(short rhs)2253         internal override bool Equal(short rhs)
2254         {
2255             return m_value == rhs;
2256         }
Equal(ushort rhs)2257         internal override bool Equal(ushort rhs)
2258         {
2259             return m_value == rhs;
2260         }
Equal(int rhs)2261         internal override bool Equal(int rhs)
2262         {
2263             return m_value == rhs;
2264         }
Equal(uint rhs)2265         internal override bool Equal(uint rhs)
2266         {
2267             return m_value == rhs;
2268         }
Equal(long rhs)2269         internal override bool Equal(long rhs)
2270         {
2271             return m_value == rhs;
2272         }
Equal(ulong rhs)2273         internal override bool Equal(ulong rhs)
2274         {
2275             return m_value == rhs;
2276         }
Equal(float rhs)2277         internal override bool Equal(float rhs)
2278         {
2279             return m_value == rhs;
2280         }
Equal(double rhs)2281         internal override bool Equal(double rhs)
2282         {
2283             return m_value == rhs;
2284         }
Equal(decimal rhs)2285         internal override bool Equal(decimal rhs)
2286         {
2287             return m_value == rhs;
2288         }
2289 
LessThan(Literal rhs)2290         internal override bool LessThan(Literal rhs)
2291         {
2292             return rhs.GreaterThan(m_value);
2293         }
LessThan(sbyte rhs)2294         internal override bool LessThan(sbyte rhs)
2295         {
2296             return m_value < rhs;
2297         }
LessThan(byte rhs)2298         internal override bool LessThan(byte rhs)
2299         {
2300             return m_value < rhs;
2301         }
LessThan(char rhs)2302         internal override bool LessThan(char rhs)
2303         {
2304             return m_value < rhs;
2305         }
LessThan(short rhs)2306         internal override bool LessThan(short rhs)
2307         {
2308             return m_value < rhs;
2309         }
LessThan(ushort rhs)2310         internal override bool LessThan(ushort rhs)
2311         {
2312             return m_value < rhs;
2313         }
LessThan(int rhs)2314         internal override bool LessThan(int rhs)
2315         {
2316             return m_value < rhs;
2317         }
LessThan(uint rhs)2318         internal override bool LessThan(uint rhs)
2319         {
2320             return m_value < rhs;
2321         }
LessThan(long rhs)2322         internal override bool LessThan(long rhs)
2323         {
2324             return m_value < rhs;
2325         }
LessThan(ulong rhs)2326         internal override bool LessThan(ulong rhs)
2327         {
2328             return m_value < rhs;
2329         }
LessThan(float rhs)2330         internal override bool LessThan(float rhs)
2331         {
2332             return m_value < rhs;
2333         }
LessThan(double rhs)2334         internal override bool LessThan(double rhs)
2335         {
2336             return m_value < rhs;
2337         }
LessThan(decimal rhs)2338         internal override bool LessThan(decimal rhs)
2339         {
2340             return m_value < rhs;
2341         }
2342 
GreaterThan(Literal rhs)2343         internal override bool GreaterThan(Literal rhs)
2344         {
2345             return rhs.LessThan(m_value);
2346         }
GreaterThan(sbyte rhs)2347         internal override bool GreaterThan(sbyte rhs)
2348         {
2349             return m_value > rhs;
2350         }
GreaterThan(byte rhs)2351         internal override bool GreaterThan(byte rhs)
2352         {
2353             return m_value > rhs;
2354         }
GreaterThan(char rhs)2355         internal override bool GreaterThan(char rhs)
2356         {
2357             return m_value > rhs;
2358         }
GreaterThan(short rhs)2359         internal override bool GreaterThan(short rhs)
2360         {
2361             return m_value > rhs;
2362         }
GreaterThan(ushort rhs)2363         internal override bool GreaterThan(ushort rhs)
2364         {
2365             return m_value > rhs;
2366         }
GreaterThan(int rhs)2367         internal override bool GreaterThan(int rhs)
2368         {
2369             return m_value > rhs;
2370         }
GreaterThan(uint rhs)2371         internal override bool GreaterThan(uint rhs)
2372         {
2373             return m_value > rhs;
2374         }
GreaterThan(long rhs)2375         internal override bool GreaterThan(long rhs)
2376         {
2377             return m_value > rhs;
2378         }
GreaterThan(ulong rhs)2379         internal override bool GreaterThan(ulong rhs)
2380         {
2381             return m_value > rhs;
2382         }
GreaterThan(float rhs)2383         internal override bool GreaterThan(float rhs)
2384         {
2385             return m_value > rhs;
2386         }
GreaterThan(double rhs)2387         internal override bool GreaterThan(double rhs)
2388         {
2389             return m_value > rhs;
2390         }
GreaterThan(decimal rhs)2391         internal override bool GreaterThan(decimal rhs)
2392         {
2393             return m_value > rhs;
2394         }
2395 
LessThanOrEqual(Literal rhs)2396         internal override bool LessThanOrEqual(Literal rhs)
2397         {
2398             return rhs.GreaterThanOrEqual(m_value);
2399         }
LessThanOrEqual(sbyte rhs)2400         internal override bool LessThanOrEqual(sbyte rhs)
2401         {
2402             return m_value <= rhs;
2403         }
LessThanOrEqual(byte rhs)2404         internal override bool LessThanOrEqual(byte rhs)
2405         {
2406             return m_value <= rhs;
2407         }
LessThanOrEqual(short rhs)2408         internal override bool LessThanOrEqual(short rhs)
2409         {
2410             return m_value <= rhs;
2411         }
LessThanOrEqual(char rhs)2412         internal override bool LessThanOrEqual(char rhs)
2413         {
2414             return m_value <= rhs;
2415         }
LessThanOrEqual(ushort rhs)2416         internal override bool LessThanOrEqual(ushort rhs)
2417         {
2418             return m_value <= rhs;
2419         }
LessThanOrEqual(int rhs)2420         internal override bool LessThanOrEqual(int rhs)
2421         {
2422             return m_value <= rhs;
2423         }
LessThanOrEqual(uint rhs)2424         internal override bool LessThanOrEqual(uint rhs)
2425         {
2426             return m_value <= rhs;
2427         }
LessThanOrEqual(long rhs)2428         internal override bool LessThanOrEqual(long rhs)
2429         {
2430             return m_value <= rhs;
2431         }
LessThanOrEqual(ulong rhs)2432         internal override bool LessThanOrEqual(ulong rhs)
2433         {
2434             return m_value <= rhs;
2435         }
LessThanOrEqual(float rhs)2436         internal override bool LessThanOrEqual(float rhs)
2437         {
2438             return m_value <= rhs;
2439         }
LessThanOrEqual(double rhs)2440         internal override bool LessThanOrEqual(double rhs)
2441         {
2442             return m_value <= rhs;
2443         }
LessThanOrEqual(decimal rhs)2444         internal override bool LessThanOrEqual(decimal rhs)
2445         {
2446             return m_value <= rhs;
2447         }
2448 
GreaterThanOrEqual(Literal rhs)2449         internal override bool GreaterThanOrEqual(Literal rhs)
2450         {
2451             return rhs.LessThanOrEqual(m_value);
2452         }
GreaterThanOrEqual(sbyte rhs)2453         internal override bool GreaterThanOrEqual(sbyte rhs)
2454         {
2455             return m_value >= rhs;
2456         }
GreaterThanOrEqual(byte rhs)2457         internal override bool GreaterThanOrEqual(byte rhs)
2458         {
2459             return m_value >= rhs;
2460         }
GreaterThanOrEqual(char rhs)2461         internal override bool GreaterThanOrEqual(char rhs)
2462         {
2463             return m_value >= rhs;
2464         }
GreaterThanOrEqual(short rhs)2465         internal override bool GreaterThanOrEqual(short rhs)
2466         {
2467             return m_value >= rhs;
2468         }
GreaterThanOrEqual(ushort rhs)2469         internal override bool GreaterThanOrEqual(ushort rhs)
2470         {
2471             return m_value >= rhs;
2472         }
GreaterThanOrEqual(int rhs)2473         internal override bool GreaterThanOrEqual(int rhs)
2474         {
2475             return m_value >= rhs;
2476         }
GreaterThanOrEqual(uint rhs)2477         internal override bool GreaterThanOrEqual(uint rhs)
2478         {
2479             return m_value >= rhs;
2480         }
GreaterThanOrEqual(long rhs)2481         internal override bool GreaterThanOrEqual(long rhs)
2482         {
2483             return m_value >= rhs;
2484         }
GreaterThanOrEqual(ulong rhs)2485         internal override bool GreaterThanOrEqual(ulong rhs)
2486         {
2487             return m_value >= rhs;
2488         }
GreaterThanOrEqual(float rhs)2489         internal override bool GreaterThanOrEqual(float rhs)
2490         {
2491             return m_value >= rhs;
2492         }
GreaterThanOrEqual(double rhs)2493         internal override bool GreaterThanOrEqual(double rhs)
2494         {
2495             return m_value >= rhs;
2496         }
GreaterThanOrEqual(decimal rhs)2497         internal override bool GreaterThanOrEqual(decimal rhs)
2498         {
2499             return m_value >= rhs;
2500         }
2501     }
2502     #endregion
2503 
2504     #region Decimal Literal Class
2505     /// <summary>
2506     /// Represents a decimal literal
2507     /// </summary>
2508     internal class DecimalLiteral : Literal
2509     {
2510         private decimal m_value;
2511 
2512         internal override object Value
2513         {
2514             get { return m_value; }
2515         }
2516 
DecimalLiteral(decimal literalValue)2517         internal DecimalLiteral(decimal literalValue)
2518         {
2519             m_value = literalValue;
2520             m_type = typeof(decimal);
2521         }
2522 
Equal(Literal rhs)2523         internal override bool Equal(Literal rhs)
2524         {
2525             return rhs.Equal(m_value);
2526         }
Equal(sbyte rhs)2527         internal override bool Equal(sbyte rhs)
2528         {
2529             return m_value == rhs;
2530         }
Equal(byte rhs)2531         internal override bool Equal(byte rhs)
2532         {
2533             return m_value == rhs;
2534         }
Equal(char rhs)2535         internal override bool Equal(char rhs)
2536         {
2537             return m_value == rhs;
2538         }
Equal(short rhs)2539         internal override bool Equal(short rhs)
2540         {
2541             return m_value == rhs;
2542         }
Equal(ushort rhs)2543         internal override bool Equal(ushort rhs)
2544         {
2545             return m_value == rhs;
2546         }
Equal(int rhs)2547         internal override bool Equal(int rhs)
2548         {
2549             return m_value == rhs;
2550         }
Equal(uint rhs)2551         internal override bool Equal(uint rhs)
2552         {
2553             return m_value == rhs;
2554         }
Equal(long rhs)2555         internal override bool Equal(long rhs)
2556         {
2557             return m_value == rhs;
2558         }
Equal(ulong rhs)2559         internal override bool Equal(ulong rhs)
2560         {
2561             return m_value == rhs;
2562         }
Equal(decimal rhs)2563         internal override bool Equal(decimal rhs)
2564         {
2565             return m_value == rhs;
2566         }
2567 
LessThan(Literal rhs)2568         internal override bool LessThan(Literal rhs)
2569         {
2570             return rhs.GreaterThan(m_value);
2571         }
LessThan(sbyte rhs)2572         internal override bool LessThan(sbyte rhs)
2573         {
2574             return m_value < rhs;
2575         }
LessThan(byte rhs)2576         internal override bool LessThan(byte rhs)
2577         {
2578             return m_value < rhs;
2579         }
LessThan(char rhs)2580         internal override bool LessThan(char rhs)
2581         {
2582             return m_value < rhs;
2583         }
LessThan(short rhs)2584         internal override bool LessThan(short rhs)
2585         {
2586             return m_value < rhs;
2587         }
LessThan(ushort rhs)2588         internal override bool LessThan(ushort rhs)
2589         {
2590             return m_value < rhs;
2591         }
LessThan(int rhs)2592         internal override bool LessThan(int rhs)
2593         {
2594             return m_value < rhs;
2595         }
LessThan(uint rhs)2596         internal override bool LessThan(uint rhs)
2597         {
2598             return m_value < rhs;
2599         }
LessThan(long rhs)2600         internal override bool LessThan(long rhs)
2601         {
2602             return m_value < rhs;
2603         }
LessThan(ulong rhs)2604         internal override bool LessThan(ulong rhs)
2605         {
2606             return m_value < rhs;
2607         }
LessThan(decimal rhs)2608         internal override bool LessThan(decimal rhs)
2609         {
2610             return m_value < rhs;
2611         }
2612 
GreaterThan(Literal rhs)2613         internal override bool GreaterThan(Literal rhs)
2614         {
2615             return rhs.LessThan(m_value);
2616         }
GreaterThan(sbyte rhs)2617         internal override bool GreaterThan(sbyte rhs)
2618         {
2619             return m_value > rhs;
2620         }
GreaterThan(byte rhs)2621         internal override bool GreaterThan(byte rhs)
2622         {
2623             return m_value > rhs;
2624         }
GreaterThan(char rhs)2625         internal override bool GreaterThan(char rhs)
2626         {
2627             return m_value > rhs;
2628         }
GreaterThan(short rhs)2629         internal override bool GreaterThan(short rhs)
2630         {
2631             return m_value > rhs;
2632         }
GreaterThan(ushort rhs)2633         internal override bool GreaterThan(ushort rhs)
2634         {
2635             return m_value > rhs;
2636         }
GreaterThan(int rhs)2637         internal override bool GreaterThan(int rhs)
2638         {
2639             return m_value > rhs;
2640         }
GreaterThan(uint rhs)2641         internal override bool GreaterThan(uint rhs)
2642         {
2643             return m_value > rhs;
2644         }
GreaterThan(long rhs)2645         internal override bool GreaterThan(long rhs)
2646         {
2647             return m_value > rhs;
2648         }
GreaterThan(ulong rhs)2649         internal override bool GreaterThan(ulong rhs)
2650         {
2651             return m_value > rhs;
2652         }
GreaterThan(decimal rhs)2653         internal override bool GreaterThan(decimal rhs)
2654         {
2655             return m_value > rhs;
2656         }
2657 
LessThanOrEqual(Literal rhs)2658         internal override bool LessThanOrEqual(Literal rhs)
2659         {
2660             return rhs.GreaterThanOrEqual(m_value);
2661         }
LessThanOrEqual(sbyte rhs)2662         internal override bool LessThanOrEqual(sbyte rhs)
2663         {
2664             return m_value <= rhs;
2665         }
LessThanOrEqual(byte rhs)2666         internal override bool LessThanOrEqual(byte rhs)
2667         {
2668             return m_value <= rhs;
2669         }
LessThanOrEqual(short rhs)2670         internal override bool LessThanOrEqual(short rhs)
2671         {
2672             return m_value <= rhs;
2673         }
LessThanOrEqual(char rhs)2674         internal override bool LessThanOrEqual(char rhs)
2675         {
2676             return m_value <= rhs;
2677         }
LessThanOrEqual(ushort rhs)2678         internal override bool LessThanOrEqual(ushort rhs)
2679         {
2680             return m_value <= rhs;
2681         }
LessThanOrEqual(int rhs)2682         internal override bool LessThanOrEqual(int rhs)
2683         {
2684             return m_value <= rhs;
2685         }
LessThanOrEqual(uint rhs)2686         internal override bool LessThanOrEqual(uint rhs)
2687         {
2688             return m_value <= rhs;
2689         }
LessThanOrEqual(long rhs)2690         internal override bool LessThanOrEqual(long rhs)
2691         {
2692             return m_value <= rhs;
2693         }
LessThanOrEqual(ulong rhs)2694         internal override bool LessThanOrEqual(ulong rhs)
2695         {
2696             return m_value <= rhs;
2697         }
LessThanOrEqual(decimal rhs)2698         internal override bool LessThanOrEqual(decimal rhs)
2699         {
2700             return m_value <= rhs;
2701         }
2702 
GreaterThanOrEqual(Literal rhs)2703         internal override bool GreaterThanOrEqual(Literal rhs)
2704         {
2705             return rhs.LessThanOrEqual(m_value);
2706         }
GreaterThanOrEqual(sbyte rhs)2707         internal override bool GreaterThanOrEqual(sbyte rhs)
2708         {
2709             return m_value >= rhs;
2710         }
GreaterThanOrEqual(byte rhs)2711         internal override bool GreaterThanOrEqual(byte rhs)
2712         {
2713             return m_value >= rhs;
2714         }
GreaterThanOrEqual(char rhs)2715         internal override bool GreaterThanOrEqual(char rhs)
2716         {
2717             return m_value >= rhs;
2718         }
GreaterThanOrEqual(short rhs)2719         internal override bool GreaterThanOrEqual(short rhs)
2720         {
2721             return m_value >= rhs;
2722         }
GreaterThanOrEqual(ushort rhs)2723         internal override bool GreaterThanOrEqual(ushort rhs)
2724         {
2725             return m_value >= rhs;
2726         }
GreaterThanOrEqual(int rhs)2727         internal override bool GreaterThanOrEqual(int rhs)
2728         {
2729             return m_value >= rhs;
2730         }
GreaterThanOrEqual(uint rhs)2731         internal override bool GreaterThanOrEqual(uint rhs)
2732         {
2733             return m_value >= rhs;
2734         }
GreaterThanOrEqual(long rhs)2735         internal override bool GreaterThanOrEqual(long rhs)
2736         {
2737             return m_value >= rhs;
2738         }
GreaterThanOrEqual(ulong rhs)2739         internal override bool GreaterThanOrEqual(ulong rhs)
2740         {
2741             return m_value >= rhs;
2742         }
GreaterThanOrEqual(decimal rhs)2743         internal override bool GreaterThanOrEqual(decimal rhs)
2744         {
2745             return m_value >= rhs;
2746         }
2747     }
2748     #endregion
2749 
2750     #region Int16 Literal Class
2751     /// <summary>
2752     /// Represents an Int16 literal
2753     /// </summary>
2754     internal class ShortLiteral : Literal
2755     {
2756         private short m_value;
2757 
2758         internal override object Value
2759         {
2760             get { return m_value; }
2761         }
2762 
ShortLiteral(short literalValue)2763         internal ShortLiteral(short literalValue)
2764         {
2765             m_value = literalValue;
2766             m_type = typeof(short);
2767         }
2768 
Equal(Literal rhs)2769         internal override bool Equal(Literal rhs)
2770         {
2771             return rhs.Equal(m_value);
2772         }
Equal(sbyte rhs)2773         internal override bool Equal(sbyte rhs)
2774         {
2775             return m_value == rhs;
2776         }
Equal(byte rhs)2777         internal override bool Equal(byte rhs)
2778         {
2779             return m_value == rhs;
2780         }
Equal(char rhs)2781         internal override bool Equal(char rhs)
2782         {
2783             return m_value == rhs;
2784         }
Equal(short rhs)2785         internal override bool Equal(short rhs)
2786         {
2787             return m_value == rhs;
2788         }
Equal(ushort rhs)2789         internal override bool Equal(ushort rhs)
2790         {
2791             return m_value == rhs;
2792         }
Equal(int rhs)2793         internal override bool Equal(int rhs)
2794         {
2795             return m_value == rhs;
2796         }
Equal(uint rhs)2797         internal override bool Equal(uint rhs)
2798         {
2799             return m_value == rhs;
2800         }
Equal(long rhs)2801         internal override bool Equal(long rhs)
2802         {
2803             return m_value == rhs;
2804         }
Equal(ulong rhs)2805         internal override bool Equal(ulong rhs)
2806         {
2807             return (m_value >= 0) && ((ulong)m_value == rhs);
2808         }
Equal(float rhs)2809         internal override bool Equal(float rhs)
2810         {
2811             return m_value == rhs;
2812         }
Equal(double rhs)2813         internal override bool Equal(double rhs)
2814         {
2815             return m_value == rhs;
2816         }
Equal(decimal rhs)2817         internal override bool Equal(decimal rhs)
2818         {
2819             return m_value == rhs;
2820         }
2821 
LessThan(Literal rhs)2822         internal override bool LessThan(Literal rhs)
2823         {
2824             return rhs.GreaterThan(m_value);
2825         }
LessThan(sbyte rhs)2826         internal override bool LessThan(sbyte rhs)
2827         {
2828             return m_value < rhs;
2829         }
LessThan(byte rhs)2830         internal override bool LessThan(byte rhs)
2831         {
2832             return m_value < rhs;
2833         }
LessThan(char rhs)2834         internal override bool LessThan(char rhs)
2835         {
2836             return m_value < rhs;
2837         }
LessThan(short rhs)2838         internal override bool LessThan(short rhs)
2839         {
2840             return m_value < rhs;
2841         }
LessThan(ushort rhs)2842         internal override bool LessThan(ushort rhs)
2843         {
2844             return m_value < rhs;
2845         }
LessThan(int rhs)2846         internal override bool LessThan(int rhs)
2847         {
2848             return m_value < rhs;
2849         }
LessThan(uint rhs)2850         internal override bool LessThan(uint rhs)
2851         {
2852             return m_value < rhs;
2853         }
LessThan(long rhs)2854         internal override bool LessThan(long rhs)
2855         {
2856             return m_value < rhs;
2857         }
LessThan(float rhs)2858         internal override bool LessThan(float rhs)
2859         {
2860             return m_value < rhs;
2861         }
LessThan(double rhs)2862         internal override bool LessThan(double rhs)
2863         {
2864             return m_value < rhs;
2865         }
LessThan(decimal rhs)2866         internal override bool LessThan(decimal rhs)
2867         {
2868             return m_value < rhs;
2869         }
2870 
GreaterThan(Literal rhs)2871         internal override bool GreaterThan(Literal rhs)
2872         {
2873             return rhs.LessThan(m_value);
2874         }
GreaterThan(sbyte rhs)2875         internal override bool GreaterThan(sbyte rhs)
2876         {
2877             return m_value > rhs;
2878         }
GreaterThan(byte rhs)2879         internal override bool GreaterThan(byte rhs)
2880         {
2881             return m_value > rhs;
2882         }
GreaterThan(char rhs)2883         internal override bool GreaterThan(char rhs)
2884         {
2885             return m_value > rhs;
2886         }
GreaterThan(short rhs)2887         internal override bool GreaterThan(short rhs)
2888         {
2889             return m_value > rhs;
2890         }
GreaterThan(ushort rhs)2891         internal override bool GreaterThan(ushort rhs)
2892         {
2893             return m_value > rhs;
2894         }
GreaterThan(int rhs)2895         internal override bool GreaterThan(int rhs)
2896         {
2897             return m_value > rhs;
2898         }
GreaterThan(uint rhs)2899         internal override bool GreaterThan(uint rhs)
2900         {
2901             return m_value > rhs;
2902         }
GreaterThan(long rhs)2903         internal override bool GreaterThan(long rhs)
2904         {
2905             return m_value > rhs;
2906         }
GreaterThan(float rhs)2907         internal override bool GreaterThan(float rhs)
2908         {
2909             return m_value > rhs;
2910         }
GreaterThan(double rhs)2911         internal override bool GreaterThan(double rhs)
2912         {
2913             return m_value > rhs;
2914         }
GreaterThan(decimal rhs)2915         internal override bool GreaterThan(decimal rhs)
2916         {
2917             return m_value > rhs;
2918         }
2919 
LessThanOrEqual(Literal rhs)2920         internal override bool LessThanOrEqual(Literal rhs)
2921         {
2922             return rhs.GreaterThanOrEqual(m_value);
2923         }
LessThanOrEqual(sbyte rhs)2924         internal override bool LessThanOrEqual(sbyte rhs)
2925         {
2926             return m_value <= rhs;
2927         }
LessThanOrEqual(byte rhs)2928         internal override bool LessThanOrEqual(byte rhs)
2929         {
2930             return m_value <= rhs;
2931         }
LessThanOrEqual(short rhs)2932         internal override bool LessThanOrEqual(short rhs)
2933         {
2934             return m_value <= rhs;
2935         }
LessThanOrEqual(char rhs)2936         internal override bool LessThanOrEqual(char rhs)
2937         {
2938             return m_value <= rhs;
2939         }
LessThanOrEqual(ushort rhs)2940         internal override bool LessThanOrEqual(ushort rhs)
2941         {
2942             return m_value <= rhs;
2943         }
LessThanOrEqual(int rhs)2944         internal override bool LessThanOrEqual(int rhs)
2945         {
2946             return m_value <= rhs;
2947         }
LessThanOrEqual(uint rhs)2948         internal override bool LessThanOrEqual(uint rhs)
2949         {
2950             return m_value <= rhs;
2951         }
LessThanOrEqual(long rhs)2952         internal override bool LessThanOrEqual(long rhs)
2953         {
2954             return m_value <= rhs;
2955         }
LessThanOrEqual(float rhs)2956         internal override bool LessThanOrEqual(float rhs)
2957         {
2958             return m_value <= rhs;
2959         }
LessThanOrEqual(double rhs)2960         internal override bool LessThanOrEqual(double rhs)
2961         {
2962             return m_value <= rhs;
2963         }
LessThanOrEqual(decimal rhs)2964         internal override bool LessThanOrEqual(decimal rhs)
2965         {
2966             return m_value <= rhs;
2967         }
2968 
GreaterThanOrEqual(Literal rhs)2969         internal override bool GreaterThanOrEqual(Literal rhs)
2970         {
2971             return rhs.LessThanOrEqual(m_value);
2972         }
GreaterThanOrEqual(sbyte rhs)2973         internal override bool GreaterThanOrEqual(sbyte rhs)
2974         {
2975             return m_value >= rhs;
2976         }
GreaterThanOrEqual(byte rhs)2977         internal override bool GreaterThanOrEqual(byte rhs)
2978         {
2979             return m_value >= rhs;
2980         }
GreaterThanOrEqual(char rhs)2981         internal override bool GreaterThanOrEqual(char rhs)
2982         {
2983             return m_value >= rhs;
2984         }
GreaterThanOrEqual(short rhs)2985         internal override bool GreaterThanOrEqual(short rhs)
2986         {
2987             return m_value >= rhs;
2988         }
GreaterThanOrEqual(ushort rhs)2989         internal override bool GreaterThanOrEqual(ushort rhs)
2990         {
2991             return m_value >= rhs;
2992         }
GreaterThanOrEqual(int rhs)2993         internal override bool GreaterThanOrEqual(int rhs)
2994         {
2995             return m_value >= rhs;
2996         }
GreaterThanOrEqual(uint rhs)2997         internal override bool GreaterThanOrEqual(uint rhs)
2998         {
2999             return m_value >= rhs;
3000         }
GreaterThanOrEqual(long rhs)3001         internal override bool GreaterThanOrEqual(long rhs)
3002         {
3003             return m_value >= rhs;
3004         }
GreaterThanOrEqual(float rhs)3005         internal override bool GreaterThanOrEqual(float rhs)
3006         {
3007             return m_value >= rhs;
3008         }
GreaterThanOrEqual(double rhs)3009         internal override bool GreaterThanOrEqual(double rhs)
3010         {
3011             return m_value >= rhs;
3012         }
GreaterThanOrEqual(decimal rhs)3013         internal override bool GreaterThanOrEqual(decimal rhs)
3014         {
3015             return m_value >= rhs;
3016         }
3017     }
3018     #endregion
3019 
3020     #region Int32 Literal Class
3021     /// <summary>
3022     /// Represents an Int32 literal
3023     /// </summary>
3024     internal class IntLiteral : Literal
3025     {
3026         private int m_value;
3027 
3028         internal override object Value
3029         {
3030             get { return m_value; }
3031         }
3032 
IntLiteral(int literalValue)3033         internal IntLiteral(int literalValue)
3034         {
3035             m_value = literalValue;
3036             m_type = typeof(int);
3037         }
3038 
Equal(Literal rhs)3039         internal override bool Equal(Literal rhs)
3040         {
3041             return rhs.Equal(m_value);
3042         }
Equal(sbyte rhs)3043         internal override bool Equal(sbyte rhs)
3044         {
3045             return m_value == rhs;
3046         }
Equal(byte rhs)3047         internal override bool Equal(byte rhs)
3048         {
3049             return m_value == rhs;
3050         }
Equal(char rhs)3051         internal override bool Equal(char rhs)
3052         {
3053             return m_value == rhs;
3054         }
Equal(short rhs)3055         internal override bool Equal(short rhs)
3056         {
3057             return m_value == rhs;
3058         }
Equal(ushort rhs)3059         internal override bool Equal(ushort rhs)
3060         {
3061             return m_value == rhs;
3062         }
Equal(int rhs)3063         internal override bool Equal(int rhs)
3064         {
3065             return m_value == rhs;
3066         }
Equal(uint rhs)3067         internal override bool Equal(uint rhs)
3068         {
3069             return m_value == rhs;
3070         }
Equal(long rhs)3071         internal override bool Equal(long rhs)
3072         {
3073             return m_value == rhs;
3074         }
Equal(ulong rhs)3075         internal override bool Equal(ulong rhs)
3076         {
3077             return (m_value >= 0) && ((ulong)m_value == rhs);
3078         }
Equal(float rhs)3079         internal override bool Equal(float rhs)
3080         {
3081             return m_value == rhs;
3082         }
Equal(double rhs)3083         internal override bool Equal(double rhs)
3084         {
3085             return m_value == rhs;
3086         }
Equal(decimal rhs)3087         internal override bool Equal(decimal rhs)
3088         {
3089             return m_value == rhs;
3090         }
3091 
LessThan(Literal rhs)3092         internal override bool LessThan(Literal rhs)
3093         {
3094             return rhs.GreaterThan(m_value);
3095         }
LessThan(sbyte rhs)3096         internal override bool LessThan(sbyte rhs)
3097         {
3098             return m_value < rhs;
3099         }
LessThan(byte rhs)3100         internal override bool LessThan(byte rhs)
3101         {
3102             return m_value < rhs;
3103         }
LessThan(char rhs)3104         internal override bool LessThan(char rhs)
3105         {
3106             return m_value < rhs;
3107         }
LessThan(short rhs)3108         internal override bool LessThan(short rhs)
3109         {
3110             return m_value < rhs;
3111         }
LessThan(ushort rhs)3112         internal override bool LessThan(ushort rhs)
3113         {
3114             return m_value < rhs;
3115         }
LessThan(int rhs)3116         internal override bool LessThan(int rhs)
3117         {
3118             return m_value < rhs;
3119         }
LessThan(uint rhs)3120         internal override bool LessThan(uint rhs)
3121         {
3122             return m_value < rhs;
3123         }
LessThan(long rhs)3124         internal override bool LessThan(long rhs)
3125         {
3126             return m_value < rhs;
3127         }
LessThan(ulong rhs)3128         internal override bool LessThan(ulong rhs)
3129         {
3130             return (m_value < 0) || ((ulong)m_value < rhs);
3131         }
LessThan(float rhs)3132         internal override bool LessThan(float rhs)
3133         {
3134             return m_value < rhs;
3135         }
LessThan(double rhs)3136         internal override bool LessThan(double rhs)
3137         {
3138             return m_value < rhs;
3139         }
LessThan(decimal rhs)3140         internal override bool LessThan(decimal rhs)
3141         {
3142             return m_value < rhs;
3143         }
3144 
GreaterThan(Literal rhs)3145         internal override bool GreaterThan(Literal rhs)
3146         {
3147             return rhs.LessThan(m_value);
3148         }
GreaterThan(sbyte rhs)3149         internal override bool GreaterThan(sbyte rhs)
3150         {
3151             return m_value > rhs;
3152         }
GreaterThan(byte rhs)3153         internal override bool GreaterThan(byte rhs)
3154         {
3155             return m_value > rhs;
3156         }
GreaterThan(char rhs)3157         internal override bool GreaterThan(char rhs)
3158         {
3159             return m_value > rhs;
3160         }
GreaterThan(short rhs)3161         internal override bool GreaterThan(short rhs)
3162         {
3163             return m_value > rhs;
3164         }
GreaterThan(ushort rhs)3165         internal override bool GreaterThan(ushort rhs)
3166         {
3167             return m_value > rhs;
3168         }
GreaterThan(int rhs)3169         internal override bool GreaterThan(int rhs)
3170         {
3171             return m_value > rhs;
3172         }
GreaterThan(uint rhs)3173         internal override bool GreaterThan(uint rhs)
3174         {
3175             return m_value > rhs;
3176         }
GreaterThan(long rhs)3177         internal override bool GreaterThan(long rhs)
3178         {
3179             return m_value > rhs;
3180         }
GreaterThan(ulong rhs)3181         internal override bool GreaterThan(ulong rhs)
3182         {
3183             return (m_value >= 0) && ((ulong)m_value > rhs);
3184         }
GreaterThan(float rhs)3185         internal override bool GreaterThan(float rhs)
3186         {
3187             return m_value > rhs;
3188         }
GreaterThan(double rhs)3189         internal override bool GreaterThan(double rhs)
3190         {
3191             return m_value > rhs;
3192         }
GreaterThan(decimal rhs)3193         internal override bool GreaterThan(decimal rhs)
3194         {
3195             return m_value > rhs;
3196         }
3197 
LessThanOrEqual(Literal rhs)3198         internal override bool LessThanOrEqual(Literal rhs)
3199         {
3200             return rhs.GreaterThanOrEqual(m_value);
3201         }
LessThanOrEqual(sbyte rhs)3202         internal override bool LessThanOrEqual(sbyte rhs)
3203         {
3204             return m_value <= rhs;
3205         }
LessThanOrEqual(byte rhs)3206         internal override bool LessThanOrEqual(byte rhs)
3207         {
3208             return m_value <= rhs;
3209         }
LessThanOrEqual(short rhs)3210         internal override bool LessThanOrEqual(short rhs)
3211         {
3212             return m_value <= rhs;
3213         }
LessThanOrEqual(char rhs)3214         internal override bool LessThanOrEqual(char rhs)
3215         {
3216             return m_value <= rhs;
3217         }
LessThanOrEqual(ushort rhs)3218         internal override bool LessThanOrEqual(ushort rhs)
3219         {
3220             return m_value <= rhs;
3221         }
LessThanOrEqual(int rhs)3222         internal override bool LessThanOrEqual(int rhs)
3223         {
3224             return m_value <= rhs;
3225         }
LessThanOrEqual(uint rhs)3226         internal override bool LessThanOrEqual(uint rhs)
3227         {
3228             return m_value <= rhs;
3229         }
LessThanOrEqual(long rhs)3230         internal override bool LessThanOrEqual(long rhs)
3231         {
3232             return m_value <= rhs;
3233         }
LessThanOrEqual(ulong rhs)3234         internal override bool LessThanOrEqual(ulong rhs)
3235         {
3236             return (m_value < 0) || ((ulong)m_value <= rhs);
3237         }
LessThanOrEqual(float rhs)3238         internal override bool LessThanOrEqual(float rhs)
3239         {
3240             return m_value <= rhs;
3241         }
LessThanOrEqual(double rhs)3242         internal override bool LessThanOrEqual(double rhs)
3243         {
3244             return m_value <= rhs;
3245         }
LessThanOrEqual(decimal rhs)3246         internal override bool LessThanOrEqual(decimal rhs)
3247         {
3248             return m_value <= rhs;
3249         }
3250 
GreaterThanOrEqual(Literal rhs)3251         internal override bool GreaterThanOrEqual(Literal rhs)
3252         {
3253             return rhs.LessThanOrEqual(m_value);
3254         }
GreaterThanOrEqual(sbyte rhs)3255         internal override bool GreaterThanOrEqual(sbyte rhs)
3256         {
3257             return m_value >= rhs;
3258         }
GreaterThanOrEqual(byte rhs)3259         internal override bool GreaterThanOrEqual(byte rhs)
3260         {
3261             return m_value >= rhs;
3262         }
GreaterThanOrEqual(char rhs)3263         internal override bool GreaterThanOrEqual(char rhs)
3264         {
3265             return m_value >= rhs;
3266         }
GreaterThanOrEqual(short rhs)3267         internal override bool GreaterThanOrEqual(short rhs)
3268         {
3269             return m_value >= rhs;
3270         }
GreaterThanOrEqual(ushort rhs)3271         internal override bool GreaterThanOrEqual(ushort rhs)
3272         {
3273             return m_value >= rhs;
3274         }
GreaterThanOrEqual(int rhs)3275         internal override bool GreaterThanOrEqual(int rhs)
3276         {
3277             return m_value >= rhs;
3278         }
GreaterThanOrEqual(uint rhs)3279         internal override bool GreaterThanOrEqual(uint rhs)
3280         {
3281             return m_value >= rhs;
3282         }
GreaterThanOrEqual(long rhs)3283         internal override bool GreaterThanOrEqual(long rhs)
3284         {
3285             return m_value >= rhs;
3286         }
GreaterThanOrEqual(ulong rhs)3287         internal override bool GreaterThanOrEqual(ulong rhs)
3288         {
3289             return (m_value >= 0) && ((ulong)m_value >= rhs);
3290         }
GreaterThanOrEqual(float rhs)3291         internal override bool GreaterThanOrEqual(float rhs)
3292         {
3293             return m_value >= rhs;
3294         }
GreaterThanOrEqual(double rhs)3295         internal override bool GreaterThanOrEqual(double rhs)
3296         {
3297             return m_value >= rhs;
3298         }
GreaterThanOrEqual(decimal rhs)3299         internal override bool GreaterThanOrEqual(decimal rhs)
3300         {
3301             return m_value >= rhs;
3302         }
3303     }
3304     #endregion
3305 
3306     #region Int64 Literal Class
3307     /// <summary>
3308     /// Represents an Int64 literal
3309     /// </summary>
3310     internal class LongLiteral : Literal
3311     {
3312         private long m_value;
3313 
3314         internal override object Value
3315         {
3316             get { return m_value; }
3317         }
3318 
LongLiteral(long literalValue)3319         internal LongLiteral(long literalValue)
3320         {
3321             m_value = literalValue;
3322             m_type = typeof(long);
3323         }
3324 
Equal(Literal rhs)3325         internal override bool Equal(Literal rhs)
3326         {
3327             return rhs.Equal(m_value);
3328         }
Equal(sbyte rhs)3329         internal override bool Equal(sbyte rhs)
3330         {
3331             return m_value == rhs;
3332         }
Equal(byte rhs)3333         internal override bool Equal(byte rhs)
3334         {
3335             return m_value == rhs;
3336         }
Equal(char rhs)3337         internal override bool Equal(char rhs)
3338         {
3339             return m_value == rhs;
3340         }
Equal(short rhs)3341         internal override bool Equal(short rhs)
3342         {
3343             return m_value == rhs;
3344         }
Equal(ushort rhs)3345         internal override bool Equal(ushort rhs)
3346         {
3347             return m_value == rhs;
3348         }
Equal(int rhs)3349         internal override bool Equal(int rhs)
3350         {
3351             return m_value == rhs;
3352         }
Equal(uint rhs)3353         internal override bool Equal(uint rhs)
3354         {
3355             return m_value == rhs;
3356         }
Equal(long rhs)3357         internal override bool Equal(long rhs)
3358         {
3359             return m_value == rhs;
3360         }
Equal(ulong rhs)3361         internal override bool Equal(ulong rhs)
3362         {
3363             return (m_value >= 0) && ((ulong)m_value == rhs);
3364         }
Equal(float rhs)3365         internal override bool Equal(float rhs)
3366         {
3367             return m_value == rhs;
3368         }
Equal(double rhs)3369         internal override bool Equal(double rhs)
3370         {
3371             return m_value == rhs;
3372         }
Equal(decimal rhs)3373         internal override bool Equal(decimal rhs)
3374         {
3375             return m_value == rhs;
3376         }
3377 
LessThan(Literal rhs)3378         internal override bool LessThan(Literal rhs)
3379         {
3380             return rhs.GreaterThan(m_value);
3381         }
LessThan(sbyte rhs)3382         internal override bool LessThan(sbyte rhs)
3383         {
3384             return m_value < rhs;
3385         }
LessThan(byte rhs)3386         internal override bool LessThan(byte rhs)
3387         {
3388             return m_value < rhs;
3389         }
LessThan(char rhs)3390         internal override bool LessThan(char rhs)
3391         {
3392             return m_value < rhs;
3393         }
LessThan(short rhs)3394         internal override bool LessThan(short rhs)
3395         {
3396             return m_value < rhs;
3397         }
LessThan(ushort rhs)3398         internal override bool LessThan(ushort rhs)
3399         {
3400             return m_value < rhs;
3401         }
LessThan(int rhs)3402         internal override bool LessThan(int rhs)
3403         {
3404             return m_value < rhs;
3405         }
LessThan(uint rhs)3406         internal override bool LessThan(uint rhs)
3407         {
3408             return m_value < rhs;
3409         }
LessThan(long rhs)3410         internal override bool LessThan(long rhs)
3411         {
3412             return m_value < rhs;
3413         }
LessThan(ulong rhs)3414         internal override bool LessThan(ulong rhs)
3415         {
3416             return (m_value < 0) || ((ulong)m_value < rhs);
3417         }
LessThan(float rhs)3418         internal override bool LessThan(float rhs)
3419         {
3420             return m_value < rhs;
3421         }
LessThan(double rhs)3422         internal override bool LessThan(double rhs)
3423         {
3424             return m_value < rhs;
3425         }
LessThan(decimal rhs)3426         internal override bool LessThan(decimal rhs)
3427         {
3428             return m_value < rhs;
3429         }
3430 
GreaterThan(Literal rhs)3431         internal override bool GreaterThan(Literal rhs)
3432         {
3433             return rhs.LessThan(m_value);
3434         }
GreaterThan(sbyte rhs)3435         internal override bool GreaterThan(sbyte rhs)
3436         {
3437             return m_value > rhs;
3438         }
GreaterThan(byte rhs)3439         internal override bool GreaterThan(byte rhs)
3440         {
3441             return m_value > rhs;
3442         }
GreaterThan(char rhs)3443         internal override bool GreaterThan(char rhs)
3444         {
3445             return m_value > rhs;
3446         }
GreaterThan(short rhs)3447         internal override bool GreaterThan(short rhs)
3448         {
3449             return m_value > rhs;
3450         }
GreaterThan(ushort rhs)3451         internal override bool GreaterThan(ushort rhs)
3452         {
3453             return m_value > rhs;
3454         }
GreaterThan(int rhs)3455         internal override bool GreaterThan(int rhs)
3456         {
3457             return m_value > rhs;
3458         }
GreaterThan(uint rhs)3459         internal override bool GreaterThan(uint rhs)
3460         {
3461             return m_value > rhs;
3462         }
GreaterThan(long rhs)3463         internal override bool GreaterThan(long rhs)
3464         {
3465             return m_value > rhs;
3466         }
GreaterThan(ulong rhs)3467         internal override bool GreaterThan(ulong rhs)
3468         {
3469             return (m_value >= 0) && ((ulong)m_value > rhs);
3470         }
GreaterThan(float rhs)3471         internal override bool GreaterThan(float rhs)
3472         {
3473             return m_value > rhs;
3474         }
GreaterThan(double rhs)3475         internal override bool GreaterThan(double rhs)
3476         {
3477             return m_value > rhs;
3478         }
GreaterThan(decimal rhs)3479         internal override bool GreaterThan(decimal rhs)
3480         {
3481             return m_value > rhs;
3482         }
3483 
LessThanOrEqual(Literal rhs)3484         internal override bool LessThanOrEqual(Literal rhs)
3485         {
3486             return rhs.GreaterThanOrEqual(m_value);
3487         }
LessThanOrEqual(sbyte rhs)3488         internal override bool LessThanOrEqual(sbyte rhs)
3489         {
3490             return m_value <= rhs;
3491         }
LessThanOrEqual(byte rhs)3492         internal override bool LessThanOrEqual(byte rhs)
3493         {
3494             return m_value <= rhs;
3495         }
LessThanOrEqual(short rhs)3496         internal override bool LessThanOrEqual(short rhs)
3497         {
3498             return m_value <= rhs;
3499         }
LessThanOrEqual(char rhs)3500         internal override bool LessThanOrEqual(char rhs)
3501         {
3502             return m_value <= rhs;
3503         }
LessThanOrEqual(ushort rhs)3504         internal override bool LessThanOrEqual(ushort rhs)
3505         {
3506             return m_value <= rhs;
3507         }
LessThanOrEqual(int rhs)3508         internal override bool LessThanOrEqual(int rhs)
3509         {
3510             return m_value <= rhs;
3511         }
LessThanOrEqual(uint rhs)3512         internal override bool LessThanOrEqual(uint rhs)
3513         {
3514             return m_value <= rhs;
3515         }
LessThanOrEqual(long rhs)3516         internal override bool LessThanOrEqual(long rhs)
3517         {
3518             return m_value <= rhs;
3519         }
LessThanOrEqual(ulong rhs)3520         internal override bool LessThanOrEqual(ulong rhs)
3521         {
3522             return (m_value < 0) || ((ulong)m_value <= rhs);
3523         }
LessThanOrEqual(float rhs)3524         internal override bool LessThanOrEqual(float rhs)
3525         {
3526             return m_value <= rhs;
3527         }
LessThanOrEqual(double rhs)3528         internal override bool LessThanOrEqual(double rhs)
3529         {
3530             return m_value <= rhs;
3531         }
LessThanOrEqual(decimal rhs)3532         internal override bool LessThanOrEqual(decimal rhs)
3533         {
3534             return m_value <= rhs;
3535         }
3536 
GreaterThanOrEqual(Literal rhs)3537         internal override bool GreaterThanOrEqual(Literal rhs)
3538         {
3539             return rhs.LessThanOrEqual(m_value);
3540         }
GreaterThanOrEqual(sbyte rhs)3541         internal override bool GreaterThanOrEqual(sbyte rhs)
3542         {
3543             return m_value >= rhs;
3544         }
GreaterThanOrEqual(byte rhs)3545         internal override bool GreaterThanOrEqual(byte rhs)
3546         {
3547             return m_value >= rhs;
3548         }
GreaterThanOrEqual(char rhs)3549         internal override bool GreaterThanOrEqual(char rhs)
3550         {
3551             return m_value >= rhs;
3552         }
GreaterThanOrEqual(short rhs)3553         internal override bool GreaterThanOrEqual(short rhs)
3554         {
3555             return m_value >= rhs;
3556         }
GreaterThanOrEqual(ushort rhs)3557         internal override bool GreaterThanOrEqual(ushort rhs)
3558         {
3559             return m_value >= rhs;
3560         }
GreaterThanOrEqual(int rhs)3561         internal override bool GreaterThanOrEqual(int rhs)
3562         {
3563             return m_value >= rhs;
3564         }
GreaterThanOrEqual(uint rhs)3565         internal override bool GreaterThanOrEqual(uint rhs)
3566         {
3567             return m_value >= rhs;
3568         }
GreaterThanOrEqual(long rhs)3569         internal override bool GreaterThanOrEqual(long rhs)
3570         {
3571             return m_value >= rhs;
3572         }
GreaterThanOrEqual(ulong rhs)3573         internal override bool GreaterThanOrEqual(ulong rhs)
3574         {
3575             return (m_value >= 0) && ((ulong)m_value >= rhs);
3576         }
GreaterThanOrEqual(float rhs)3577         internal override bool GreaterThanOrEqual(float rhs)
3578         {
3579             return m_value >= rhs;
3580         }
GreaterThanOrEqual(double rhs)3581         internal override bool GreaterThanOrEqual(double rhs)
3582         {
3583             return m_value >= rhs;
3584         }
GreaterThanOrEqual(decimal rhs)3585         internal override bool GreaterThanOrEqual(decimal rhs)
3586         {
3587             return m_value >= rhs;
3588         }
3589     }
3590     #endregion
3591 
3592     #region UInt16 Literal Class
3593     /// <summary>
3594     /// Represents an UInt16 literal
3595     /// </summary>
3596     internal class UShortLiteral : Literal
3597     {
3598         private ushort m_value;
3599 
3600         internal override object Value
3601         {
3602             get { return m_value; }
3603         }
3604 
UShortLiteral(ushort literalValue)3605         internal UShortLiteral(ushort literalValue)
3606         {
3607             m_value = literalValue;
3608             m_type = typeof(ushort);
3609         }
3610 
Equal(Literal rhs)3611         internal override bool Equal(Literal rhs)
3612         {
3613             return rhs.Equal(m_value);
3614         }
Equal(sbyte rhs)3615         internal override bool Equal(sbyte rhs)
3616         {
3617             return m_value == rhs;
3618         }
Equal(byte rhs)3619         internal override bool Equal(byte rhs)
3620         {
3621             return m_value == rhs;
3622         }
Equal(char rhs)3623         internal override bool Equal(char rhs)
3624         {
3625             return m_value == rhs;
3626         }
Equal(short rhs)3627         internal override bool Equal(short rhs)
3628         {
3629             return m_value == rhs;
3630         }
Equal(ushort rhs)3631         internal override bool Equal(ushort rhs)
3632         {
3633             return m_value == rhs;
3634         }
Equal(int rhs)3635         internal override bool Equal(int rhs)
3636         {
3637             return m_value == rhs;
3638         }
Equal(uint rhs)3639         internal override bool Equal(uint rhs)
3640         {
3641             return m_value == rhs;
3642         }
Equal(long rhs)3643         internal override bool Equal(long rhs)
3644         {
3645             return m_value == rhs;
3646         }
Equal(ulong rhs)3647         internal override bool Equal(ulong rhs)
3648         {
3649             return m_value == rhs;
3650         }
Equal(float rhs)3651         internal override bool Equal(float rhs)
3652         {
3653             return m_value == rhs;
3654         }
Equal(double rhs)3655         internal override bool Equal(double rhs)
3656         {
3657             return m_value == rhs;
3658         }
Equal(decimal rhs)3659         internal override bool Equal(decimal rhs)
3660         {
3661             return m_value == rhs;
3662         }
3663 
LessThan(Literal rhs)3664         internal override bool LessThan(Literal rhs)
3665         {
3666             return rhs.GreaterThan(m_value);
3667         }
LessThan(sbyte rhs)3668         internal override bool LessThan(sbyte rhs)
3669         {
3670             return m_value < rhs;
3671         }
LessThan(byte rhs)3672         internal override bool LessThan(byte rhs)
3673         {
3674             return m_value < rhs;
3675         }
LessThan(char rhs)3676         internal override bool LessThan(char rhs)
3677         {
3678             return m_value < rhs;
3679         }
LessThan(short rhs)3680         internal override bool LessThan(short rhs)
3681         {
3682             return m_value < rhs;
3683         }
LessThan(ushort rhs)3684         internal override bool LessThan(ushort rhs)
3685         {
3686             return m_value < rhs;
3687         }
LessThan(int rhs)3688         internal override bool LessThan(int rhs)
3689         {
3690             return m_value < rhs;
3691         }
LessThan(uint rhs)3692         internal override bool LessThan(uint rhs)
3693         {
3694             return m_value < rhs;
3695         }
LessThan(long rhs)3696         internal override bool LessThan(long rhs)
3697         {
3698             return m_value < rhs;
3699         }
LessThan(ulong rhs)3700         internal override bool LessThan(ulong rhs)
3701         {
3702             return m_value < rhs;
3703         }
LessThan(float rhs)3704         internal override bool LessThan(float rhs)
3705         {
3706             return m_value < rhs;
3707         }
LessThan(double rhs)3708         internal override bool LessThan(double rhs)
3709         {
3710             return m_value < rhs;
3711         }
LessThan(decimal rhs)3712         internal override bool LessThan(decimal rhs)
3713         {
3714             return m_value < rhs;
3715         }
3716 
GreaterThan(Literal rhs)3717         internal override bool GreaterThan(Literal rhs)
3718         {
3719             return rhs.LessThan(m_value);
3720         }
GreaterThan(sbyte rhs)3721         internal override bool GreaterThan(sbyte rhs)
3722         {
3723             return m_value > rhs;
3724         }
GreaterThan(byte rhs)3725         internal override bool GreaterThan(byte rhs)
3726         {
3727             return m_value > rhs;
3728         }
GreaterThan(char rhs)3729         internal override bool GreaterThan(char rhs)
3730         {
3731             return m_value > rhs;
3732         }
GreaterThan(short rhs)3733         internal override bool GreaterThan(short rhs)
3734         {
3735             return m_value > rhs;
3736         }
GreaterThan(ushort rhs)3737         internal override bool GreaterThan(ushort rhs)
3738         {
3739             return m_value > rhs;
3740         }
GreaterThan(int rhs)3741         internal override bool GreaterThan(int rhs)
3742         {
3743             return m_value > rhs;
3744         }
GreaterThan(uint rhs)3745         internal override bool GreaterThan(uint rhs)
3746         {
3747             return m_value > rhs;
3748         }
GreaterThan(long rhs)3749         internal override bool GreaterThan(long rhs)
3750         {
3751             return m_value > rhs;
3752         }
GreaterThan(ulong rhs)3753         internal override bool GreaterThan(ulong rhs)
3754         {
3755             return m_value > rhs;
3756         }
GreaterThan(float rhs)3757         internal override bool GreaterThan(float rhs)
3758         {
3759             return m_value > rhs;
3760         }
GreaterThan(double rhs)3761         internal override bool GreaterThan(double rhs)
3762         {
3763             return m_value > rhs;
3764         }
GreaterThan(decimal rhs)3765         internal override bool GreaterThan(decimal rhs)
3766         {
3767             return m_value > rhs;
3768         }
3769 
LessThanOrEqual(Literal rhs)3770         internal override bool LessThanOrEqual(Literal rhs)
3771         {
3772             return rhs.GreaterThanOrEqual(m_value);
3773         }
LessThanOrEqual(sbyte rhs)3774         internal override bool LessThanOrEqual(sbyte rhs)
3775         {
3776             return m_value <= rhs;
3777         }
LessThanOrEqual(byte rhs)3778         internal override bool LessThanOrEqual(byte rhs)
3779         {
3780             return m_value <= rhs;
3781         }
LessThanOrEqual(short rhs)3782         internal override bool LessThanOrEqual(short rhs)
3783         {
3784             return m_value <= rhs;
3785         }
LessThanOrEqual(char rhs)3786         internal override bool LessThanOrEqual(char rhs)
3787         {
3788             return m_value <= rhs;
3789         }
LessThanOrEqual(ushort rhs)3790         internal override bool LessThanOrEqual(ushort rhs)
3791         {
3792             return m_value <= rhs;
3793         }
LessThanOrEqual(int rhs)3794         internal override bool LessThanOrEqual(int rhs)
3795         {
3796             return m_value <= rhs;
3797         }
LessThanOrEqual(uint rhs)3798         internal override bool LessThanOrEqual(uint rhs)
3799         {
3800             return m_value <= rhs;
3801         }
LessThanOrEqual(long rhs)3802         internal override bool LessThanOrEqual(long rhs)
3803         {
3804             return m_value <= rhs;
3805         }
LessThanOrEqual(ulong rhs)3806         internal override bool LessThanOrEqual(ulong rhs)
3807         {
3808             return m_value <= rhs;
3809         }
LessThanOrEqual(float rhs)3810         internal override bool LessThanOrEqual(float rhs)
3811         {
3812             return m_value <= rhs;
3813         }
LessThanOrEqual(double rhs)3814         internal override bool LessThanOrEqual(double rhs)
3815         {
3816             return m_value <= rhs;
3817         }
LessThanOrEqual(decimal rhs)3818         internal override bool LessThanOrEqual(decimal rhs)
3819         {
3820             return m_value <= rhs;
3821         }
3822 
GreaterThanOrEqual(Literal rhs)3823         internal override bool GreaterThanOrEqual(Literal rhs)
3824         {
3825             return rhs.LessThanOrEqual(m_value);
3826         }
GreaterThanOrEqual(sbyte rhs)3827         internal override bool GreaterThanOrEqual(sbyte rhs)
3828         {
3829             return m_value >= rhs;
3830         }
GreaterThanOrEqual(byte rhs)3831         internal override bool GreaterThanOrEqual(byte rhs)
3832         {
3833             return m_value >= rhs;
3834         }
GreaterThanOrEqual(char rhs)3835         internal override bool GreaterThanOrEqual(char rhs)
3836         {
3837             return m_value >= rhs;
3838         }
GreaterThanOrEqual(short rhs)3839         internal override bool GreaterThanOrEqual(short rhs)
3840         {
3841             return m_value >= rhs;
3842         }
GreaterThanOrEqual(ushort rhs)3843         internal override bool GreaterThanOrEqual(ushort rhs)
3844         {
3845             return m_value >= rhs;
3846         }
GreaterThanOrEqual(int rhs)3847         internal override bool GreaterThanOrEqual(int rhs)
3848         {
3849             return m_value >= rhs;
3850         }
GreaterThanOrEqual(uint rhs)3851         internal override bool GreaterThanOrEqual(uint rhs)
3852         {
3853             return m_value >= rhs;
3854         }
GreaterThanOrEqual(long rhs)3855         internal override bool GreaterThanOrEqual(long rhs)
3856         {
3857             return m_value >= rhs;
3858         }
GreaterThanOrEqual(ulong rhs)3859         internal override bool GreaterThanOrEqual(ulong rhs)
3860         {
3861             return m_value >= rhs;
3862         }
GreaterThanOrEqual(float rhs)3863         internal override bool GreaterThanOrEqual(float rhs)
3864         {
3865             return m_value >= rhs;
3866         }
GreaterThanOrEqual(double rhs)3867         internal override bool GreaterThanOrEqual(double rhs)
3868         {
3869             return m_value >= rhs;
3870         }
GreaterThanOrEqual(decimal rhs)3871         internal override bool GreaterThanOrEqual(decimal rhs)
3872         {
3873             return m_value >= rhs;
3874         }
3875     }
3876     #endregion
3877 
3878     #region UInt32 Literal Class
3879     /// <summary>
3880     /// Represents an UInt32 literal
3881     /// </summary>
3882     internal class UIntLiteral : Literal
3883     {
3884         private uint m_value;
3885 
3886         internal override object Value
3887         {
3888             get { return m_value; }
3889         }
3890 
UIntLiteral(uint literalValue)3891         internal UIntLiteral(uint literalValue)
3892         {
3893             m_value = literalValue;
3894             m_type = typeof(uint);
3895         }
3896 
Equal(Literal rhs)3897         internal override bool Equal(Literal rhs)
3898         {
3899             return rhs.Equal(m_value);
3900         }
Equal(sbyte rhs)3901         internal override bool Equal(sbyte rhs)
3902         {
3903             return m_value == rhs;
3904         }
Equal(byte rhs)3905         internal override bool Equal(byte rhs)
3906         {
3907             return m_value == rhs;
3908         }
Equal(char rhs)3909         internal override bool Equal(char rhs)
3910         {
3911             return m_value == rhs;
3912         }
Equal(short rhs)3913         internal override bool Equal(short rhs)
3914         {
3915             return m_value == rhs;
3916         }
Equal(ushort rhs)3917         internal override bool Equal(ushort rhs)
3918         {
3919             return m_value == rhs;
3920         }
Equal(int rhs)3921         internal override bool Equal(int rhs)
3922         {
3923             return m_value == rhs;
3924         }
Equal(uint rhs)3925         internal override bool Equal(uint rhs)
3926         {
3927             return m_value == rhs;
3928         }
Equal(long rhs)3929         internal override bool Equal(long rhs)
3930         {
3931             return m_value == rhs;
3932         }
Equal(ulong rhs)3933         internal override bool Equal(ulong rhs)
3934         {
3935             return m_value == rhs;
3936         }
Equal(float rhs)3937         internal override bool Equal(float rhs)
3938         {
3939             return m_value == rhs;
3940         }
Equal(double rhs)3941         internal override bool Equal(double rhs)
3942         {
3943             return m_value == rhs;
3944         }
Equal(decimal rhs)3945         internal override bool Equal(decimal rhs)
3946         {
3947             return m_value == rhs;
3948         }
3949 
LessThan(Literal rhs)3950         internal override bool LessThan(Literal rhs)
3951         {
3952             return rhs.GreaterThan(m_value);
3953         }
LessThan(sbyte rhs)3954         internal override bool LessThan(sbyte rhs)
3955         {
3956             return m_value < rhs;
3957         }
LessThan(byte rhs)3958         internal override bool LessThan(byte rhs)
3959         {
3960             return m_value < rhs;
3961         }
LessThan(char rhs)3962         internal override bool LessThan(char rhs)
3963         {
3964             return m_value < rhs;
3965         }
LessThan(short rhs)3966         internal override bool LessThan(short rhs)
3967         {
3968             return m_value < rhs;
3969         }
LessThan(ushort rhs)3970         internal override bool LessThan(ushort rhs)
3971         {
3972             return m_value < rhs;
3973         }
LessThan(int rhs)3974         internal override bool LessThan(int rhs)
3975         {
3976             return m_value < rhs;
3977         }
LessThan(uint rhs)3978         internal override bool LessThan(uint rhs)
3979         {
3980             return m_value < rhs;
3981         }
LessThan(long rhs)3982         internal override bool LessThan(long rhs)
3983         {
3984             return m_value < rhs;
3985         }
LessThan(ulong rhs)3986         internal override bool LessThan(ulong rhs)
3987         {
3988             return m_value < rhs;
3989         }
LessThan(float rhs)3990         internal override bool LessThan(float rhs)
3991         {
3992             return m_value < rhs;
3993         }
LessThan(double rhs)3994         internal override bool LessThan(double rhs)
3995         {
3996             return m_value < rhs;
3997         }
LessThan(decimal rhs)3998         internal override bool LessThan(decimal rhs)
3999         {
4000             return m_value < rhs;
4001         }
4002 
GreaterThan(Literal rhs)4003         internal override bool GreaterThan(Literal rhs)
4004         {
4005             return rhs.LessThan(m_value);
4006         }
GreaterThan(sbyte rhs)4007         internal override bool GreaterThan(sbyte rhs)
4008         {
4009             return m_value > rhs;
4010         }
GreaterThan(byte rhs)4011         internal override bool GreaterThan(byte rhs)
4012         {
4013             return m_value > rhs;
4014         }
GreaterThan(char rhs)4015         internal override bool GreaterThan(char rhs)
4016         {
4017             return m_value > rhs;
4018         }
GreaterThan(short rhs)4019         internal override bool GreaterThan(short rhs)
4020         {
4021             return m_value > rhs;
4022         }
GreaterThan(ushort rhs)4023         internal override bool GreaterThan(ushort rhs)
4024         {
4025             return m_value > rhs;
4026         }
GreaterThan(int rhs)4027         internal override bool GreaterThan(int rhs)
4028         {
4029             return m_value > rhs;
4030         }
GreaterThan(uint rhs)4031         internal override bool GreaterThan(uint rhs)
4032         {
4033             return m_value > rhs;
4034         }
GreaterThan(long rhs)4035         internal override bool GreaterThan(long rhs)
4036         {
4037             return m_value > rhs;
4038         }
GreaterThan(ulong rhs)4039         internal override bool GreaterThan(ulong rhs)
4040         {
4041             return m_value > rhs;
4042         }
GreaterThan(float rhs)4043         internal override bool GreaterThan(float rhs)
4044         {
4045             return m_value > rhs;
4046         }
GreaterThan(double rhs)4047         internal override bool GreaterThan(double rhs)
4048         {
4049             return m_value > rhs;
4050         }
GreaterThan(decimal rhs)4051         internal override bool GreaterThan(decimal rhs)
4052         {
4053             return m_value > rhs;
4054         }
4055 
LessThanOrEqual(Literal rhs)4056         internal override bool LessThanOrEqual(Literal rhs)
4057         {
4058             return rhs.GreaterThanOrEqual(m_value);
4059         }
LessThanOrEqual(sbyte rhs)4060         internal override bool LessThanOrEqual(sbyte rhs)
4061         {
4062             return m_value <= rhs;
4063         }
LessThanOrEqual(byte rhs)4064         internal override bool LessThanOrEqual(byte rhs)
4065         {
4066             return m_value <= rhs;
4067         }
LessThanOrEqual(short rhs)4068         internal override bool LessThanOrEqual(short rhs)
4069         {
4070             return m_value <= rhs;
4071         }
LessThanOrEqual(char rhs)4072         internal override bool LessThanOrEqual(char rhs)
4073         {
4074             return m_value <= rhs;
4075         }
LessThanOrEqual(ushort rhs)4076         internal override bool LessThanOrEqual(ushort rhs)
4077         {
4078             return m_value <= rhs;
4079         }
LessThanOrEqual(int rhs)4080         internal override bool LessThanOrEqual(int rhs)
4081         {
4082             return m_value <= rhs;
4083         }
LessThanOrEqual(uint rhs)4084         internal override bool LessThanOrEqual(uint rhs)
4085         {
4086             return m_value <= rhs;
4087         }
LessThanOrEqual(long rhs)4088         internal override bool LessThanOrEqual(long rhs)
4089         {
4090             return m_value <= rhs;
4091         }
LessThanOrEqual(ulong rhs)4092         internal override bool LessThanOrEqual(ulong rhs)
4093         {
4094             return m_value <= rhs;
4095         }
LessThanOrEqual(float rhs)4096         internal override bool LessThanOrEqual(float rhs)
4097         {
4098             return m_value <= rhs;
4099         }
LessThanOrEqual(double rhs)4100         internal override bool LessThanOrEqual(double rhs)
4101         {
4102             return m_value <= rhs;
4103         }
LessThanOrEqual(decimal rhs)4104         internal override bool LessThanOrEqual(decimal rhs)
4105         {
4106             return m_value <= rhs;
4107         }
4108 
GreaterThanOrEqual(Literal rhs)4109         internal override bool GreaterThanOrEqual(Literal rhs)
4110         {
4111             return rhs.LessThanOrEqual(m_value);
4112         }
GreaterThanOrEqual(sbyte rhs)4113         internal override bool GreaterThanOrEqual(sbyte rhs)
4114         {
4115             return m_value >= rhs;
4116         }
GreaterThanOrEqual(byte rhs)4117         internal override bool GreaterThanOrEqual(byte rhs)
4118         {
4119             return m_value >= rhs;
4120         }
GreaterThanOrEqual(char rhs)4121         internal override bool GreaterThanOrEqual(char rhs)
4122         {
4123             return m_value >= rhs;
4124         }
GreaterThanOrEqual(short rhs)4125         internal override bool GreaterThanOrEqual(short rhs)
4126         {
4127             return m_value >= rhs;
4128         }
GreaterThanOrEqual(ushort rhs)4129         internal override bool GreaterThanOrEqual(ushort rhs)
4130         {
4131             return m_value >= rhs;
4132         }
GreaterThanOrEqual(int rhs)4133         internal override bool GreaterThanOrEqual(int rhs)
4134         {
4135             return m_value >= rhs;
4136         }
GreaterThanOrEqual(uint rhs)4137         internal override bool GreaterThanOrEqual(uint rhs)
4138         {
4139             return m_value >= rhs;
4140         }
GreaterThanOrEqual(long rhs)4141         internal override bool GreaterThanOrEqual(long rhs)
4142         {
4143             return m_value >= rhs;
4144         }
GreaterThanOrEqual(ulong rhs)4145         internal override bool GreaterThanOrEqual(ulong rhs)
4146         {
4147             return m_value >= rhs;
4148         }
GreaterThanOrEqual(float rhs)4149         internal override bool GreaterThanOrEqual(float rhs)
4150         {
4151             return m_value >= rhs;
4152         }
GreaterThanOrEqual(double rhs)4153         internal override bool GreaterThanOrEqual(double rhs)
4154         {
4155             return m_value >= rhs;
4156         }
GreaterThanOrEqual(decimal rhs)4157         internal override bool GreaterThanOrEqual(decimal rhs)
4158         {
4159             return m_value >= rhs;
4160         }
4161     }
4162     #endregion
4163 
4164     #region UInt64 Literal Class
4165     /// <summary>
4166     /// Represents an UInt64 literal
4167     /// </summary>
4168     internal class ULongLiteral : Literal
4169     {
4170         private ulong m_value;
4171 
4172         internal override object Value
4173         {
4174             get { return m_value; }
4175         }
4176 
ULongLiteral(ulong literalValue)4177         internal ULongLiteral(ulong literalValue)
4178         {
4179             m_value = literalValue;
4180             m_type = typeof(ulong);
4181         }
4182 
Equal(Literal rhs)4183         internal override bool Equal(Literal rhs)
4184         {
4185             return rhs.Equal(m_value);
4186         }
Equal(byte rhs)4187         internal override bool Equal(byte rhs)
4188         {
4189             return m_value == rhs;
4190         }
Equal(sbyte rhs)4191         internal override bool Equal(sbyte rhs)
4192         {
4193             return (rhs >= 0) && (m_value == (ulong)rhs);
4194         }
Equal(short rhs)4195         internal override bool Equal(short rhs)
4196         {
4197             return (rhs >= 0) && (m_value == (ulong)rhs);
4198         }
Equal(int rhs)4199         internal override bool Equal(int rhs)
4200         {
4201             return (rhs >= 0) && (m_value == (ulong)rhs);
4202         }
Equal(long rhs)4203         internal override bool Equal(long rhs)
4204         {
4205             return (rhs >= 0) && (m_value == (ulong)rhs);
4206         }
Equal(char rhs)4207         internal override bool Equal(char rhs)
4208         {
4209             return m_value == rhs;
4210         }
Equal(ushort rhs)4211         internal override bool Equal(ushort rhs)
4212         {
4213             return m_value == rhs;
4214         }
Equal(uint rhs)4215         internal override bool Equal(uint rhs)
4216         {
4217             return m_value == rhs;
4218         }
Equal(ulong rhs)4219         internal override bool Equal(ulong rhs)
4220         {
4221             return m_value == rhs;
4222         }
Equal(float rhs)4223         internal override bool Equal(float rhs)
4224         {
4225             return m_value == rhs;
4226         }
Equal(double rhs)4227         internal override bool Equal(double rhs)
4228         {
4229             return m_value == rhs;
4230         }
Equal(decimal rhs)4231         internal override bool Equal(decimal rhs)
4232         {
4233             return m_value == rhs;
4234         }
4235 
LessThan(Literal rhs)4236         internal override bool LessThan(Literal rhs)
4237         {
4238             return rhs.GreaterThan(m_value);
4239         }
LessThan(byte rhs)4240         internal override bool LessThan(byte rhs)
4241         {
4242             return m_value < rhs;
4243         }
LessThan(int rhs)4244         internal override bool LessThan(int rhs)
4245         {
4246             return (rhs >= 0) && (m_value < (ulong)rhs);
4247         }
LessThan(long rhs)4248         internal override bool LessThan(long rhs)
4249         {
4250             return (rhs >= 0) && (m_value < (ulong)rhs);
4251         }
LessThan(char rhs)4252         internal override bool LessThan(char rhs)
4253         {
4254             return m_value < rhs;
4255         }
LessThan(ushort rhs)4256         internal override bool LessThan(ushort rhs)
4257         {
4258             return m_value < rhs;
4259         }
LessThan(uint rhs)4260         internal override bool LessThan(uint rhs)
4261         {
4262             return m_value < rhs;
4263         }
LessThan(ulong rhs)4264         internal override bool LessThan(ulong rhs)
4265         {
4266             return m_value < rhs;
4267         }
LessThan(float rhs)4268         internal override bool LessThan(float rhs)
4269         {
4270             return m_value < rhs;
4271         }
LessThan(double rhs)4272         internal override bool LessThan(double rhs)
4273         {
4274             return m_value < rhs;
4275         }
LessThan(decimal rhs)4276         internal override bool LessThan(decimal rhs)
4277         {
4278             return m_value < rhs;
4279         }
4280 
GreaterThan(Literal rhs)4281         internal override bool GreaterThan(Literal rhs)
4282         {
4283             return rhs.LessThan(m_value);
4284         }
GreaterThan(byte rhs)4285         internal override bool GreaterThan(byte rhs)
4286         {
4287             return m_value > rhs;
4288         }
GreaterThan(int rhs)4289         internal override bool GreaterThan(int rhs)
4290         {
4291             return (rhs < 0) || (m_value > (ulong)rhs);
4292         }
GreaterThan(long rhs)4293         internal override bool GreaterThan(long rhs)
4294         {
4295             return (rhs < 0) || (m_value > (ulong)rhs);
4296         }
GreaterThan(char rhs)4297         internal override bool GreaterThan(char rhs)
4298         {
4299             return m_value > rhs;
4300         }
GreaterThan(ushort rhs)4301         internal override bool GreaterThan(ushort rhs)
4302         {
4303             return m_value > rhs;
4304         }
GreaterThan(uint rhs)4305         internal override bool GreaterThan(uint rhs)
4306         {
4307             return m_value > rhs;
4308         }
GreaterThan(ulong rhs)4309         internal override bool GreaterThan(ulong rhs)
4310         {
4311             return m_value > rhs;
4312         }
GreaterThan(float rhs)4313         internal override bool GreaterThan(float rhs)
4314         {
4315             return m_value > rhs;
4316         }
GreaterThan(double rhs)4317         internal override bool GreaterThan(double rhs)
4318         {
4319             return m_value > rhs;
4320         }
GreaterThan(decimal rhs)4321         internal override bool GreaterThan(decimal rhs)
4322         {
4323             return m_value > rhs;
4324         }
4325 
LessThanOrEqual(Literal rhs)4326         internal override bool LessThanOrEqual(Literal rhs)
4327         {
4328             return rhs.GreaterThanOrEqual(m_value);
4329         }
LessThanOrEqual(byte rhs)4330         internal override bool LessThanOrEqual(byte rhs)
4331         {
4332             return m_value <= rhs;
4333         }
LessThanOrEqual(int rhs)4334         internal override bool LessThanOrEqual(int rhs)
4335         {
4336             return (rhs >= 0) && (m_value <= (ulong)rhs);
4337         }
LessThanOrEqual(long rhs)4338         internal override bool LessThanOrEqual(long rhs)
4339         {
4340             return (rhs >= 0) && (m_value <= (ulong)rhs);
4341         }
LessThanOrEqual(char rhs)4342         internal override bool LessThanOrEqual(char rhs)
4343         {
4344             return m_value <= rhs;
4345         }
LessThanOrEqual(ushort rhs)4346         internal override bool LessThanOrEqual(ushort rhs)
4347         {
4348             return m_value <= rhs;
4349         }
LessThanOrEqual(uint rhs)4350         internal override bool LessThanOrEqual(uint rhs)
4351         {
4352             return m_value <= rhs;
4353         }
LessThanOrEqual(ulong rhs)4354         internal override bool LessThanOrEqual(ulong rhs)
4355         {
4356             return m_value <= rhs;
4357         }
LessThanOrEqual(float rhs)4358         internal override bool LessThanOrEqual(float rhs)
4359         {
4360             return m_value <= rhs;
4361         }
LessThanOrEqual(double rhs)4362         internal override bool LessThanOrEqual(double rhs)
4363         {
4364             return m_value <= rhs;
4365         }
LessThanOrEqual(decimal rhs)4366         internal override bool LessThanOrEqual(decimal rhs)
4367         {
4368             return m_value <= rhs;
4369         }
4370 
GreaterThanOrEqual(Literal rhs)4371         internal override bool GreaterThanOrEqual(Literal rhs)
4372         {
4373             return rhs.LessThanOrEqual(m_value);
4374         }
GreaterThanOrEqual(byte rhs)4375         internal override bool GreaterThanOrEqual(byte rhs)
4376         {
4377             return m_value >= rhs;
4378         }
GreaterThanOrEqual(int rhs)4379         internal override bool GreaterThanOrEqual(int rhs)
4380         {
4381             return (rhs < 0) || (m_value >= (ulong)rhs);
4382         }
GreaterThanOrEqual(long rhs)4383         internal override bool GreaterThanOrEqual(long rhs)
4384         {
4385             return (rhs < 0) || (m_value >= (ulong)rhs);
4386         }
GreaterThanOrEqual(char rhs)4387         internal override bool GreaterThanOrEqual(char rhs)
4388         {
4389             return m_value >= rhs;
4390         }
GreaterThanOrEqual(ushort rhs)4391         internal override bool GreaterThanOrEqual(ushort rhs)
4392         {
4393             return m_value >= rhs;
4394         }
GreaterThanOrEqual(uint rhs)4395         internal override bool GreaterThanOrEqual(uint rhs)
4396         {
4397             return m_value >= rhs;
4398         }
GreaterThanOrEqual(ulong rhs)4399         internal override bool GreaterThanOrEqual(ulong rhs)
4400         {
4401             return m_value >= rhs;
4402         }
GreaterThanOrEqual(float rhs)4403         internal override bool GreaterThanOrEqual(float rhs)
4404         {
4405             return m_value >= rhs;
4406         }
GreaterThanOrEqual(double rhs)4407         internal override bool GreaterThanOrEqual(double rhs)
4408         {
4409             return m_value >= rhs;
4410         }
GreaterThanOrEqual(decimal rhs)4411         internal override bool GreaterThanOrEqual(decimal rhs)
4412         {
4413             return m_value >= rhs;
4414         }
4415     }
4416     #endregion
4417 
4418     #region Double Literal Class
4419     /// <summary>
4420     /// Represents a double literal
4421     /// </summary>
4422     internal class DoubleLiteral : Literal
4423     {
4424         private double m_value;
4425 
4426         internal override object Value
4427         {
4428             get { return m_value; }
4429         }
4430 
DoubleLiteral(double literalValue)4431         internal DoubleLiteral(double literalValue)
4432         {
4433             m_value = literalValue;
4434             m_type = typeof(double);
4435         }
4436 
Equal(Literal rhs)4437         internal override bool Equal(Literal rhs)
4438         {
4439             return rhs.Equal(m_value);
4440         }
Equal(sbyte rhs)4441         internal override bool Equal(sbyte rhs)
4442         {
4443             return m_value == rhs;
4444         }
Equal(byte rhs)4445         internal override bool Equal(byte rhs)
4446         {
4447             return m_value == rhs;
4448         }
Equal(char rhs)4449         internal override bool Equal(char rhs)
4450         {
4451             return m_value == rhs;
4452         }
Equal(short rhs)4453         internal override bool Equal(short rhs)
4454         {
4455             return m_value == rhs;
4456         }
Equal(ushort rhs)4457         internal override bool Equal(ushort rhs)
4458         {
4459             return m_value == rhs;
4460         }
Equal(int rhs)4461         internal override bool Equal(int rhs)
4462         {
4463             return m_value == rhs;
4464         }
Equal(uint rhs)4465         internal override bool Equal(uint rhs)
4466         {
4467             return m_value == rhs;
4468         }
Equal(long rhs)4469         internal override bool Equal(long rhs)
4470         {
4471             return m_value == rhs;
4472         }
Equal(ulong rhs)4473         internal override bool Equal(ulong rhs)
4474         {
4475             return m_value == rhs;
4476         }
Equal(float rhs)4477         internal override bool Equal(float rhs)
4478         {
4479             return m_value == rhs;
4480         }
Equal(double rhs)4481         internal override bool Equal(double rhs)
4482         {
4483             return m_value == rhs;
4484         }
4485 
LessThan(Literal rhs)4486         internal override bool LessThan(Literal rhs)
4487         {
4488             return rhs.GreaterThan(m_value);
4489         }
LessThan(sbyte rhs)4490         internal override bool LessThan(sbyte rhs)
4491         {
4492             return m_value < rhs;
4493         }
LessThan(byte rhs)4494         internal override bool LessThan(byte rhs)
4495         {
4496             return m_value < rhs;
4497         }
LessThan(char rhs)4498         internal override bool LessThan(char rhs)
4499         {
4500             return m_value < rhs;
4501         }
LessThan(short rhs)4502         internal override bool LessThan(short rhs)
4503         {
4504             return m_value < rhs;
4505         }
LessThan(ushort rhs)4506         internal override bool LessThan(ushort rhs)
4507         {
4508             return m_value < rhs;
4509         }
LessThan(int rhs)4510         internal override bool LessThan(int rhs)
4511         {
4512             return m_value < rhs;
4513         }
LessThan(uint rhs)4514         internal override bool LessThan(uint rhs)
4515         {
4516             return m_value < rhs;
4517         }
LessThan(long rhs)4518         internal override bool LessThan(long rhs)
4519         {
4520             return m_value < rhs;
4521         }
LessThan(ulong rhs)4522         internal override bool LessThan(ulong rhs)
4523         {
4524             return m_value < rhs;
4525         }
LessThan(float rhs)4526         internal override bool LessThan(float rhs)
4527         {
4528             return m_value < rhs;
4529         }
LessThan(double rhs)4530         internal override bool LessThan(double rhs)
4531         {
4532             return m_value < rhs;
4533         }
4534 
GreaterThan(Literal rhs)4535         internal override bool GreaterThan(Literal rhs)
4536         {
4537             return rhs.LessThan(m_value);
4538         }
GreaterThan(sbyte rhs)4539         internal override bool GreaterThan(sbyte rhs)
4540         {
4541             return m_value > rhs;
4542         }
GreaterThan(byte rhs)4543         internal override bool GreaterThan(byte rhs)
4544         {
4545             return m_value > rhs;
4546         }
GreaterThan(char rhs)4547         internal override bool GreaterThan(char rhs)
4548         {
4549             return m_value > rhs;
4550         }
GreaterThan(short rhs)4551         internal override bool GreaterThan(short rhs)
4552         {
4553             return m_value > rhs;
4554         }
GreaterThan(ushort rhs)4555         internal override bool GreaterThan(ushort rhs)
4556         {
4557             return m_value > rhs;
4558         }
GreaterThan(int rhs)4559         internal override bool GreaterThan(int rhs)
4560         {
4561             return m_value > rhs;
4562         }
GreaterThan(uint rhs)4563         internal override bool GreaterThan(uint rhs)
4564         {
4565             return m_value > rhs;
4566         }
GreaterThan(long rhs)4567         internal override bool GreaterThan(long rhs)
4568         {
4569             return m_value > rhs;
4570         }
GreaterThan(ulong rhs)4571         internal override bool GreaterThan(ulong rhs)
4572         {
4573             return m_value > rhs;
4574         }
GreaterThan(float rhs)4575         internal override bool GreaterThan(float rhs)
4576         {
4577             return m_value > rhs;
4578         }
GreaterThan(double rhs)4579         internal override bool GreaterThan(double rhs)
4580         {
4581             return m_value > rhs;
4582         }
4583 
LessThanOrEqual(Literal rhs)4584         internal override bool LessThanOrEqual(Literal rhs)
4585         {
4586             return rhs.GreaterThanOrEqual(m_value);
4587         }
LessThanOrEqual(sbyte rhs)4588         internal override bool LessThanOrEqual(sbyte rhs)
4589         {
4590             return m_value <= rhs;
4591         }
LessThanOrEqual(byte rhs)4592         internal override bool LessThanOrEqual(byte rhs)
4593         {
4594             return m_value <= rhs;
4595         }
LessThanOrEqual(short rhs)4596         internal override bool LessThanOrEqual(short rhs)
4597         {
4598             return m_value <= rhs;
4599         }
LessThanOrEqual(char rhs)4600         internal override bool LessThanOrEqual(char rhs)
4601         {
4602             return m_value <= rhs;
4603         }
LessThanOrEqual(ushort rhs)4604         internal override bool LessThanOrEqual(ushort rhs)
4605         {
4606             return m_value <= rhs;
4607         }
LessThanOrEqual(int rhs)4608         internal override bool LessThanOrEqual(int rhs)
4609         {
4610             return m_value <= rhs;
4611         }
LessThanOrEqual(uint rhs)4612         internal override bool LessThanOrEqual(uint rhs)
4613         {
4614             return m_value <= rhs;
4615         }
LessThanOrEqual(long rhs)4616         internal override bool LessThanOrEqual(long rhs)
4617         {
4618             return m_value <= rhs;
4619         }
LessThanOrEqual(ulong rhs)4620         internal override bool LessThanOrEqual(ulong rhs)
4621         {
4622             return m_value <= rhs;
4623         }
LessThanOrEqual(float rhs)4624         internal override bool LessThanOrEqual(float rhs)
4625         {
4626             return m_value <= rhs;
4627         }
LessThanOrEqual(double rhs)4628         internal override bool LessThanOrEqual(double rhs)
4629         {
4630             return m_value <= rhs;
4631         }
4632 
GreaterThanOrEqual(Literal rhs)4633         internal override bool GreaterThanOrEqual(Literal rhs)
4634         {
4635             return rhs.LessThanOrEqual(m_value);
4636         }
GreaterThanOrEqual(sbyte rhs)4637         internal override bool GreaterThanOrEqual(sbyte rhs)
4638         {
4639             return m_value >= rhs;
4640         }
GreaterThanOrEqual(byte rhs)4641         internal override bool GreaterThanOrEqual(byte rhs)
4642         {
4643             return m_value >= rhs;
4644         }
GreaterThanOrEqual(char rhs)4645         internal override bool GreaterThanOrEqual(char rhs)
4646         {
4647             return m_value >= rhs;
4648         }
GreaterThanOrEqual(short rhs)4649         internal override bool GreaterThanOrEqual(short rhs)
4650         {
4651             return m_value >= rhs;
4652         }
GreaterThanOrEqual(ushort rhs)4653         internal override bool GreaterThanOrEqual(ushort rhs)
4654         {
4655             return m_value >= rhs;
4656         }
GreaterThanOrEqual(int rhs)4657         internal override bool GreaterThanOrEqual(int rhs)
4658         {
4659             return m_value >= rhs;
4660         }
GreaterThanOrEqual(uint rhs)4661         internal override bool GreaterThanOrEqual(uint rhs)
4662         {
4663             return m_value >= rhs;
4664         }
GreaterThanOrEqual(long rhs)4665         internal override bool GreaterThanOrEqual(long rhs)
4666         {
4667             return m_value >= rhs;
4668         }
GreaterThanOrEqual(ulong rhs)4669         internal override bool GreaterThanOrEqual(ulong rhs)
4670         {
4671             return m_value >= rhs;
4672         }
GreaterThanOrEqual(float rhs)4673         internal override bool GreaterThanOrEqual(float rhs)
4674         {
4675             return m_value >= rhs;
4676         }
GreaterThanOrEqual(double rhs)4677         internal override bool GreaterThanOrEqual(double rhs)
4678         {
4679             return m_value >= rhs;
4680         }
4681     }
4682     #endregion
4683 
4684     #region Float Literal Class
4685     /// <summary>
4686     /// Represents a float literal
4687     /// </summary>
4688     internal class FloatLiteral : Literal
4689     {
4690         private float m_value;
4691 
4692         internal override object Value
4693         {
4694             get { return m_value; }
4695         }
4696 
FloatLiteral(float literalValue)4697         internal FloatLiteral(float literalValue)
4698         {
4699             m_value = literalValue;
4700             m_type = typeof(float);
4701         }
4702 
Equal(Literal rhs)4703         internal override bool Equal(Literal rhs)
4704         {
4705             return rhs.Equal(m_value);
4706         }
Equal(sbyte rhs)4707         internal override bool Equal(sbyte rhs)
4708         {
4709             return m_value == rhs;
4710         }
Equal(byte rhs)4711         internal override bool Equal(byte rhs)
4712         {
4713             return m_value == rhs;
4714         }
Equal(char rhs)4715         internal override bool Equal(char rhs)
4716         {
4717             return m_value == rhs;
4718         }
Equal(short rhs)4719         internal override bool Equal(short rhs)
4720         {
4721             return m_value == rhs;
4722         }
Equal(ushort rhs)4723         internal override bool Equal(ushort rhs)
4724         {
4725             return m_value == rhs;
4726         }
Equal(int rhs)4727         internal override bool Equal(int rhs)
4728         {
4729             return m_value == rhs;
4730         }
Equal(uint rhs)4731         internal override bool Equal(uint rhs)
4732         {
4733             return m_value == rhs;
4734         }
Equal(long rhs)4735         internal override bool Equal(long rhs)
4736         {
4737             return m_value == rhs;
4738         }
Equal(ulong rhs)4739         internal override bool Equal(ulong rhs)
4740         {
4741             return m_value == rhs;
4742         }
Equal(float rhs)4743         internal override bool Equal(float rhs)
4744         {
4745             return m_value == rhs;
4746         }
Equal(double rhs)4747         internal override bool Equal(double rhs)
4748         {
4749             return m_value == rhs;
4750         }
4751 
LessThan(Literal rhs)4752         internal override bool LessThan(Literal rhs)
4753         {
4754             return rhs.GreaterThan(m_value);
4755         }
LessThan(sbyte rhs)4756         internal override bool LessThan(sbyte rhs)
4757         {
4758             return m_value < rhs;
4759         }
LessThan(byte rhs)4760         internal override bool LessThan(byte rhs)
4761         {
4762             return m_value < rhs;
4763         }
LessThan(char rhs)4764         internal override bool LessThan(char rhs)
4765         {
4766             return m_value < rhs;
4767         }
LessThan(short rhs)4768         internal override bool LessThan(short rhs)
4769         {
4770             return m_value < rhs;
4771         }
LessThan(ushort rhs)4772         internal override bool LessThan(ushort rhs)
4773         {
4774             return m_value < rhs;
4775         }
LessThan(int rhs)4776         internal override bool LessThan(int rhs)
4777         {
4778             return m_value < rhs;
4779         }
LessThan(uint rhs)4780         internal override bool LessThan(uint rhs)
4781         {
4782             return m_value < rhs;
4783         }
LessThan(long rhs)4784         internal override bool LessThan(long rhs)
4785         {
4786             return m_value < rhs;
4787         }
LessThan(ulong rhs)4788         internal override bool LessThan(ulong rhs)
4789         {
4790             return m_value < rhs;
4791         }
LessThan(float rhs)4792         internal override bool LessThan(float rhs)
4793         {
4794             return m_value < rhs;
4795         }
LessThan(double rhs)4796         internal override bool LessThan(double rhs)
4797         {
4798             return m_value < rhs;
4799         }
4800 
GreaterThan(Literal rhs)4801         internal override bool GreaterThan(Literal rhs)
4802         {
4803             return rhs.LessThan(m_value);
4804         }
GreaterThan(sbyte rhs)4805         internal override bool GreaterThan(sbyte rhs)
4806         {
4807             return m_value > rhs;
4808         }
GreaterThan(byte rhs)4809         internal override bool GreaterThan(byte rhs)
4810         {
4811             return m_value > rhs;
4812         }
GreaterThan(char rhs)4813         internal override bool GreaterThan(char rhs)
4814         {
4815             return m_value > rhs;
4816         }
GreaterThan(short rhs)4817         internal override bool GreaterThan(short rhs)
4818         {
4819             return m_value > rhs;
4820         }
GreaterThan(ushort rhs)4821         internal override bool GreaterThan(ushort rhs)
4822         {
4823             return m_value > rhs;
4824         }
GreaterThan(int rhs)4825         internal override bool GreaterThan(int rhs)
4826         {
4827             return m_value > rhs;
4828         }
GreaterThan(uint rhs)4829         internal override bool GreaterThan(uint rhs)
4830         {
4831             return m_value > rhs;
4832         }
GreaterThan(long rhs)4833         internal override bool GreaterThan(long rhs)
4834         {
4835             return m_value > rhs;
4836         }
GreaterThan(ulong rhs)4837         internal override bool GreaterThan(ulong rhs)
4838         {
4839             return m_value > rhs;
4840         }
GreaterThan(float rhs)4841         internal override bool GreaterThan(float rhs)
4842         {
4843             return m_value > rhs;
4844         }
GreaterThan(double rhs)4845         internal override bool GreaterThan(double rhs)
4846         {
4847             return m_value > rhs;
4848         }
4849 
LessThanOrEqual(Literal rhs)4850         internal override bool LessThanOrEqual(Literal rhs)
4851         {
4852             return rhs.GreaterThanOrEqual(m_value);
4853         }
LessThanOrEqual(sbyte rhs)4854         internal override bool LessThanOrEqual(sbyte rhs)
4855         {
4856             return m_value <= rhs;
4857         }
LessThanOrEqual(byte rhs)4858         internal override bool LessThanOrEqual(byte rhs)
4859         {
4860             return m_value <= rhs;
4861         }
LessThanOrEqual(short rhs)4862         internal override bool LessThanOrEqual(short rhs)
4863         {
4864             return m_value <= rhs;
4865         }
LessThanOrEqual(char rhs)4866         internal override bool LessThanOrEqual(char rhs)
4867         {
4868             return m_value <= rhs;
4869         }
LessThanOrEqual(ushort rhs)4870         internal override bool LessThanOrEqual(ushort rhs)
4871         {
4872             return m_value <= rhs;
4873         }
LessThanOrEqual(int rhs)4874         internal override bool LessThanOrEqual(int rhs)
4875         {
4876             return m_value <= rhs;
4877         }
LessThanOrEqual(uint rhs)4878         internal override bool LessThanOrEqual(uint rhs)
4879         {
4880             return m_value <= rhs;
4881         }
LessThanOrEqual(long rhs)4882         internal override bool LessThanOrEqual(long rhs)
4883         {
4884             return m_value <= rhs;
4885         }
LessThanOrEqual(ulong rhs)4886         internal override bool LessThanOrEqual(ulong rhs)
4887         {
4888             return m_value <= rhs;
4889         }
LessThanOrEqual(float rhs)4890         internal override bool LessThanOrEqual(float rhs)
4891         {
4892             return m_value <= rhs;
4893         }
LessThanOrEqual(double rhs)4894         internal override bool LessThanOrEqual(double rhs)
4895         {
4896             return m_value <= rhs;
4897         }
4898 
GreaterThanOrEqual(Literal rhs)4899         internal override bool GreaterThanOrEqual(Literal rhs)
4900         {
4901             return rhs.LessThanOrEqual(m_value);
4902         }
GreaterThanOrEqual(sbyte rhs)4903         internal override bool GreaterThanOrEqual(sbyte rhs)
4904         {
4905             return m_value >= rhs;
4906         }
GreaterThanOrEqual(byte rhs)4907         internal override bool GreaterThanOrEqual(byte rhs)
4908         {
4909             return m_value >= rhs;
4910         }
GreaterThanOrEqual(char rhs)4911         internal override bool GreaterThanOrEqual(char rhs)
4912         {
4913             return m_value >= rhs;
4914         }
GreaterThanOrEqual(short rhs)4915         internal override bool GreaterThanOrEqual(short rhs)
4916         {
4917             return m_value >= rhs;
4918         }
GreaterThanOrEqual(ushort rhs)4919         internal override bool GreaterThanOrEqual(ushort rhs)
4920         {
4921             return m_value >= rhs;
4922         }
GreaterThanOrEqual(int rhs)4923         internal override bool GreaterThanOrEqual(int rhs)
4924         {
4925             return m_value >= rhs;
4926         }
GreaterThanOrEqual(uint rhs)4927         internal override bool GreaterThanOrEqual(uint rhs)
4928         {
4929             return m_value >= rhs;
4930         }
GreaterThanOrEqual(long rhs)4931         internal override bool GreaterThanOrEqual(long rhs)
4932         {
4933             return m_value >= rhs;
4934         }
GreaterThanOrEqual(ulong rhs)4935         internal override bool GreaterThanOrEqual(ulong rhs)
4936         {
4937             return m_value >= rhs;
4938         }
GreaterThanOrEqual(float rhs)4939         internal override bool GreaterThanOrEqual(float rhs)
4940         {
4941             return m_value >= rhs;
4942         }
GreaterThanOrEqual(double rhs)4943         internal override bool GreaterThanOrEqual(double rhs)
4944         {
4945             return m_value >= rhs;
4946         }
4947     }
4948     #endregion
4949 
4950     #region String Literal Class
4951     /// <summary>
4952     /// Represents a string literal
4953     /// </summary>
4954     internal class StringLiteral : Literal
4955     {
4956         private string m_value;
4957 
4958         internal override object Value
4959         {
4960             get { return m_value; }
4961         }
4962 
StringLiteral(string internalValue)4963         internal StringLiteral(string internalValue)
4964         {
4965             m_value = internalValue;
4966             m_type = typeof(string);
4967         }
4968 
Equal(Literal rhs)4969         internal override bool Equal(Literal rhs)
4970         {
4971             return rhs.Equal(m_value);
4972         }
Equal(string rhs)4973         internal override bool Equal(string rhs)
4974         {
4975             return m_value == rhs;
4976         }
4977 
LessThan(Literal rhs)4978         internal override bool LessThan(Literal rhs)
4979         {
4980             return rhs.GreaterThan(m_value);
4981         }
LessThan(string rhs)4982         internal override bool LessThan(string rhs)
4983         {
4984             return 0 > string.Compare(m_value, rhs, false, System.Globalization.CultureInfo.CurrentCulture);
4985         }
4986 
GreaterThan(Literal rhs)4987         internal override bool GreaterThan(Literal rhs)
4988         {
4989             return rhs.LessThan(m_value);
4990         }
GreaterThan()4991         internal override bool GreaterThan()
4992         {
4993             return true;
4994         }
GreaterThan(string rhs)4995         internal override bool GreaterThan(string rhs)
4996         {
4997             return 0 < string.Compare(m_value, rhs, false, System.Globalization.CultureInfo.CurrentCulture);
4998         }
4999 
LessThanOrEqual(Literal rhs)5000         internal override bool LessThanOrEqual(Literal rhs)
5001         {
5002             return rhs.GreaterThanOrEqual(m_value);
5003         }
LessThanOrEqual(string rhs)5004         internal override bool LessThanOrEqual(string rhs)
5005         {
5006             return 0 >= string.Compare(m_value, (string)rhs, false, System.Globalization.CultureInfo.CurrentCulture);
5007         }
5008 
GreaterThanOrEqual(Literal rhs)5009         internal override bool GreaterThanOrEqual(Literal rhs)
5010         {
5011             return rhs.LessThanOrEqual(m_value);
5012         }
GreaterThanOrEqual()5013         internal override bool GreaterThanOrEqual()
5014         {
5015             return true;
5016         }
GreaterThanOrEqual(string rhs)5017         internal override bool GreaterThanOrEqual(string rhs)
5018         {
5019             return 0 <= string.Compare(m_value, rhs, false, System.Globalization.CultureInfo.CurrentCulture);
5020         }
5021     }
5022     #endregion
5023 }
5024