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; }