1 17 18 19 20 package org.apache.fop.layoutmgr; 21 22 import java.util.List ; 23 24 public class KnuthPossPosIter extends PositionIterator { 25 26 private int iterCount; 27 28 34 public KnuthPossPosIter(List elementList, int startPos, int endPos) { 35 super(elementList.listIterator(startPos)); 36 iterCount = endPos - startPos; 37 } 38 39 43 public KnuthPossPosIter(List elementList) { 44 this(elementList, 0, elementList.size()); 45 } 46 47 49 52 protected boolean checkNext() { 53 if (iterCount > 0) { 54 return super.checkNext(); 55 } else { 56 endIter(); 57 return false; 58 } 59 } 60 61 64 public Object next() { 65 --iterCount; 66 return super.next(); 67 } 68 69 public ListElement getKE() { 70 return (ListElement) peekNext(); 71 } 72 73 protected LayoutManager getLM(Object nextObj) { 74 return ((ListElement) nextObj).getLayoutManager(); 75 } 76 77 protected Position getPos(Object nextObj) { 78 return ((ListElement) nextObj).getPosition(); 79 } 80 } 81 | Popular Tags |