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)); }
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); } }
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)); } }
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)); } }
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)); }
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); }
internal bool Compare(ref NodeSequenceItem item, RelationOperator op) { return(QueryValueModel.Compare(this.StringValue(), item.StringValue(), op)); }
internal bool Compare(string strVal, RelationOperator op) { return(QueryValueModel.Compare(this.StringValue(), strVal, op)); }
internal bool Compare(double dblVal, RelationOperator op) { return(QueryValueModel.Compare(this.NumberValue(), dblVal, op)); }
internal static bool Compare(NodeSequence x, bool y, RelationOperator op) { Fx.Assert(null != x, ""); return(QueryValueModel.Compare(QueryValueModel.Boolean(x), y, op)); }
internal static bool Compare(string x, double y, RelationOperator op) { Fx.Assert(null != x, ""); return(QueryValueModel.Compare(QueryValueModel.Double(x), y, op)); }
internal static bool Compare(double x, string y, RelationOperator op) { Fx.Assert(null != y, ""); return(QueryValueModel.Compare(x, QueryValueModel.Double(y), op)); }
internal static bool Compare(bool x, NodeSequence y, RelationOperator op) { Fx.Assert(null != y, ""); return(QueryValueModel.Compare(x, QueryValueModel.Boolean(y), op)); }