예제 #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));
        }