Exemple #1
0
        internal static bool CompileTimeCompare(object x, object y, RelationOperator op)
        {
            Fx.Assert(null != x && null != y, "");

            if (x is string)
            {
                if (y is double)
                {
                    return(QueryValueModel.Compare((string)x, (double)y, op));
                }
                else if (y is string)
                {
                    return(QueryValueModel.Compare((string)x, (string)y, op));
                }
            }
            else if (x is double)
            {
                if (y is double)
                {
                    return(QueryValueModel.Compare((double)x, (double)y, op));
                }
                else if (y is string)
                {
                    return(QueryValueModel.Compare((double)x, (string)y, op));
                }
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidComparison));
        }
Exemple #2
0
        internal static bool Compare(double x, bool y, RelationOperator op)
        {
            switch (op)
            {
            default:
                return(QueryValueModel.Compare(x, QueryValueModel.Double(y), op));

            case RelationOperator.Eq:
                return(QueryValueModel.Boolean(x) == y);

            case RelationOperator.Ne:
                return(QueryValueModel.Boolean(x) != y);
            }
        }
Exemple #3
0
        internal static bool Compare(bool x, double y, RelationOperator op)
        {
            switch (op)
            {
            default:
                return(QueryValueModel.Compare(QueryValueModel.Double(x), y, op));

            case RelationOperator.Eq:
                return(x == QueryValueModel.Boolean(y));

            case RelationOperator.Ne:
                return(x != QueryValueModel.Boolean(y));
            }
        }
Exemple #4
0
        internal static bool Compare(string x, bool y, RelationOperator op)
        {
            Fx.Assert(null != x, "");
            switch (op)
            {
            default:
                return(QueryValueModel.Compare(QueryValueModel.Double(x), QueryValueModel.Double(y), op));

            case RelationOperator.Eq:
                return(y == QueryValueModel.Boolean(x));

            case RelationOperator.Ne:
                return(y != QueryValueModel.Boolean(x));
            }
        }
Exemple #5
0
        internal bool CompareTo(double val, RelationOperator op)
        {
            switch (this.type)
            {
            case ValueDataType.Boolean:
                return(QueryValueModel.Compare(this.boolVal, val, op));

            case ValueDataType.Double:
                return(QueryValueModel.Compare(this.dblVal, val, op));

            case ValueDataType.Sequence:
                return(QueryValueModel.Compare(this.sequence, val, op));

            case ValueDataType.String:
                return(QueryValueModel.Compare(this.strVal, val, op));
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.TypeMismatch));
        }
Exemple #6
0
        internal static bool Compare(string x, string y, RelationOperator op)
        {
            Fx.Assert(null != x && null != y, "");
            switch (op)
            {
            default:
                Fx.Assert("Invalid RelationOperator");
                break;

            case RelationOperator.Eq:
                return(QueryValueModel.Equals(x, y));

            case RelationOperator.Ge:
            case RelationOperator.Gt:
            case RelationOperator.Le:
            case RelationOperator.Lt:
                return(QueryValueModel.Compare(QueryValueModel.Double(x), QueryValueModel.Double(y), op));

            case RelationOperator.Ne:
                return(x.Length != y.Length || 0 != string.CompareOrdinal(x, y));
            }

            return(false);
        }
Exemple #7
0
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     return(QueryValueModel.Compare(this.StringValue(), item.StringValue(), op));
 }
Exemple #8
0
 internal bool Compare(string strVal, RelationOperator op)
 {
     return(QueryValueModel.Compare(this.StringValue(), strVal, op));
 }
Exemple #9
0
 internal bool Compare(double dblVal, RelationOperator op)
 {
     return(QueryValueModel.Compare(this.NumberValue(), dblVal, op));
 }
Exemple #10
0
 internal static bool Compare(NodeSequence x, bool y, RelationOperator op)
 {
     Fx.Assert(null != x, "");
     return(QueryValueModel.Compare(QueryValueModel.Boolean(x), y, op));
 }
Exemple #11
0
 internal static bool Compare(string x, double y, RelationOperator op)
 {
     Fx.Assert(null != x, "");
     return(QueryValueModel.Compare(QueryValueModel.Double(x), y, op));
 }
Exemple #12
0
 internal static bool Compare(double x, string y, RelationOperator op)
 {
     Fx.Assert(null != y, "");
     return(QueryValueModel.Compare(x, QueryValueModel.Double(y), op));
 }
Exemple #13
0
 internal static bool Compare(bool x, NodeSequence y, RelationOperator op)
 {
     Fx.Assert(null != y, "");
     return(QueryValueModel.Compare(x, QueryValueModel.Boolean(y), op));
 }