[hibernate-commits] Hibernate SVN: r15628 - in search/trunk/src/java/org/hibernate/search: filter and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Sat Nov 29 09:06:12 EST 2008


Author: sannegrinovero
Date: 2008-11-29 09:06:12 -0500 (Sat, 29 Nov 2008)
New Revision: 15628

Modified:
   search/trunk/src/java/org/hibernate/search/event/ContextHolder.java
   search/trunk/src/java/org/hibernate/search/filter/AndDocIdSet.java
   search/trunk/src/java/org/hibernate/search/filter/EmptyDocIdBitSet.java
   search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java
Log:
javadoc and really minor code improvements

Modified: search/trunk/src/java/org/hibernate/search/event/ContextHolder.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/event/ContextHolder.java	2008-11-29 13:10:14 UTC (rev 15627)
+++ search/trunk/src/java/org/hibernate/search/event/ContextHolder.java	2008-11-29 14:06:12 UTC (rev 15628)
@@ -18,7 +18,7 @@
 			new ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>>();
 
 	//code doesn't have to be multithreaded because SF creation is not.
-	//this is not a public API, should really only be used during the SessionFActory building
+	//this is not a public API, should really only be used during the SessionFactory building
 	public static SearchFactoryImpl getOrBuildSearchFactory(Configuration cfg) {
 		WeakHashMap<Configuration, SearchFactoryImpl> contextMap = contexts.get();
 		if ( contextMap == null ) {

Modified: search/trunk/src/java/org/hibernate/search/filter/AndDocIdSet.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/filter/AndDocIdSet.java	2008-11-29 13:10:14 UTC (rev 15627)
+++ search/trunk/src/java/org/hibernate/search/filter/AndDocIdSet.java	2008-11-29 14:06:12 UTC (rev 15628)
@@ -1,3 +1,4 @@
+// $Id$
 package org.hibernate.search.filter;
 
 import java.io.IOException;
@@ -20,7 +21,6 @@
 	
 	private DocIdSet docIdBitSet;
 	private final List<DocIdSet> andedDocIdSets;
-	
 	private final int maxDocNumber;
 	
 	public AndDocIdSet(List<DocIdSet> andedDocIdSets, int maxDocs) {


Property changes on: search/trunk/src/java/org/hibernate/search/filter/AndDocIdSet.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: search/trunk/src/java/org/hibernate/search/filter/EmptyDocIdBitSet.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/filter/EmptyDocIdBitSet.java	2008-11-29 13:10:14 UTC (rev 15627)
+++ search/trunk/src/java/org/hibernate/search/filter/EmptyDocIdBitSet.java	2008-11-29 14:06:12 UTC (rev 15628)
@@ -1,6 +1,6 @@
+// $Id$
 package org.hibernate.search.filter;
 
-import java.io.IOException;
 import java.io.Serializable;
 
 import org.apache.lucene.search.DocIdSet;
@@ -9,6 +9,7 @@
 /**
  * A DocIdSet which is always empty.
  * Stateless and ThreadSafe.
+ * 
  * @author Sanne Grinovero
  */
 public final class EmptyDocIdBitSet extends DocIdSet implements Serializable {
@@ -17,7 +18,7 @@
 
 	public static final DocIdSet instance = new EmptyDocIdBitSet();
 	
-	private final DocIdSetIterator iterator = new EmptyDocIdSetIterator();
+	private static final DocIdSetIterator iterator = new EmptyDocIdSetIterator();
 	
 	private EmptyDocIdBitSet(){
 		// is singleton
@@ -40,12 +41,12 @@
 		}
 
 		@Override
-		public final boolean next() throws IOException {
+		public final boolean next() {
 			return false;
 		}
 
 		@Override
-		public final boolean skipTo(int target) throws IOException {
+		public final boolean skipTo(int target) {
 			return false;
 		}
 


Property changes on: search/trunk/src/java/org/hibernate/search/filter/EmptyDocIdBitSet.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java	2008-11-29 13:10:14 UTC (rev 15627)
+++ search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java	2008-11-29 14:06:12 UTC (rev 15628)
@@ -29,22 +29,24 @@
 import org.hibernate.type.Type;
 
 /**
- * Implements scollable and paginated resultsets.
- * Contrary to query#iterate() or query#list(), this implementation is
+ * Implements scrollable and paginated resultsets.
+ * Contrary to Query#iterate() or Query#list(), this implementation is
  * exposed to returned null objects (if the index is out of date).
  * <p/>
  * <p/>
- * +  * The following methods that change the value of 'current' will check
- * +  * and set its value to either 'afterLast' or 'beforeFirst' depending
- * +  * on direction. This is to prevent rogue values from setting it outside
- * +  * the boundaries of the results.
- * +  * <ul>
- * +  * <li>next()</li>
- * +  * <li>previous()</li>
- * +  * <li>scroll(i)</li>
- * +  * <li>last()</li>
- * +  * <li>first()</li>
- * +  * </ul>
+ * The following methods that change the value of 'current' will check
+ * and set its value to either 'afterLast' or 'beforeFirst' depending
+ * on direction. This is to prevent rogue values from setting it outside
+ * the boundaries of the results.
+ * <ul>
+ * <li>next()</li>
+ * <li>previous()</li>
+ * <li>scroll(i)</li>
+ * <li>last()</li>
+ * <li>first()</li>
+ * </ul>
+ * 
+ * @see org.hibernate.Query
  *
  * @author Emmanuel Bernard
  * @author John Griffin
@@ -125,14 +127,12 @@
 	}
 
 	/**
-	 * Increases cursor pointer by one. If this places it >
-	 * max + 1 (afterLast) then set it to afterLast and return
-	 * false.
-	 *
-	 * @return booolean
-	 * @throws HibernateException
+	 * {@inheritDoc}
 	 */
-	public boolean next() throws HibernateException {
+	public boolean next() {
+		//	Increases cursor pointer by one. If this places it >
+		//	max + 1 (afterLast) then set it to afterLast and return
+		//	false.
 		if ( ++current > max ) {
 			afterLast();
 			return false;
@@ -140,15 +140,10 @@
 		return true;
 	}
 
-	/**
-	 * Decreases cursor pointer by one. If this places it <
-	 * first - 1 (beforeFirst) then set it to beforeFirst and
-	 * return false.
-	 *
-	 * @return boolean
-	 * @throws HibernateException
-	 */
-	public boolean previous() throws HibernateException {
+	public boolean previous() {
+		//	Decreases cursor pointer by one. If this places it <
+		//	first - 1 (beforeFirst) then set it to beforeFirst and
+		//	return false.
 		if ( --current < first ) {
 			beforeFirst();
 			return false;
@@ -156,16 +151,10 @@
 		return true;
 	}
 
-	/**
-	 * Since we have to take into account that we can scroll any
-	 * amount positive or negative, we perform the same tests that
-	 * we performed in next() and previous().
-	 *
-	 * @param i the scroll distance.
-	 * @return boolean
-	 * @throws HibernateException
-	 */
-	public boolean scroll(int i) throws HibernateException {
+	public boolean scroll(int i) {
+		//  Since we have to take into account that we can scroll any
+		//  amount positive or negative, we perform the same tests that
+		//  we performed in next() and previous().
 		current = current + i;
 		if ( current > max ) {
 			afterLast();
@@ -180,7 +169,7 @@
 		}
 	}
 
-	public boolean last() throws HibernateException {
+	public boolean last() {
 		current = max;
 		if ( current < first ) {
 			beforeFirst();
@@ -189,7 +178,7 @@
 		return max >= first;
 	}
 
-	public boolean first() throws HibernateException {
+	public boolean first() {
 		current = first;
 		if ( current > max ) {
 			afterLast();
@@ -198,23 +187,23 @@
 		return max >= first;
 	}
 
-	public void beforeFirst() throws HibernateException {
+	public void beforeFirst() {
 		current = first - 1;
 	}
 
-	public void afterLast() throws HibernateException {
+	public void afterLast() {
 		current = max + 1;
 	}
 
-	public boolean isFirst() throws HibernateException {
+	public boolean isFirst() {
 		return current == first;
 	}
 
-	public boolean isLast() throws HibernateException {
+	public boolean isLast() {
 		return current == max;
 	}
 
-	public void close() throws HibernateException {
+	public void close() {
 		try {
 			searchFactory.getReaderProvider().closeReader( searcher.getIndexReader() );
 		}
@@ -235,96 +224,180 @@
 		return resultContext.get( entityInfos[current - first] );
 	}
 
-	public Object get(int i) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Object get(int i) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
 	public Type getType(int i) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Integer getInteger(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Integer getInteger(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Long getLong(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Long getLong(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Float getFloat(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Float getFloat(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Boolean getBoolean(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Boolean getBoolean(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Double getDouble(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Double getDouble(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Short getShort(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Short getShort(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Byte getByte(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Byte getByte(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Character getCharacter(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Character getCharacter(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public byte[] getBinary(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public byte[] getBinary(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public String getText(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public String getText(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Blob getBlob(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Blob getBlob(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Clob getClob(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Clob getClob(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public String getString(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public String getString(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public BigDecimal getBigDecimal(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public BigDecimal getBigDecimal(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public BigInteger getBigInteger(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public BigInteger getBigInteger(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Date getDate(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Date getDate(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Locale getLocale(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Locale getLocale(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public Calendar getCalendar(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public Calendar getCalendar(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public TimeZone getTimeZone(int col) throws HibernateException {
+	/**
+	 * This method is not supported on Lucene based queries
+	 * @throws UnsupportedOperationException always thrown
+	 */
+	public TimeZone getTimeZone(int col) {
 		throw new UnsupportedOperationException( "Lucene does not work on columns" );
 	}
 
-	public int getRowNumber() throws HibernateException {
+	public int getRowNumber() {
 		if ( max < first ) return -1;
 		return current - first;
 	}
 
-	public boolean setRowNumber(int rowNumber) throws HibernateException {
+	public boolean setRowNumber(int rowNumber) {
 		if ( rowNumber >= 0 ) {
 			current = first + rowNumber;
 		}




More information about the hibernate-commits mailing list