OutlineSpan nextSection(Node after) { for (Leaf l = after.getNextLeaf(); l != null; l = l.getNextLeaf()) { for (int i = 0, imax = l.sizeSticky(); i < imax; i++) { Mark m = l.getSticky(i); Object owner = m.getOwner(); if (owner instanceof OutlineSpan && ((OutlineSpan) owner).getStart() == m) { return (OutlineSpan) owner; // System.out.println("found next active = "+l.getNextLeaf()+", owner="+owner); } } } return null; }
OutlineSpan prevSection(Node before) { for (Leaf l = before.getPrevLeaf(); l != null; l = l.getPrevLeaf()) { for (int i = l.sizeSticky() - 1; i >= 0; i--) { // doesn't matte Mark m = l.getSticky(i); Object owner = m.getOwner(); if (owner instanceof OutlineSpan && ((OutlineSpan) owner).getStart() == m) { return (OutlineSpan) owner; // System.out.println("found next active = "+l.getNextLeaf()+", owner="+owner); } } } return null; }