}
}
private void buildCircuit(XmlReader.CircuitData circData, CircuitMutator mutator) {
Element elt = circData.circuitElement;
Circuit dest = circData.circuit;
Map<Element, Component> knownComponents = circData.knownComponents;
if (knownComponents == null) {
knownComponents = Collections.emptyMap();
}
try {
reader.initAttributeSet(circData.circuitElement, dest.getStaticAttributes(), null);
} catch (XmlReaderException e) {
reader.addErrors(e, circData.circuit.getName() + ".static");
}
for (Element sub_elt : XmlIterator.forChildElements(elt)) {
String sub_elt_name = sub_elt.getTagName();
if (sub_elt_name.equals("comp")) {
try {
Component comp = knownComponents.get(sub_elt);
if (comp == null) {
comp = getComponent(sub_elt, reader);
}
mutator.add(dest, comp);
} catch (XmlReaderException e) {
reader.addErrors(e, circData.circuit.getName() + "." + toComponentString(sub_elt));
}
} else if (sub_elt_name.equals("wire")) {
try {
addWire(dest, mutator, sub_elt);
} catch (XmlReaderException e) {
reader.addErrors(e, circData.circuit.getName() + "." + toWireString(sub_elt));
}
}
}
List<AbstractCanvasObject> appearance = circData.appearance;
if (appearance != null && !appearance.isEmpty()) {
dest.getAppearance().setObjectsForce(appearance);
dest.getAppearance().setDefaultAppearance(false);
}
}