public void fromXmlDom(Element element) throws DuplicateIdException { NodeList nl = element.getElementsByTagName("complex"); Element ne = (Element) nl.item(0); complexOrAnd = Boolean.parseBoolean(ne.getAttribute("type")); setConfig(ne.getAttribute("config")); super.fromXmlDom(element); }
public void refresh() { GateContact.StateType res = (complexOrAnd) ? GateContact.StateType.set : GateContact.StateType.reset; for (SubGate sg : subGates) { GateContact.StateType inres = (complexOrAnd) ? GateContact.StateType.reset : GateContact.StateType.set; for (GateContact cin : sg.in) { if (cin.getState() == GateContact.StateType.reset) { if (!complexOrAnd) { inres = GateContact.StateType.reset; break; } } else { if (complexOrAnd) { inres = GateContact.StateType.set; break; } } } if (inres == GateContact.StateType.reset) { if (complexOrAnd) { res = GateContact.StateType.reset; break; } } else { if (!complexOrAnd) { res = GateContact.StateType.set; break; } } } out.getFirst().setState(res); super.refresh(); }
public void doDraw(Painter p) { super.doDraw(p); p.setShapeMode(ShapeMode.FILL_AND_OUTLINE); p.setLineMode(LineMode.SOLID); p.setLineWidth(0.0075f); p.setLineColor((selected) ? selectedOutlineColor : (canWork) ? userOutlineColor : outlineColor); p.setFillColor( (selected) ? selectedFillColor : (canFire) ? enabledFillColor : (lostSignal) ? lostSignalFillColor : fillColor); for (SubGate sg : subGates) { if (sg.in.size() < 2) continue; p.setTransform(transform.getLocalToViewMatrix()); p.translate(-rad * 0.75f, -sg.y); p.drawShape((complexOrAnd) ? or_shape : and_shape); } p.setTransform(transform.getLocalToViewMatrix()); p.translate(-((complexOrAnd) ? -subrad : -subrad + rad * 0.1f), 0.0f); p.drawShape((!complexOrAnd) ? or_shape : and_shape); // draw invertion circles for (GateContact c : in) { c.doDrawInvert(p); } out.getFirst().doDrawInvert(p); }