public object Evaluate(
            EventBean[] eventsPerStream,
            bool isNewData,
            ExprEvaluatorContext context)
        {
            var pattern = (string) _patternEval.Evaluate(eventsPerStream, isNewData, context);
            if (pattern == null) {
                return null;
            }

            var es = '\\';
            if (_optionalEscapeEval != null) {
                var escapeString = (string) _optionalEscapeEval.Evaluate(eventsPerStream, isNewData, context);
                if (!string.IsNullOrEmpty(escapeString)) {
                    es = escapeString[0];
                }
            }

            var likeUtil = new LikeUtil(pattern, es, false);

            var value = _lhsEval.Evaluate(eventsPerStream, isNewData, context);
            if (value == null) {
                return null;
            }

            if (_form.IsNumericValue) {
                value = value.ToString();
            }

            var result = _form.ForgeRenderable.IsNot ^ likeUtil.CompareTo((string) value);

            return result;
        }
Esempio n. 2
0
        /// <summary>
        /// Match the string returning true for a match, using SQL-like semantics.
        /// </summary>
        /// <param name="stringToMatch">string to match</param>
        /// <returns>true for match</returns>
        public bool Match(string stringToMatch)
        {
            if (stringToMatch == null) {
                return false;
            }

            return _likeUtil.CompareTo(stringToMatch);
        }