//TODO: take another look at Probe design (maybe Probeables reference Probes?)
result.mySimulator = mySimulator.clone();
result.mySimulator.initialize(result);
Probe[] oldProbes = mySimulator.getProbes();
for (Probe oldProbe : oldProbes) {
Probeable target = oldProbe.getTarget();
if (target instanceof Node) {
Node oldNode = (Node) target;
if (oldProbe.isInEnsemble()) {
try {
Ensemble oldEnsemble = (Ensemble) getNode(oldProbe.getEnsembleName());
int neuronIndex = -1;
for (int j = 0; j < oldEnsemble.getNodes().length && neuronIndex < 0; j++) {
if (oldNode == oldEnsemble.getNodes()[j]) {
neuronIndex = j;
}
}
result.mySimulator.addProbe(oldProbe.getEnsembleName(), neuronIndex, oldProbe.getStateName(), true);
} catch (SimulationException e) {
ourLogger.warn("Problem copying Probe", e);
} catch (StructuralException e) {
ourLogger.warn("Problem copying Probe", e);
}
} else {
try {
result.mySimulator.addProbe(oldNode.getName(), oldProbe.getStateName(), true);
} catch (SimulationException e) {
ourLogger.warn("Problem copying Probe", e);
}
}
} else {
ourLogger.warn("Can't copy Probe on type " + target.getClass().getName()
+ " (to be addressed in a future release)");
}
}
return result;