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); }
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; } } }