Clean up and document the clone() method in SimulationListener

This commit is contained in:
Sampo Niskanen 2014-12-27 10:51:13 +02:00
parent 807450b407
commit 78cdd77d78
2 changed files with 13 additions and 5 deletions

View File

@ -12,6 +12,7 @@ import net.sf.openrocket.simulation.FlightEvent;
import net.sf.openrocket.simulation.MassData;
import net.sf.openrocket.simulation.SimulationStatus;
import net.sf.openrocket.simulation.exception.SimulationException;
import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Coordinate;
@ -23,7 +24,7 @@ import net.sf.openrocket.util.Coordinate;
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public class AbstractSimulationListener implements SimulationListener, SimulationComputationListener,
SimulationEventListener {
SimulationEventListener, Cloneable {
//// SimulationListener ////
@ -165,8 +166,12 @@ public class AbstractSimulationListener implements SimulationListener, Simulatio
}
@Override
public AbstractSimulationListener clone() throws CloneNotSupportedException {
return (AbstractSimulationListener) super.clone();
public AbstractSimulationListener clone() {
try {
return (AbstractSimulationListener) super.clone();
} catch (CloneNotSupportedException e) {
throw new BugException(e);
}
}
}

View File

@ -9,7 +9,7 @@ import net.sf.openrocket.simulation.exception.SimulationException;
* If the implementation maintains any state, it should be properly cloned.
*
*/
public interface SimulationListener extends Cloneable {
public interface SimulationListener {
/**
* Called when starting a simulation.
@ -62,5 +62,8 @@ public interface SimulationListener extends Cloneable {
public boolean isSystemListener();
public SimulationListener clone() throws CloneNotSupportedException;
/**
* Return a deep copy of this simulation listener including its state.
*/
public SimulationListener clone();
}