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(); } }
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; } }
public static void clear() { head.next = tail; tail.prev = head; currentState = null; }
static { head = new State(null); tail = new State(null); head.next = tail; tail.prev = head; }