Package com.cburch.logisim.circuit

Examples of com.cburch.logisim.circuit.CircuitState


  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);
View Full Code Here


    }
  }
 
  private void checkCurrent() {
    if (state != null && canvas != null) {
      CircuitState s0 = state.getCircuitState();
      CircuitState s1 = canvas.getCircuitState();
      if (s0 != s1) {
        state = new InstanceStateImpl(s1, comp);
      }
    }
  }
View Full Code Here

      }
      Collections.sort(newChildren, new CompareByName());
      Collections.sort(subcircs, this);
      for (Component comp : subcircs) {
        SubcircuitFactory factory = (SubcircuitFactory) comp.getFactory();
        CircuitState state = factory.getSubstate(circuitState, comp);
        CircuitNode toAdd = null;
        for (TreeNode o : children) {
          if (o instanceof CircuitNode) {
            CircuitNode n = (CircuitNode) o;
            if (n.circuitState == state) { toAdd = n; break; }
View Full Code Here

  public void setLogModel(Model value) {
    this.logModel = value;
   
    DefaultTreeModel model = (DefaultTreeModel) getModel();
    CircuitNode curRoot = (CircuitNode) model.getRoot();
    CircuitState state = logModel == null ? null : logModel.getCircuitState();
    if (state == null) {
      if (curRoot != null) model.setRoot(null);
      return;
    }
    if (curRoot == null || curRoot.circuitState != state) {
View Full Code Here

  public CircuitState getCurrentView() {
    return currentView;
  }
 
  public void setCurrentView(CircuitState value) {
    CircuitState oldView = currentView;
    if (oldView != value) {
      currentView = value;

      SimulationTreeCircuitNode node1 = mapToNode(oldView);
      if (node1 != null) fireNodeChanged(node1);
View Full Code Here

  }
 
  public TreePath mapToPath(CircuitState state) {
    if (state == null) return null;
    ArrayList<CircuitState> path = new ArrayList<CircuitState>();
    CircuitState current = state;
    CircuitState parent = current.getParentState();
    while (parent != null && parent != state) {
      path.add(current);
      current = parent;
      parent = current.getParentState();
    }
View Full Code Here

 
  public CircuitState getCircuitState(Circuit circuit) {
    if (circuitState != null && circuitState.getCircuit() == circuit) {
      return circuitState;
    } else {
      CircuitState ret = stateMap.get(circuit);
      if (ret == null) {
        ret = new CircuitState(this, circuit);
        stateMap.put(circuit, ret);
      }
      return ret;
    }
  }
View Full Code Here

  }

  public void setCircuitState(CircuitState value) {
    if (value == null || circuitState == value) return;

    CircuitState old = circuitState;
    Circuit oldCircuit = old == null ? null : old.getCircuit();
    Circuit newCircuit = value.getCircuit();
    boolean circuitChanged = old == null || oldCircuit != newCircuit;
    if (circuitChanged) {
      Canvas canvas = frame == null ? null : frame.getCanvas();
      if (canvas != null) {
View Full Code Here

    }
    fireEvent(ProjectEvent.ACTION_SET_STATE, old, circuitState);
  }

  public void setCurrentCircuit(Circuit circuit) {
    CircuitState circState = stateMap.get(circuit);
    if (circState == null) circState = new CircuitState(this, circuit);
    setCircuitState(circState);
  }
View Full Code Here

  private static final int SPINE_DOT = Wire.WIDTH + 4;
 
  static void drawLines(ComponentDrawContext context,
      SplitterAttributes attrs, Location origin) {
    boolean showState = context.getShowState();
    CircuitState state = showState ? context.getCircuitState() : null;
    if (state == null) showState = false;

    SplitterParameters parms = attrs.getParameters();
    int x0 = origin.getX();
    int y0 = origin.getY();
    int x = x0 + parms.getEnd0X();
    int y = y0 + parms.getEnd0Y();
    int dx = parms.getEndToEndDeltaX();
    int dy = parms.getEndToEndDeltaY();
    int dxEndSpine = parms.getEndToSpineDeltaX();
    int dyEndSpine = parms.getEndToSpineDeltaY();
   
    Graphics g = context.getGraphics();
    Color oldColor = g.getColor();
    GraphicsUtil.switchToWidth(g, Wire.WIDTH);
    for (int i = 0, n = attrs.fanout; i < n; i++) {
      if (showState) {
        Value val = state.getValue(Location.create(x, y));
        g.setColor(val.getColor());
      }
      g.drawLine(x, y, x + dxEndSpine, y + dyEndSpine);
      x += dx;
      y += dy;
View Full Code Here

TOP

Related Classes of com.cburch.logisim.circuit.CircuitState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.