public void parseFiles(SwiftDocOps<V> seq) throws Exception { SortedSet<ZipEntry> patches = getPatchFiles(); ZipEntry initial = patches.first(); // Populate initial doc with List<Object> doc = new ArrayList<Object>(); for (String i : fileToLines(initial)) { if (seq != null) { seq.begin(); seq.add(seq.size(), seq.gen(i)); seq.commit(); } doc.add(i); } int k = 0; for (ZipEntry i : patches) { if (i == initial) continue; System.err.printf("\r%s -> %d %% done...", i, 100 * k++ / patches.size()); if (seq != null) seq.begin(); doc.add(i.getName()); seq.add(0, seq.gen(i.getName())); // Patch patch = DiffUtils.parseUnifiedDiff(fileToLines(i)); // // List<Object> result = new HelperList<Object>(doc, seq); // // List<Delta> deltas = patch.getDeltas(); // ListIterator<Delta> it = deltas.listIterator(deltas.size()); // while (it.hasPrevious()) { // Delta delta = (Delta) it.previous(); // delta.applyTo(result); // } // doc = result; if (seq != null) seq.commit(); if (i.getName().startsWith("500-")) return; } System.err.println("All Done"); }
@Override public void add(int i, T v) { if (mirror != null) mirror.add(i, mirror.gen(v.toString())); super.add(i, v); }