public ArrayList<FileRegion> getFileRegions() { ArrayList<FileRegion> regions = new ArrayList<FileRegion>(); for (OpenDefinitionsDocument odd : _documents) { File f = odd.getRawFile(); for (R r : _regions.get(odd)) regions.add(new DummyDocumentRegion(f, r.getStartOffset(), r.getEndOffset())); } return regions; }
/** * Updates _lineStartPos, _lineEndPos of regions in the interval [firstRegion, lastRegion] using * total ordering on regions. Removes empty regions. firstRegion and lastRegion are not * necessarily regions in this manager. */ public void updateLines(R firstRegion, R lastRegion) { assert Utilities.TEST_MODE || EventQueue.isDispatchThread(); /* Get the tailSet consisting of the ordered set of regions >= firstRegion. */ SortedSet<R> tail = getTailSet(firstRegion); if (tail.size() == 0) return; // tail can be empty if firstRegion is a constructed DocumentRegion List<R> toBeRemoved = new ArrayList<R>(); // nonsense to avoid concurrent modification exception for (R region : tail) { if (region.compareTo(lastRegion) > 0) break; region.update(); // The bounds of this region must be recomputed. if (region.getStartOffset() == region.getEndOffset()) toBeRemoved.add(region); } removeRegions(toBeRemoved); }