/** * Override the setContainer() method to call wrapup() if container is not equal to the result of * getContainer(). If this method did not override super.setContainer(), then when the actor is * deleted while the model is running, wrapup() would never get called. */ public void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException { if (container != getContainer()) { wrapup(); } super.setContainer(container); }