!include #1001196 // Lisp static class AList implements Iterable { new L data; // don't access this from outside // these are ok to access (but not change) from outside final S id = randomID(8); final L history = synchroList(); public synchronized void add(A a) { data.add(a); history.add(lisp("add", structure(a))); } public synchronized void clear() { data.clear(); history.add(lisp("clear")); } public synchronized void remove(int i) { data.remove(i); history.add(lisp("remove", "" + i)); } public synchronized void remove(A a) { int i = data.indexOf(a); if (i >= 0) remove(i); } public synchronized int indexOf(A a) { return data.indexOf(a); } public synchronized A get(int i) { return data.get(i); } public S getID() { return id; } public synchronized int size() { return data.size(); } public synchronized Iterator iterator() { ret new ArrayList(data).iterator(); } public synchronized List shoot() { ret new ArrayList(data); } }