protected int add_child ( int idx , IonValueLite child ) { _isNullValue ( false ) ; // if we add children we're not null anymore child . setContext ( this . getContextForIndex ( child , idx ) ) ; if ( _children == null || _child_count >= _children . length ) { int old_len = ( _children == null ) ? 0 : _children . length ; int new_len = this . nextSize ( old_len , true ) ; assert ( new_len > idx ) ; IonValueLite [ ] temp = new IonValueLite [ new_len ] ; if ( old_len > 0 ) { System . arraycopy ( _children , 0 , temp , 0 , old_len ) ; } _children = temp ; } if ( idx < _child_count ) { System . arraycopy ( _children , idx , _children , idx + 1 , _child_count - idx ) ; } _child_count ++ ; _children [ idx ] = child ; structuralModificationCount ++ ; child . _elementid ( idx ) ; if ( ! _isSymbolIdPresent ( ) && child . _isSymbolIdPresent ( ) ) { cascadeSIDPresentToContextRoot ( ) ; } return idx ; }
Does not validate the child or check locks .