Set curves = getAllCurves();
Map curveNumbers = new HashMap(); // CubicCurves to Integers
int count = 0;
for (Iterator i=curves.iterator(); i.hasNext(); ) {
Curve curve = (Curve) i.next();
XmlNode curveNode = node.addChild(CurveTag);
CurveFactory.save(curve, curveNode);
curveNumbers.put(curve, count++);
}
for (Iterator i=comps.iterator(); i.hasNext(); ) {
CurveComponent comp = (CurveComponent) i.next();
XmlNode compNode = node.addChild(ComponentTag);
Set compCurves = getCurves(comp);
for (Iterator j=compCurves.iterator(); j.hasNext(); ) {
Curve compCurve = (Curve) j.next();
Integer index = (Integer) curveNumbers.get(compCurve);
XmlNode refNode = compNode.addChild(ReferenceTag);
refNode.setAttribute(IndexTag, index.toString());
}
}
}