Query q = session.createQuery(query.toString());
int queryPos = 0;
q.setString(queryPos++, questionId);
com.liferay.portlet.polls.model.PollsChoice[] array = new com.liferay.portlet.polls.model.PollsChoice[3];
ScrollableResults sr = q.scroll();
if (sr.first()) {
while (true) {
PollsChoiceHBM pollsChoiceHBM = (PollsChoiceHBM)sr.get(0);
if (pollsChoiceHBM == null) {
break;
}
com.liferay.portlet.polls.model.PollsChoice curPollsChoice = PollsChoiceHBMUtil.model(pollsChoiceHBM);
int value = obc.compare(pollsChoice, curPollsChoice);
if (value == 0) {
if (!pollsChoice.equals(curPollsChoice)) {
break;
}
array[1] = curPollsChoice;
if (sr.previous()) {
array[0] = PollsChoiceHBMUtil.model((PollsChoiceHBM)sr.get(
0));
}
sr.next();
if (sr.next()) {
array[2] = PollsChoiceHBMUtil.model((PollsChoiceHBM)sr.get(
0));
}
break;
}
if (count == 1) {
break;
}
count = (int)Math.ceil(count / 2.0);
if (value < 0) {
if (!sr.scroll(count * -1)) {
break;
}
}
else {
if (!sr.scroll(count)) {
break;
}
}
}
}