Esempio n. 1
0
 public void draw(ComponentDrawContext context) {
   CircuitState state = context.getCircuitState();
   Graphics g = context.getGraphics();
   GraphicsUtil.switchToWidth(g, WIDTH);
   g.setColor(state.getValue(e0).getColor());
   g.drawLine(e0.getX(), e0.getY(), e1.getX(), e1.getY());
 }
 public void setData(InstanceData value) {
   CircuitState circState = context.getCircuitState();
   if (circState == null || comp == null) {
     throw new UnsupportedOperationException("setData on InstancePainter");
   } else {
     circState.setData(comp, value);
   }
 }
 public InstanceData getData() {
   CircuitState circState = context.getCircuitState();
   if (circState == null || comp == null) {
     throw new UnsupportedOperationException("setData on InstancePainter");
   } else {
     return (InstanceData) circState.getData(comp);
   }
 }
 public Value getPortValue(int portIndex) {
   InstanceComponent c = comp;
   CircuitState s = context.getCircuitState();
   if (c != null && s != null) {
     return s.getValue(c.getEnd(portIndex).getLocation());
   } else {
     return Value.UNKNOWN;
   }
 }
 public boolean isCircuitRoot() {
   return !context.getCircuitState().isSubstate();
 }
 public long getTickCount() {
   return context.getCircuitState().getPropagator().getTickCount();
 }
 //
 // methods related to the circuit state
 //
 public Project getProject() {
   return context.getCircuitState().getProject();
 }