public void addStatement ( AstNode statement ) { assertNotNull ( statement ) ; if ( statements == null ) { statements = new ArrayList < AstNode > ( ) ; } int end = statement . getPosition ( ) + statement . getLength ( ) ; this . setLength ( end - this . getPosition ( ) ) ; statements . add ( statement ) ; statement . setParent ( this ) ; }
Adds a statement to the end of the statement list . Sets the parent of the new statement to this node updates its start offset to be relative to this node and sets the length of this node to include the new child .