Exemplo n.º 1
0
        private ExpressionNode FindFirst(Expression expr)
        {
            BFSIterator iter = expr.Root.GetBFSIterator();

            while (iter.HasNext())
            {
                ExpressionNode current = (ExpressionNode)(iter.Next());
                if (TryMatch(current, this.pattern))
                {
                    return(current);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public Expression(String displayName, ExpressionNode root)
        {
            this.DisplayName = displayName;
            if (root == null)
            {
                return;
            }

            this.Root = root;

            // Set containing expression reference in all children
            if (root != null)
            {
                BFSIterator iter = root.GetBFSIterator();
                while (iter.HasNext())
                {
                    ((ExpressionNode)(iter.Next())).Expr = this;
                }
            }
        }