// a persistent list that only grows (or is clear()ed) // Note: don't put in static initializer (programID not set yet) static class PersistentLog<A> extends AbstractList<A> { new L<A> l; File file; PersistentLog(S fileName) { this(getProgramFile(fileName)); } PersistentLog(S progID, S fileName) { this(getProgramFile(progID, fileName)); } *(File *file) { for (S s : scanLog(file)) pcall { l.add((A) unstructure(s)); } } public synchronized int size() { ret l.size(); } public synchronized A get(int i) { ret l.get(i); } public synchronized bool add(A a) { l.add(a); logQuoted(file, structure(a)); ret true; } S fileContents() { ret loadTextFile(file); } public synchronized void clear() { l.clear(); file.delete(); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment