Ejemplo n.º 1
0
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == btnReset) {
      stateGraphGraphics.auto.decolore();
      stateGraphGraphics.repaint();
    }

    if (e.getSource() == btnCycle) {
      stateGraphGraphics.auto.decolore();
      stateGraphGraphics.auto.colore(cycles.get(cyclesBox.getSelectedIndex()), true);
      stateGraphGraphics.repaint();
    }

    if (e.getSource() == btnPath) {
      stateGraphGraphics.auto.decolore();
      Path path =
          new Path(
              lines,
              combinasion.get(oneState.getSelectedIndex()),
              combinasion.get(twoStates.getSelectedIndex()));
      if (path.paths.size() != 0) {
        for (int i = 0; i < path.paths.size(); i++) {
          stateGraphGraphics.auto.colore(path.paths.get(i), false);
        }
      }
      for (State etat : stateGraphGraphics.auto.vStates) {
        if (etat.label.equals(combinasion.get(oneState.getSelectedIndex()).toString())
            || etat.label.equals(combinasion.get(twoStates.getSelectedIndex()).toString()))
          etat.couleurFond = Color.green;
      }
      stateGraphGraphics.repaint();
    }
  }
Ejemplo n.º 2
0
 public static void addRecord() {
   byte[] bytes = SaverAndLoader.saveStateToMem();
   if (currentState == null) {
     currentState = new State(bytes);
     head.next = currentState;
     tail.prev = currentState;
     currentState.prev = head;
     currentState.next = tail;
   } else {
     State newState = new State(bytes);
     currentState.next = newState;
     tail.prev = newState;
     newState.prev = currentState;
     newState.next = tail;
     currentState = newState;
   }
 }
Ejemplo n.º 3
0
 public static void clear() {
   head.next = tail;
   tail.prev = head;
   currentState = null;
 }
Ejemplo n.º 4
0
 static {
   head = new State(null);
   tail = new State(null);
   head.next = tail;
   tail.prev = head;
 }