/// <summary> /// Compares two nodes to see if they are equal. /// </summary> /// <param name="node1">First node to check.</param> /// <param name="node2">Second node to check.</param> /// <returns>boolean - true if children matched</returns> internal bool ChildrenEqual( AstNode node1, AstNode node2 ) { if ( ( node1.Children != null ) || ( node2.Children != null ) ) { if ( ( ( node1.Children == null ) || ( node2.Children == null ) ) || ( node1.Children.Count != node2.Children.Count ) ) return false; for ( int j = 0; j < node1.Children.Count; j++ ) { if ( !node1.GetChild( j ).Equals( node2.GetChild( j ) ) ) return false; } } return true; }
public void AssertIsSatisfiedBy( AstNode node ) { _assertionMethod( node ); }
/// <summary> /// Adds a new child node. /// </summary> /// <param name="node">The node to add.</param> public virtual void AddChild( AstNode node ) { if ( _children == null ) _children = new List< AstNode >(); _children.Add( node ); node._parent = this; }