protected override double Operate(double arg1, double arg2, BinaryOperators operation)
        {
            switch (operation)
            {
            case BinaryOperators.Add:
                return(arg1 + arg2);

            case BinaryOperators.Subtract:
                return(arg1 - arg2);

            case BinaryOperators.Multiply:
                return(arg1 * arg2);

            case BinaryOperators.Divide:
                return(arg1 / arg2);

            case BinaryOperators.Exponent:
                return(Mathf.Pow(Convert.ToSingle(arg1), Convert.ToSingle(arg2)));

            case BinaryOperators.Mod:
                return(arg1 % arg2);

            case BinaryOperators.DivisibleBy:
                return(arg1 % arg2 < .0001f ? 1 : 0);

            case BinaryOperators.Max:
                return(arg1 > arg2 ? arg1 : arg2);

            case BinaryOperators.Min:
                return(arg1 < arg2 ? arg1 : arg2);

            default:
                throw new Exception("Unknown operation type!");
            }
        }
        protected override int Operate(int arg1, int arg2, BinaryOperators operation)
        {
            switch (operation)
            {
            case BinaryOperators.Add:
                return(arg1 + arg2);

            case BinaryOperators.Subtract:
                return(arg1 - arg2);

            case BinaryOperators.Multiply:
                return(arg1 * arg2);

            case BinaryOperators.Divide:
                return(arg1 / arg2);

            case BinaryOperators.Exponent:
                return(Mathf.FloorToInt(Mathf.Pow(arg1, arg2)));

            case BinaryOperators.Mod:
                return(arg1 % arg2);

            case BinaryOperators.DivisibleBy:
                return(arg1 % arg2 == 0 ? 1 : 0);

            case BinaryOperators.Max:
                return(Mathf.Max(arg1, arg2));

            case BinaryOperators.Min:
                return(Mathf.Min(arg1, arg2));

            default:
                throw new Exception("Unknown operation type!");
            }
        }
예제 #3
0
 public Condition(string left, string right, BinaryOperators opr)
 {
     Fields = new string[2] {
         left, right
     };
     Operator = opr;
 }
예제 #4
0
        public void Invoke(IExecutionContext context)
        {
            var value     = context.Pop();
            var arguments = new Object[] { 1.0, value };

            context.Push(BinaryOperators.Sub(arguments));
        }
예제 #5
0
 public BoundBinaryExpression(BoundExpression left, BoundExpression right, BinaryOperators @operator, BinaryExpressionSyntax binaryExpressionSyntax, IType type)
     : base(binaryExpressionSyntax, type)
 {
     Left = left;
     Right = right;
     Operator = @operator;
 }
예제 #6
0
        protected override Vector3 Operate(Vector3 arg1, Vector3 arg2, BinaryOperators operation)
        {
            switch (operation)
            {
            case BinaryOperators.Add:
                return(arg1 + arg2);

            case BinaryOperators.Subtract:
                return(arg1 - arg2);

            case BinaryOperators.Multiply:
                return(arg1.PiecewiseMultiply(arg2));

            case BinaryOperators.Divide:
                throw new InvalidOperationException("One does not simply divide two vectors!");

            case BinaryOperators.Exponent:
                throw new InvalidOperationException("One does not simply exponentiate two vectors!");

            case BinaryOperators.Mod:
                throw new InvalidOperationException("One does not simply mod two vectors!");

            case BinaryOperators.DivisibleBy:
                throw new InvalidOperationException("One does not simply check if two vectors are divisible!");

            case BinaryOperators.Max:
                throw new InvalidOperationException("One does not simply max two vectors!");

            case BinaryOperators.Min:
                throw new InvalidOperationException("One does not simply min two vectors!");

            default:
                throw new Exception("Unknown operation type!");
            }
        }
예제 #7
0
        public decimal CalculateRPN(string rpnExpression)
        {
            decimal result = 0;
            decimal number = 0;


            Stack <decimal> stack = new Stack <decimal>();

            foreach (string str in rpnExpression.Split(','))
            {
                if (decimal.TryParse(str, out number))
                {
                    stack.Push(number);
                }
                else
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        throw new InvalidOperationException();
                    }

                    foreach (var binaryOperator in BinaryOperators.Where(x => x.oprator == str))
                    {
                        stack.Push(binaryOperator.Calculate(stack.Pop(), stack.Pop()));
                    }

                    foreach (var unaryOperator in UnaryOperators.Where(x => x.oprator == str))
                    {
                        stack.Push(unaryOperator.Calculate(stack.Pop()));
                    }
                }
            }
            return(stack.Pop());
        }
예제 #8
0
 public void BinaryConstructorTest()
 {
     string left = string.Empty; // TODO: Initialize to an appropriate value
     BinaryOperators op = new BinaryOperators(); // TODO: Initialize to an appropriate value
     string right = string.Empty; // TODO: Initialize to an appropriate value
     jgshort.SqlDom.Expressions.Binary target = new jgshort.SqlDom.Expressions.Binary(left, op, right);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
예제 #9
0
 public void BinaryConstructorTest2()
 {
     System.Decimal left = new System.Decimal(); // TODO: Initialize to an appropriate value
     BinaryOperators op = new BinaryOperators(); // TODO: Initialize to an appropriate value
     System.Decimal right = new System.Decimal(); // TODO: Initialize to an appropriate value
     jgshort.SqlDom.Expressions.Binary target = new jgshort.SqlDom.Expressions.Binary(left, op, right);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
예제 #10
0
        public Condition ToCondition(ComparisonOperators compOp, BinaryOperators binOp)
        {
            var cond = new Condition()
            {
                PropertyName = this.Name, ComparisonOperator = compOp, Value1 = this.Value, BinaryOperator = binOp
            };

            return(cond);
        }
예제 #11
0
 public BinaryOperatorExpression(
     ExpressionBase <T> left,
     BinaryOperators @operator,
     ExpressionBase <T> right
     )
 {
     Left     = left;
     Operator = @operator;
     Right    = right;
 }
예제 #12
0
 public Predicate(string firstOperand, string secondOperand, BinaryOperators binaryOperator)
 {
     if (string.IsNullOrWhiteSpace(firstOperand))
     {
         ExpressionValue = secondOperand;
     }
     else
     {
         ExpressionValue = string.Concat(firstOperand, binaryOperator.GetSqlExpression(), secondOperand);
     }
 }
예제 #13
0
        /// <summary>
        /// Evaluates the specified binary operator expression and returns the result.
        /// </summary>
        /// <param name="context">The runtime context.</param>
        /// <param name="oper">The operator.</param>
        /// <param name="left">The left expression.</param>
        /// <param name="right">The right expression.</param>
        /// <returns>The result of the expression.</returns>
        /// <exception cref="ArithmeticException">No operator is matched.</exception>
        IScriptObject IOperatorCalculator.CalculateBinaryOperator(RuntimeContext context, string oper, Expression left, Expression right)
        {
            Func <RuntimeContext, Expression, Expression, IScriptObject> bin;

            if (BinaryOperators.TryGetValue(oper, out bin))
            {
                return(bin(context, left, right));
            }
            throw new ArithmeticException(
                      string.Format(ExceptionResource.OperatorNotSupported, oper));
        }
예제 #14
0
        public static ExpressionEmitter Prepare(BinaryOperators binaryOperator, DecodeContext decodeContext)
        {
            var si1 = decodeContext.PopStack();
            var si0 = decodeContext.PopStack();

            char opChar;

            switch (binaryOperator)
            {
            case BinaryOperators.And: opChar = '&'; break;

            case BinaryOperators.Or: opChar = '|'; break;

            case BinaryOperators.Xor: opChar = '^'; break;

            default: throw new Exception();
            }

            // See also: ECMA-335: III.1.5 Operand type table - Integer Operations

            // Int32 = (Int32) op (Int32)
            if (si0.TargetType.IsInt32StackFriendlyType && si1.TargetType.IsInt32StackFriendlyType)
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.Int32Type);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = {1} {2} {3}", extractContext.GetSymbolName(result), extractContext.GetSymbolName(si0), opChar, extractContext.GetSymbolName(si1)) });
            }

            // Int64 = (Int64) op (Int64)
            if (si0.TargetType.IsInt64StackFriendlyType && si1.TargetType.IsInt64StackFriendlyType)
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.Int64Type);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = {1} {2} {3}", extractContext.GetSymbolName(result), extractContext.GetSymbolName(si0), opChar, extractContext.GetSymbolName(si1)) });
            }

            // IntPtr = (Int32|IntPtr) op (Int32|IntPtr)
            if ((si0.TargetType.IsInt32StackFriendlyType || si0.TargetType.IsIntPtrStackFriendlyType) &&
                (si1.TargetType.IsInt32StackFriendlyType || si1.TargetType.IsIntPtrStackFriendlyType))
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.IntPtrType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = (intptr_t){1} {2} (intptr_t){3}", extractContext.GetSymbolName(result), extractContext.GetSymbolName(si0), opChar, extractContext.GetSymbolName(si1)) });
            }

            throw new InvalidProgramSequenceException(
                      "Unknown logical operation: Location={0}, Op={1}, Type0={2}, Type1={3}",
                      decodeContext.CurrentCode.RawLocation,
                      binaryOperator,
                      si0.TargetType.FriendlyName,
                      si1.TargetType.FriendlyName);
        }
예제 #15
0
        public static string GetSqlExpression(this BinaryOperators predicateOperation)
        {
            string result;

            switch (predicateOperation)
            {
            case BinaryOperators.Equal:
                result = " = ";
                break;

            case BinaryOperators.NotEqual:
                result = " <> ";
                break;

            case BinaryOperators.GreaterThen:
                result = " > ";
                break;

            case BinaryOperators.GreaterOrEqualThen:
                result = " >= ";
                break;

            case BinaryOperators.LessThen:
                result = " < ";
                break;

            case BinaryOperators.LessOrEqualThen:
                result = " <= ";
                break;

            case BinaryOperators.Like:
                result = " LIKE ";
                break;

            case BinaryOperators.NotLike:
                result = " NOT LIKE ";
                break;

            case BinaryOperators.And:
                result = " AND ";
                break;

            case BinaryOperators.Or:
                result = " OR ";
                break;

            default: throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
예제 #16
0
        protected override bool Operate(bool arg1, bool arg2, BinaryOperators operation)
        {
            switch (operation)
            {
            case BinaryOperators.Add:
                return(arg1 || arg2);

            case BinaryOperators.Multiply:
                return(arg1 && arg2);

            default:
                throw new Exception("Unknown operation type on bools!");
            }
        }
예제 #17
0
        public static BinaryOperators GetBinaryOperator(string binaryOp)
        {
            BinaryOperators binOp = BinaryOperators.None;

            switch (binaryOp.ToUpper())
            {
            case "AND":
            case "&&":
                binOp = BinaryOperators.And;
                break;

            case "OR":
            case "||":
                binOp = BinaryOperators.Or;
                break;

            default:
                break;
            }
            return(binOp);
        }
예제 #18
0
파일: Binary.cs 프로젝트: jgshort/SqlDom
 public Binary(float left, BinaryOperators op, float right)
     : this(new ConstantTypes.Float(left), op, new ConstantTypes.Float(right))
 {
     //
 }
예제 #19
0
파일: Binary.cs 프로젝트: jgshort/SqlDom
 public Binary(System.Decimal left, BinaryOperators op, System.Decimal right)
     : this(new ConstantTypes.Decimal(left), op, new ConstantTypes.Decimal(right))
 {
     //
 }
예제 #20
0
파일: Binary.cs 프로젝트: jgshort/SqlDom
 public Binary(System.DateTime left, BinaryOperators op, System.DateTime right)
     : this(new ConstantTypes.DateTime(left), op, new ConstantTypes.DateTime(right))
 {
     //
 }
예제 #21
0
파일: Binary.cs 프로젝트: jgshort/SqlDom
 public Binary(string left, BinaryOperators op, string right)
     : this(new ConstantTypes.String(left), op, new ConstantTypes.String(right))
 {
     //
 }
예제 #22
0
파일: Binary.cs 프로젝트: jgshort/SqlDom
 public Binary(int left, BinaryOperators op, int right)
     : this(new ConstantTypes.Integer(left), op, new ConstantTypes.Integer(right))
 {
     //
 }
예제 #23
0
파일: Binary.cs 프로젝트: jgshort/SqlDom
 public Binary(Expression left, BinaryOperators op, Expression right)
 {
     Left = left;
     Operator = op;
     Right = right;
 }
예제 #24
0
        private Operand ParseBinaryOperator(Operand left, ref List <Token> tokens, int grammarRule = int.MaxValue)
        {
            if (grammarRule == int.MaxValue)
            {
                grammarRule = BinaryOperators.Length - 1;
            }
            if (tokens.Count == 0)
            {
                return(left);
            }
            Token first = tokens.First();

            if (grammarRule < 0)
            {
                return(ParseTerm(tokens: ref tokens));
            }
            Operator[] operators = BinaryOperators [grammarRule];
            Log.Debug("ParseBinaryOperator: grammarRule: ", grammarRule, ", operators: ", operators.Join(","));

            if (first.Type == TokenType.OPERATOR)
            {
                while (tokens.Count > 0)
                {
                    first = tokens.First();
                    Log.Debug("tokens: ", string.Join(" ", tokens.Select(t => t.Text)));
                    if (first.Type == TokenType.OPERATOR)
                    {
                        // if the current operator is this binary operator
                        if (operators.Any(o => first.Text == o.OperatorChar))
                        {
                            Operator op = operators.First(o => first.Text == o.OperatorChar);
                            Log.Debug("found binary operator: ", op);
                            tokens.RemoveAt(0);
                            Log.Indent++;
                            Operand right = ParseTerm(tokens: ref tokens, maxBinaryGrammarRule: grammarRule);
                            Log.Indent--;
                            left = (op as BinaryOperator).Eval(l: left, r: right);
                        }
                        // if the current operator has higher precedence as this one
                        else if (BinaryOperators.Take(grammarRule).Any(ops => ops.Any(o => o.OperatorChar == first.Text)))
                        {
                            Log.Indent++;
                            left = ParseBinaryOperator(left: left, tokens: ref tokens, grammarRule: grammarRule - 1);
                            Log.Indent--;
                        }
                        // if the current operator has lower precedence as this one
                        else
                        {
                            break;
                        }
                    }
                    else if (first.Type == TokenType.CLOSING_BRACKET)
                    {
                        break;                         // ignore
                    }
                    else
                    {
                        Log.Debug("ParseBinaryOperator: Invalid token (1): should be binary operator: " + first);
                    }
                }
            }
            else if (first.Type == TokenType.CLOSING_BRACKET)
            {
                // ignore
            }
            else
            {
                Log.Debug("ParseBinaryOperator: Invalid token (2): should be binary operator: " + first);
            }

            return(left);
        }
예제 #25
0
 protected abstract T Operate(T arg1, T arg2, BinaryOperators operation);
예제 #26
0
        public static ExpressionEmitter Prepare(BinaryOperators binaryOperator, DecodeContext decodeContext)
        {
            var si1 = decodeContext.PopStack();
            var si0 = decodeContext.PopStack();

            char opChar;

            switch (binaryOperator)
            {
            case BinaryOperators.Add: opChar = '+'; break;

            case BinaryOperators.Sub: opChar = '-'; break;

            case BinaryOperators.Mul: opChar = '*'; break;

            case BinaryOperators.Div: opChar = '/'; break;

            case BinaryOperators.Rem: opChar = '%'; break;

            default: throw new Exception();
            }

            // See also: ECMA-335: III.1.5 Operand type table - Binary Numeric Operations

            // Int32 = (Int32) op (Int32)
            if (si0.TargetType.IsInt32StackFriendlyType && si1.TargetType.IsInt32StackFriendlyType)
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.Int32Type);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = {1} {2} {3}",
                                                          extractContext.GetSymbolName(result),
                                                          extractContext.GetSymbolName(si0),
                                                          opChar,
                                                          extractContext.GetSymbolName(si1)) });
            }

            // Int64 = (Int64) op (Int64)
            if (si0.TargetType.IsInt64StackFriendlyType && si1.TargetType.IsInt64StackFriendlyType)
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.Int64Type);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = {1} {2} {3}",
                                                          extractContext.GetSymbolName(result),
                                                          extractContext.GetSymbolName(si0),
                                                          opChar,
                                                          extractContext.GetSymbolName(si1)) });
            }

            // Double = (Float) % (Float)
            if (si0.TargetType.IsFloatStackFriendlyType && si1.TargetType.IsFloatStackFriendlyType &&
                (binaryOperator == BinaryOperators.Rem))
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.DoubleType);

                // Use special runtime function.
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = il2c_fmod({1}, {2})",
                                                          extractContext.GetSymbolName(result),
                                                          extractContext.GetSymbolName(si0),
                                                          extractContext.GetSymbolName(si1)) });
            }

            // Double = (Float) op (Float)
            if (si0.TargetType.IsFloatStackFriendlyType && si1.TargetType.IsFloatStackFriendlyType)
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.DoubleType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = (double){1} {2} (double){3}",
                                                          extractContext.GetSymbolName(result),
                                                          extractContext.GetSymbolName(si0),
                                                          opChar,
                                                          extractContext.GetSymbolName(si1)) });
            }

            // ByRef = (Int32) + (ByRef)
            if (si0.TargetType.IsInt32StackFriendlyType && si1.TargetType.IsByReference &&
                (binaryOperator == BinaryOperators.Add))
            {
                var result = decodeContext.PushStack(si1.TargetType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = ({1})((intptr_t){2} + (intptr_t){3})",
                                                          extractContext.GetSymbolName(result),
                                                          si1.TargetType.CLanguageTypeName,
                                                          extractContext.GetSymbolName(si0),
                                                          extractContext.GetSymbolName(si1)) });
            }

            // ByRef = (IntPtr) + (ByRef)
            if (si0.TargetType.IsIntPtrStackFriendlyType && si1.TargetType.IsByReference &&
                (binaryOperator == BinaryOperators.Add))
            {
                var result = decodeContext.PushStack(si1.TargetType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = ({1})((intptr_t){2} + (intptr_t){3})",
                                                          extractContext.GetSymbolName(result),
                                                          si1.TargetType.CLanguageTypeName,
                                                          extractContext.GetSymbolName(si0),
                                                          extractContext.GetSymbolName(si1)) });
            }

            // ByRef = (ByRef) +/- (Int32|IntPtr)
            if (si0.TargetType.IsByReference &&
                (si1.TargetType.IsInt32StackFriendlyType || si1.TargetType.IsIntPtrStackFriendlyType) &&
                ((binaryOperator == BinaryOperators.Add) || (binaryOperator == BinaryOperators.Sub)))
            {
                var result = decodeContext.PushStack(si0.TargetType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = ({1})((intptr_t){2} {3} (intptr_t){4})",
                                                          extractContext.GetSymbolName(result),
                                                          si0.TargetType.CLanguageTypeName,
                                                          extractContext.GetSymbolName(si0),
                                                          opChar,
                                                          extractContext.GetSymbolName(si1)) });
            }

            // ByRef = (ByRef) - (ByRef)
            if (si0.TargetType.IsByReference && si1.TargetType.IsByReference &&
                (binaryOperator == BinaryOperators.Sub))
            {
                var result = decodeContext.PushStack(si0.TargetType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = ({1})((intptr_t){2} - (intptr_t){3})",
                                                          extractContext.GetSymbolName(result),
                                                          si0.TargetType.CLanguageTypeName,
                                                          extractContext.GetSymbolName(si0),
                                                          extractContext.GetSymbolName(si1)) });
            }

            // IntPtr = (Int32|IntPtr) op (Int32|IntPtr)
            if ((si0.TargetType.IsInt32StackFriendlyType || si0.TargetType.IsIntPtrStackFriendlyType) &&
                (si1.TargetType.IsInt32StackFriendlyType || si1.TargetType.IsIntPtrStackFriendlyType))
            {
                var result = decodeContext.PushStack(decodeContext.PrepareContext.MetadataContext.IntPtrType);
                return((extractContext, _) => new[] { string.Format(
                                                          "{0} = (intptr_t){1} {2} (intptr_t){3}",
                                                          extractContext.GetSymbolName(result),
                                                          extractContext.GetSymbolName(si0),
                                                          opChar,
                                                          extractContext.GetSymbolName(si1)) });
            }

            throw new InvalidProgramSequenceException(
                      "Unknown arithmetical operation: Location={0}, Op={1}, Type0={2}, Type1={3}",
                      decodeContext.CurrentCode.RawLocation,
                      binaryOperator,
                      si0.TargetType.FriendlyName,
                      si1.TargetType.FriendlyName);
        }
예제 #27
0
        public BinaryOperatorTests(BinaryOperators opt)
        {
            // for conditionals
            func = (x, y) => x.CompareTo(y);
            switch (opt)
            {
            case BinaryOperators.add:
                func   = (x, y) => x + y;
                optStr = "+";
                break;

            case BinaryOperators.subtract:
                func   = (x, y) => x - y;
                optStr = "-";
                break;

            case BinaryOperators.multiply:
                func   = (x, y) => x * y;
                optStr = "*";
                break;

            case BinaryOperators.divide:
                func   = (x, y) => x / y;
                optStr = "/";
                break;

            case BinaryOperators.pow:
                func   = (x, y) => Math.Pow(x, y);
                optStr = "^";
                break;

            case BinaryOperators.and:
                func   = (x, y) => Convert.ToDouble(Convert.ToBoolean(x) && Convert.ToBoolean(y));
                optStr = "&&";
                break;

            case BinaryOperators.or:
                func   = (x, y) => Convert.ToDouble(Convert.ToBoolean(x) || Convert.ToBoolean(y));
                optStr = "||";
                break;

            case BinaryOperators.equals:
                func   = (x, y) => Convert.ToDouble(x == y);
                optStr = "==";
                break;

            case BinaryOperators.notEqual:
                func   = (x, y) => Convert.ToDouble(x != y);
                optStr = "!=";
                break;

            case BinaryOperators.greaterThan:
                func   = (x, y) => Convert.ToDouble(x > y);
                optStr = ">";
                break;

            case BinaryOperators.lessThan:
                func   = (x, y) => Convert.ToDouble(x < y);
                optStr = "<";
                break;

            case BinaryOperators.greaterThanEqualTo:
                func   = (x, y) => Convert.ToDouble(x >= y);
                optStr = ">=";
                break;

            case BinaryOperators.lessThanEqualTo:
                func   = (x, y) => Convert.ToDouble(x <= y);
                optStr = "<=";
                break;

            default:
                throw new ArithmeticException(opt.ToString());
            }
        }
예제 #28
0
 public BinaryExpression(SourceLocation location, Expression left, Expression right, BinaryOperators @operator) : base(location)
 {
     this.Left     = left;
     this.Operator = @operator;
     this.Right    = right;
 }
예제 #29
0
        public void Test()
        {
            BinaryOperators o1 = new BinaryOperators()
            {
                X = 20, Y = 12
            };
            BinaryOperators o2 = new BinaryOperators()
            {
                X = 30, Y = 38
            };
            BinaryOperators o3 = o1 + o2;

            o3 += 2;
            Console.WriteLine("o3.X {0}, o3.Y {1}", o3.X, o3.Y);

            UnaryOperators uOp1 = new UnaryOperators()
            {
                X = 100, Y = 200
            };

            Console.WriteLine("uOp1.X {0}, uOp1.Y {1}", uOp1.X, uOp1.Y);
            uOp1++;
            ++uOp1;
            Console.WriteLine("uOp1.X {0}, uOp1.Y {1}", uOp1.X, uOp1.Y);

            EqualityOperator eo1 = new EqualityOperator()
            {
                X = 100, Y = 200
            };
            EqualityOperator eo2 = new EqualityOperator()
            {
                X = 100, Y = 200
            };

            Console.WriteLine("eo1 == eo2 {0}   eo1.Equals(eo2) {1} ", eo1 == eo2, eo1.Equals(eo2));
            ComparisonOperator co1 = new ComparisonOperator()
            {
                X = 2, Y = 2
            };
            ComparisonOperator co3 = new ComparisonOperator()
            {
                X = 6, Y = 6
            };
            ComparisonOperator co2 = new ComparisonOperator()
            {
                X = 4, Y = 4
            };

            Console.WriteLine(" co1 < co2  {0}", co1 < co2);
            Console.WriteLine(" co1 < co2  {0}", co1 > co2);
            Console.WriteLine(" co3 < co2  {0}", co3 > co2);


            CustomConversionA customA = new CustomConversionA()
            {
                Description = "My Description"
            };
            CustomConversionC customC = new CustomConversionC()
            {
                Description = "My Description"
            };

            CustomConversionB customBfromA    = (CustomConversionB)customA;
            CustomConversionB customBfromCex  = (CustomConversionB)customC;
            CustomConversionB customBfromCimp = customC;

            Console.WriteLine("CustomBfromA : {0}", customBfromA.ReverseDescription);
            Console.WriteLine("CustomBfromC(explicit) :  {0}", customBfromCex.ReverseDescription);
            Console.WriteLine("CustomBfromC(implpicit) : {0}", customBfromCimp.ReverseDescription);
        }