private bool EqualsMaybeCS(object a, object b) { if (CaseInsensitive) { return(string.Compare(a.ToString(), b.ToString(), true, CultureInfo.InvariantCulture) == 0); } return(RxKqlCommonFunctions.TryConvert(b, a.GetType(), out var bConverted) && a.Equals(bConverted)); }
public override object GetValue(IDictionary <string, object> evt) { var left = Left.GetValue(evt); var right = Right.GetValue(evt); if (!RxKqlCommonFunctions.TryConvert <bool>(left, out var leftBool)) { throw new EvaluationTypeMismatchException($"Cannot convert value {left} to bool"); } if (!RxKqlCommonFunctions.TryConvert <bool>(right, out var rightBool)) { throw new EvaluationTypeMismatchException($"Cannot convert value {right} to bool"); } return(leftBool && rightBool); }
public override object GetValue(IDictionary <string, object> evt) { var value = Element.GetValue(evt); var indexer = Selector.GetValue(evt); if (value.IsGenericList() && RxKqlCommonFunctions.TryConvert <int>(indexer, out var index)) { //TODO negative indexing var list = (IList)value; if (index < 0 || index >= list.Count) { return(string.Empty); } return(list[index]); } //dict[col] is equivalent to dict.col return(new ScalarPath { Element = Element, Selector = Selector }.GetValue(evt)); }