Пример #1
0
        public int CompareTo(IValue other)
        {
            if (other.DataType != this.DataType)
            {
                if (this.DataType == DataType.Boolean && other.DataType == DataType.Number ||
                    this.DataType == DataType.Number && other.DataType == DataType.Boolean)
                {
                    return(AsNumber().CompareTo(other.AsNumber()));
                }
                else
                {
                    throw RuntimeException.ComparisonNotSupportedException();
                }
            }

            switch (other.DataType)
            {
            case Machine.DataType.Boolean:
                return(AsBoolean().CompareTo(other.AsBoolean()));

            case Machine.DataType.Date:
                return(AsDate().CompareTo(other.AsDate()));

            case Machine.DataType.Undefined:
                return(0);

            default:
                return(AsNumber().CompareTo(other.AsNumber()));
            }
        }
Пример #2
0
        public int CompareTo(IValue other)
        {
            if (other.DataType == DataType.String)
            {
                return(_value.CompareTo(other.AsString()));
            }

            throw RuntimeException.ComparisonNotSupportedException();
        }
Пример #3
0
 public int CompareTo(IValue other)
 {
     throw RuntimeException.ComparisonNotSupportedException();
 }