Implement loadFrom sims
This commit is contained in:
parent
3eb513c78f
commit
5aad8b9722
@ -269,6 +269,18 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
return simulationExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the simulation extensions to the simulation.
|
||||
* @param extensions the simulation extensions to apply.
|
||||
*/
|
||||
public void copyExtensionsFrom(List<SimulationExtension> extensions) {
|
||||
if (extensions == null) {
|
||||
return;
|
||||
}
|
||||
this.simulationExtensions.clear();
|
||||
this.simulationExtensions.addAll(extensions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the user-defined name of the simulation.
|
||||
@ -555,6 +567,31 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the data from the specified simulation into this simulation.
|
||||
* @param simulation the simulation to load from.
|
||||
*/
|
||||
public void loadFrom(Simulation simulation) {
|
||||
mutex.lock("loadFrom");
|
||||
try {
|
||||
this.name = simulation.name;
|
||||
this.configId = simulation.configId;
|
||||
this.options.copyFrom(simulation.options);
|
||||
this.simulatedConfigurationDescription = simulation.simulatedConfigurationDescription;
|
||||
this.simulatedConfigurationID = simulation.simulatedConfigurationID;
|
||||
if (simulation.simulatedConditions == null) {
|
||||
this.simulatedConditions = null;
|
||||
} else {
|
||||
this.simulatedConditions = simulation.simulatedConditions.clone();
|
||||
}
|
||||
this.simulatedData = simulation.simulatedData;
|
||||
this.status = simulation.status;
|
||||
copyExtensionsFrom(simulation.getSimulationExtensions());
|
||||
} finally {
|
||||
mutex.unlock("loadFrom");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a duplicate of this simulation with the specified rocket. The new
|
||||
|
Loading…
x
Reference in New Issue
Block a user