Author: manik.surtani(a)jboss.com
Date: 2008-06-24 07:34:04 -0400 (Tue, 24 Jun 2008)
New Revision: 6012
Added:
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIterator.java
Log:
Added new public interfaces
Added: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
(rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java 2008-06-24
11:34:04 UTC (rev 6012)
@@ -0,0 +1,27 @@
+package org.jboss.cache.search;
+
+import org.apache.lucene.search.Sort;
+
+import java.util.List;
+
+/**
+ * // TODO: Javadoc this properly - probably copy the javadoc comments from FullTextQuery
since the methods will do pretty much the same thing.
+ *
+ * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
+ */
+public interface CacheQuery
+{
+ List<Object> list();
+
+ QueryResultIterator iterator();
+
+ void setFirstResult(int index);
+
+ void setMaxResults(int numResults);
+
+ void setFetchSize(int size);
+
+ int getResultSize();
+
+ void setSort(Sort s);
+}
Added: searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIterator.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIterator.java
(rev 0)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIterator.java 2008-06-24
11:34:04 UTC (rev 6012)
@@ -0,0 +1,59 @@
+package org.jboss.cache.search;
+
+import java.util.ListIterator;
+
+/**
+ * Iterates over query results
+ *
+ * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
+ */
+public interface QueryResultIterator extends ListIterator
+{
+ /**
+ * Jumps to a specific index in the iterator.
+ *
+ * @param index index to jump to.
+ * @throws IndexOutOfBoundsException if the index is out of bounds
+ */
+ void jumpToResult(int index) throws IndexOutOfBoundsException;
+
+ /**
+ * Jumps to the first result
+ */
+ void first();
+
+ /**
+ * Jumps to the last result
+ */
+ void last();
+
+ /**
+ * Jumps to the one-after-the-first result
+ */
+ void afterFirst();
+
+ /**
+ * Jumps to the one-before-the-last result
+ */
+ void beforeLast();
+
+ /**
+ * @return true if the current result is the first
+ */
+ boolean isFirst();
+
+ /**
+ * @return true if the current result is the last
+ */
+ boolean isLast();
+
+ /**
+ * @return true if the current result is one after the first
+ */
+ boolean isAfterFirst();
+
+ /**
+ * @return true if the current result is one before the last
+ */
+ boolean isBeforeLast();
+}