use of com.cburch.logisim.circuit.CircuitState in project logisim-evolution by reds-heig.
the class TestThread method matchPins.
void matchPins() throws TestException {
int n = vector.columnName.length;
pin = new Instance[n];
CircuitState state = new CircuitState(this.project, this.circuit);
for (int i = 0; i < n; i++) {
String columnName = vector.columnName[i];
for (Component comp : circuit.getNonWires()) {
if (!(comp.getFactory() instanceof Pin))
continue;
Instance inst = Instance.getInstanceFor(comp);
InstanceState pinState = state.getInstanceState(comp);
String label = pinState.getAttributeValue(StdAttr.LABEL);
if (label == null || !label.equals(columnName))
continue;
if (Pin.FACTORY.getWidth(inst).getWidth() != vector.columnWidth[i].getWidth())
throw new TestException("test vector column '" + columnName + "' has width " + vector.columnWidth[i] + ", but pin has width " + Pin.FACTORY.getWidth(inst));
pin[i] = inst;
break;
}
if (pin[i] == null)
throw new TestException("test vector column '" + columnName + "' has no matching pin");
}
}
use of com.cburch.logisim.circuit.CircuitState in project logisim-evolution by reds-heig.
the class SimulationTreeModel method setCurrentView.
public void setCurrentView(CircuitState value) {
CircuitState oldView = currentView;
if (oldView != value) {
currentView = value;
SimulationTreeCircuitNode node1 = mapToNode(oldView);
if (node1 != null)
fireNodeChanged(node1);
SimulationTreeCircuitNode node2 = mapToNode(value);
if (node2 != null)
fireNodeChanged(node2);
}
}
use of com.cburch.logisim.circuit.CircuitState in project logisim-evolution by reds-heig.
the class InstancePokerAdapter method getPokeCaret.
public Caret getPokeCaret(ComponentUserEvent event) {
if (poker == null) {
return null;
} else {
canvas = event.getCanvas();
CircuitState circState = event.getCircuitState();
InstanceStateImpl state = new InstanceStateImpl(circState, comp);
MouseEvent e = new MouseEvent(event.getCanvas(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, event.getX(), event.getY(), 1, false);
boolean isAccepted = poker.init(state, e);
if (isAccepted) {
this.state = state;
this.context = new ComponentDrawContext(event.getCanvas(), event.getCanvas().getCircuit(), circState, null, null);
mousePressed(e);
return this;
} else {
poker = null;
return null;
}
}
}
use of com.cburch.logisim.circuit.CircuitState in project logisim-evolution by reds-heig.
the class InstancePokerAdapter method checkCurrent.
private void checkCurrent() {
if (state != null && canvas != null) {
CircuitState s0 = state.getCircuitState();
CircuitState s1 = canvas.getCircuitState();
if (s0 != s1) {
state = new InstanceStateImpl(s1, comp);
}
}
}
use of com.cburch.logisim.circuit.CircuitState in project logisim-evolution by reds-heig.
the class ComponentDrawContext method drawPin.
public void drawPin(Component comp, int i) {
EndData e = comp.getEnd(i);
Location pt = e.getLocation();
Color curColor = g.getColor();
if (getShowState()) {
CircuitState state = getCircuitState();
g.setColor(state.getValue(pt).getColor());
} else {
g.setColor(Color.BLACK);
}
g.fillOval(pt.getX() - PIN_OFFS, pt.getY() - PIN_OFFS, PIN_RAD, PIN_RAD);
g.setColor(curColor);
}
Aggregations