public synchronized void replace ( final BioPAXElement existing , final BioPAXElement replacement ) { ModelUtils . replace ( this , Collections . singletonMap ( existing , replacement ) ) ; remove ( existing ) ; if ( replacement != null ) add ( replacement ) ; }
It does not automatically replace or clean up the old element s object properties therefore some child elements may become dangling if they were used by the replaced element only .