Author: navssurtani
Date: 2008-06-26 13:05:52 -0400 (Thu, 26 Jun 2008)
New Revision: 6062
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
Log:
Nicened up hasPrevious and hasNext methods in QRII
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-06-26
17:01:49 UTC (rev 6061)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-06-26
17:05:52 UTC (rev 6062)
@@ -20,11 +20,14 @@
private int nextObjectIndex = -1;
private List<CacheEntityId> idList;
private CacheEntityLoader entityLoader;
+ private int lowerLimit = 0;
+ private int upperLimit = 0;
public QueryResultIteratorImpl(List<CacheEntityId> idList, CacheEntityLoader
entityLoader)
{
this.idList = idList;
this.entityLoader = entityLoader;
+ upperLimit = idList.size() - 1;
}
public void jumpToResult(int index) throws IndexOutOfBoundsException
@@ -78,14 +81,7 @@
public boolean hasNext()
{
- if (idList.size() != 1)
- {
- return !isLast();
- }
- else
- {
- return false;
- }
+ return index <= upperLimit;
}
public Object next()
@@ -98,16 +94,10 @@
public boolean hasPrevious()
{
- if (idList.size() != 1)
- {
- return !isFirst();
- }
- else
- {
- return false;
- }
+ return index >= lowerLimit;
}
+
public Object previous()
{
if (!hasPrevious()) throw new NoSuchElementException("Out of
boundaries");
Show replies by date