Package com.cburch.logisim.circuit

Examples of com.cburch.logisim.circuit.CircuitState


  public String toString() {
    return longDescriptor;
  }
 
  public Value fetchValue(CircuitState root) {
    CircuitState cur = root;
    for (int i = 0; i < path.length; i++) {
      SubcircuitFactory circFact = (SubcircuitFactory) path[i].getFactory();
      cur = circFact.getSubstate(cur, path[i]);
    }
    Loggable log = (Loggable) comp.getFeature(Loggable.class);
View Full Code Here


    fileHeader = value;
    fireFilePropertyChanged(new ModelEvent());
  }
 
  public void propagationCompleted() {
    CircuitState circuitState = getCircuitState();
    Value[] vals = new Value[selection.size()];
    boolean changed = false;
    for (int i = selection.size() - 1; i >= 0; i--) {
      SelectionItem item = selection.get(i);
      vals[i] = item.fetchValue(circuitState);
View Full Code Here

      if (!attrs.isInput()) return;
 
      java.awt.Component sourceComp = e.getComponent();
      if (sourceComp instanceof Canvas && !state.isCircuitRoot()) {
        Canvas canvas = (Canvas) e.getComponent();
        CircuitState circState = canvas.getCircuitState();
        java.awt.Component frame = SwingUtilities.getRoot(canvas);
        int choice = JOptionPane.showConfirmDialog(frame,
            Strings.get("pinFrozenQuestion"),
            Strings.get("pinFrozenTitle"),
            JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.WARNING_MESSAGE);
        if (choice == JOptionPane.OK_OPTION) {
          circState = circState.cloneState();
          canvas.getProject().setCircuitState(circState);
          state = circState.getInstanceState(state.getInstance());
        } else {
          return;
        }
      }
 
View Full Code Here

        EndData e = comp.getEnd(i);
        Location pt = e.getLocation();
        int x = pt.getX();
        int y = pt.getY();
        if (getShowState()) {
            CircuitState state = getCircuitState();
            g.setColor(state.getValue(pt).getColor());
        } else {
            g.setColor(Color.BLACK);
        }

        g.fillOval(x - PIN_OFFS, y - PIN_OFFS, PIN_RAD, PIN_RAD);
View Full Code Here

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

    public void drawPins(Component comp) {
        Color curColor = g.getColor();
        for (EndData e : comp.getEnds()) {
            Location pt = e.getLocation();
            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);
        }
View Full Code Here

                    haltPin = pin;
                }
            }
        }

        CircuitState circState = new CircuitState(proj, circuit);
        // we have to do our initial propagation before the simulation starts -
        // it's necessary to populate the circuit with substates.
        circState.getPropagator().propagate();
        if (args.getLoadFile() != null) {
            try {
                boolean loaded = loadRam(circState, args.getLoadFile());
                if (!loaded) {
                    //OK
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

        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

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.