public boolean replaceElement ( @ Nonnull final ExpressionTreeElement oldOne , @ Nonnull final ExpressionTreeElement newOne ) { assertNotEmptySlot ( ) ; if ( oldOne == null ) { throw new PreprocessorException ( "[Expression]The old element is null" , this . sourceString , this . includeStack , null ) ; } if ( newOne == null ) { throw new PreprocessorException ( "[Expression]The new element is null" , this . sourceString , this . includeStack , null ) ; } boolean result = false ; final ExpressionTreeElement [ ] children = childElements ; final int len = children . length ; for ( int i = 0 ; i < len ; i ++ ) { if ( children [ i ] == oldOne ) { children [ i ] = newOne ; newOne . parentTreeElement = this ; result = true ; break ; } } return result ; }
It replaces a child element