예제 #1
0
        public object Evaluate(PropertyVertexModel vertex)
        {
            var left  = _left.Evaluate(vertex);
            var right = _right.Evaluate(vertex);

            if (left == null)
            {
                return(ToArray(right));
            }
            if (right == null)
            {
                return(ToArray(left));
            }

            // convert to arrays is props are not arrays
            object[] leftArr  = ToArray(left);
            object[] rightArr = ToArray(right);

            // compute union of two
            Dictionary <string, object> result = leftArr.ToDictionary(e => e.ToString(), e => e);

            foreach (var e in rightArr)
            {
                var key = e.ToString();
                if (result.ContainsKey(key))
                {
                    continue;
                }
                result.Add(key, e);
            }

            return(result.Values.ToArray());
        }
예제 #2
0
        public object Evaluate(PropertyVertexModel vertex)
        {
            var left  = _left.Evaluate(vertex);
            var right = _right.Evaluate(vertex);

            if (left == null)
            {
                return(null);
            }
            if (right == null)
            {
                return(null);
            }

            // convert to arrays is props are not arrays
            object[] leftArr = ToArray(left);
            string   filter  = right.ToString().Trim(new char[] { '\'' });

            return(leftArr.Where(e => e.ToString().Like(filter)));
        }