Fixed getCloneWithModifiedData valuation of simultaneous specification
of stochasticDriver and seed.
@@ -358,15 +358,19 @@ public class EulerSchemeFromProcessModel extends MonteCarloProcessFromProcessMod
public MonteCarloProcess getCloneWithModifiedData(final Map<String, Object> dataModified) {
final ProcessModel newModel = (ProcessModel) dataModified.getOrDefault("model", getModel());
+ if(dataModified.containsKey("seed") && dataModified.containsKey("stochasticDriver")) {
+ throw new IllegalArgumentException("Simultaneous specification of stochasticDriver and seed.");
+ }
+
final IndependentIncrements newStochasticDriver;
- if(dataModified.containsKey("seed") && !dataModified.containsKey("stochasticDriver")) {
+ if(dataModified.containsKey("seed")) {
newStochasticDriver = getStochasticDriver().getCloneWithModifiedSeed((int)dataModified.get("seed"));
}
- else if(!dataModified.containsKey("seed") && dataModified.containsKey("stochasticDriver")) {
+ else if(dataModified.containsKey("stochasticDriver")) {
newStochasticDriver = (IndependentIncrements) dataModified.getOrDefault("stochasticDriver", stochasticDriver);
}
else {
- throw new IllegalArgumentException("Simultaneous specification of stochasticDriver and seed.");
+ newStochasticDriver = stochasticDriver;
}
Scheme newScheme = (Scheme) dataModified.getOrDefault("scheme", scheme);
