use of maspack.properties.NumericConverter in project artisynth_core by artisynth.
the class NumericProbeBase method clone.
public Object clone() throws CloneNotSupportedException {
NumericProbeBase probe = (NumericProbeBase) super.clone();
probe.myNumericList = (NumericList) myNumericList.clone();
probe.myInterpolation = new Interpolation(myInterpolation);
if (myVariables != null) {
// make a deep copy of the variable list
probe.myVariables = new LinkedHashMap<String, NumericProbeVariable>();
for (Map.Entry<String, NumericProbeVariable> entry : myVariables.entrySet()) {
probe.myVariables.put(entry.getKey(), new NumericProbeVariable(entry.getValue()));
}
}
if (myDrivers != null) {
probe.myDrivers = new ArrayList<NumericProbeDriver>();
for (NumericProbeDriver oldDriver : myDrivers) {
NumericProbeDriver driver = new NumericProbeDriver();
try {
driver.setExpression(oldDriver.getExpression(), probe.myVariables);
} catch (Exception e) {
throw new InternalErrorException("Illegal driver expression '" + oldDriver.getExpression() + "': " + e.getMessage());
}
probe.myDrivers.add(driver);
}
}
if (myPropList != null) {
probe.myPropList = (ArrayList<Property>) myPropList.clone();
}
if (myConverters != null) {
probe.myConverters = new NumericConverter[myConverters.length];
for (int i = 0; i < myConverters.length; i++) {
probe.myConverters[i] = new NumericConverter(myConverters[i]);
}
}
// clear the displays because these are lazily allocated and
// we don't want them reused
probe.mySmallDisplay = null;
probe.myDisplays = new ArrayList<NumericProbePanel>();
// attached file should also not be brought into clone
probe.myAttachedFileName = null;
return probe;
}
Aggregations