示例#1
0
文件: Number.cs 项目: yuvaltz/Numbers
        public int CompareTo(Number other)
        {
            int result = Value.CompareTo(other.Value);

            if (result != 0 || Operator == Operator.Create && other.Operator == Operator.Create)
            {
                return(result);
            }

            if (Operator == Operator.Create)
            {
                return(-1);
            }

            if (other.Operator == Operator.Create)
            {
                return(1);
            }

            result = Operand1.CompareTo(other.Operand1);

            if (result != 0)
            {
                return(result);
            }

            return(Operand2.CompareTo(other.Operand2));
        }