return path;
}
}
static void paintInputLines(InstancePainter painter, AbstractGate factory) {
Location loc = painter.getLocation();
boolean printView = painter.isPrintView();
GateAttributes attrs = (GateAttributes) painter.getAttributeSet();
Direction facing = attrs.facing;
int inputs = attrs.inputs;
int negated = attrs.negated;
int[] lengths = getInputLineLengths(attrs, factory);
if (painter.getInstance() == null) { // drawing ghost - negation bubbles only
for (int i = 0; i < inputs; i++) {
boolean iNegated = ((negated >> i) & 1) == 1;
if (iNegated) {
Location offs = factory.getInputOffset(attrs, i);
Location loci = loc.translate(offs.getX(), offs.getY());
Location cent = loci.translate(facing, lengths[i] + 5);
painter.drawDongle(cent.getX(), cent.getY());
}
}
} else {
Graphics g = painter.getGraphics();
Color baseColor = g.getColor();
GraphicsUtil.switchToWidth(g, 3);
for (int i = 0; i < inputs; i++) {
Location offs = factory.getInputOffset(attrs, i);
Location src = loc.translate(offs.getX(), offs.getY());
int len = lengths[i];
if (len != 0 && (!printView || painter.isPortConnected(i + 1))) {
if (painter.getShowState()) {
Value val = painter.getPort(i + 1);
g.setColor(val.getColor());
} else {
g.setColor(baseColor);
}
Location dst = src.translate(facing, len);
g.drawLine(src.getX(), src.getY(), dst.getX(), dst.getY());
}
if (((negated >> i) & 1) == 1) {
Location cent = src.translate(facing, lengths[i] + 5);
g.setColor(baseColor);
painter.drawDongle(cent.getX(), cent.getY());
GraphicsUtil.switchToWidth(g, 3);
}
}
}
}