curve.restore(curveNode);
curveNumbers.put(count++, curve);
}
XmlNode[] compNodes = node.getChildren(ComponentTag);
if (compNodes.length != comps.size()) {
throw new XMLException(
"The number of regions doesn't match the number of tools"
);
}
Iterator compIter = comps.iterator();
for (XmlNode compNode : compNodes) {
CurveComponent comp = (CurveComponent) compIter.next();
XmlNode[] refNodes = compNode.getChildren(ReferenceTag);
for (XmlNode refNode : refNodes) {
String attr = refNode.getAttribute(IndexTag);
Integer index;
try {
index = Integer.valueOf(attr);
}
catch (NumberFormatException e) {
throw new XMLException("Expected a number: " + attr, e);
}
Curve curve = curveNumbers.get(index);
if (curve == null) {
throw new XMLException("Not a valid curve index: " + attr);
}
addCurve(comp, curve);
}
}
isRestoring = false;