Beispiel #1
0
        public static IList<Pair<ExprNode, ExprNode>> FindExpression(
            ExprNode selectExpression,
            ExprNode searchExpression)
        {
            IList<Pair<ExprNode, ExprNode>> pairs = new List<Pair<ExprNode, ExprNode>>();
            if (ExprNodeUtilityCompare.DeepEquals(selectExpression, searchExpression, false)) {
                pairs.Add(new Pair<ExprNode, ExprNode>(null, selectExpression));
                return pairs;
            }

            FindExpressionChildRecursive(selectExpression, searchExpression, pairs);
            return pairs;
        }
Beispiel #2
0
        private static void FindExpressionChildRecursive(
            ExprNode parent,
            ExprNode searchExpression,
            IList<Pair<ExprNode, ExprNode>> pairs)
        {
            foreach (var child in parent.ChildNodes) {
                if (ExprNodeUtilityCompare.DeepEquals(child, searchExpression, false)) {
                    pairs.Add(new Pair<ExprNode, ExprNode>(parent, child));
                    continue;
                }

                FindExpressionChildRecursive(child, searchExpression, pairs);
            }
        }
Beispiel #3
0
        public override bool Equals(object o)
        {
            if (this == o) {
                return true;
            }

            if (o == null || GetType() != o.GetType()) {
                return false;
            }

            var that = (ExprChainedSpec) o;

            if (Name != null ? !Name.Equals(that.Name) : that.Name != null) {
                return false;
            }

            return ExprNodeUtilityCompare.DeepEquals(Parameters, that.Parameters);
        }
Beispiel #4
0
        private bool FindItem(ExprNodePropOrStreamDesc item)
        {
            if (item is ExprNodePropOrStreamPropDesc) {
                return _properties != null && _properties.Contains(item);
            }

            if (_expressions == null) {
                return false;
            }

            var exprItem = (ExprNodePropOrStreamExprDesc) item;
            foreach (ExprNodePropOrStreamExprDesc expression in _expressions) {
                if (expression.StreamNum != exprItem.StreamNum) {
                    continue;
                }

                if (ExprNodeUtilityCompare.DeepEquals(expression.Originator, exprItem.Originator, false)) {
                    return true;
                }
            }

            return false;
        }