if (blocks == null) {
return null;
}
if (which == PageElementPosition.START) {
BlockBox prev = null;
for (Iterator i = blocks.iterator(); i.hasNext(); ) {
BlockBox b = (BlockBox)i.next();
if (b.getStaticEquivalent().getAbsY() >= page.getTop()) {
break;
}
prev = b;
}
return prev;
} else if (which == PageElementPosition.FIRST) {
for (Iterator i = blocks.iterator(); i.hasNext(); ) {
BlockBox b = (BlockBox)i.next();
int absY = b.getStaticEquivalent().getAbsY();
if (absY >= page.getTop() && absY < page.getBottom()) {
return b;
}
}
return getRunningBlock(identifer, page, PageElementPosition.START);
} else if (which == PageElementPosition.LAST) {
BlockBox prev = null;
for (Iterator i = blocks.iterator(); i.hasNext(); ) {
BlockBox b = (BlockBox)i.next();
if (b.getStaticEquivalent().getAbsY() > page.getBottom()) {
break;
}
prev = b;
}
return prev;
} else if (which == PageElementPosition.LAST_EXCEPT) {
BlockBox prev = null;
for (Iterator i = blocks.iterator(); i.hasNext(); ) {
BlockBox b = (BlockBox)i.next();
int absY = b.getStaticEquivalent().getAbsY();
if (absY >= page.getTop() && absY < page.getBottom()) {
return null;
}
if (absY > page.getBottom()) {
break;