You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/05/31 21:23:54 UTC
svn commit: r1129862 -
/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/IteratorSlotted.java
Author: andy
Date: Tue May 31 19:23:54 2011
New Revision: 1129862
URL: http://svn.apache.org/viewvc?rev=1129862&view=rev
Log: (empty)
Modified:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/IteratorSlotted.java
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/IteratorSlotted.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/IteratorSlotted.java?rev=1129862&r1=1129861&r2=1129862&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/IteratorSlotted.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/IteratorSlotted.java Tue May 31 19:23:54 2011
@@ -17,18 +17,13 @@ public abstract class IteratorSlotted<T>
// Could move in the async abort.
private boolean finished = false ;
private boolean slotIsSet = false ;
- private T NULL = null ;
- private T slot = NULL ;
+ private T slot = null ;
- private boolean slotIsSet() { return slot != NULL ; }
-
protected IteratorSlotted() { }
// -------- The contract with the subclasses
- /** Implement this, not next() or nextBinding()
- Returning null is turned into NoSuchElementException
- Does not need to call hasNext (can presume it is true) */
+ /** Implement this, not next() or nextBinding() */
protected abstract T moveToNext() ;
/** Can return true here then null from moveToNext() to indicate end. */
@@ -48,7 +43,7 @@ public abstract class IteratorSlotted<T>
{
if ( finished )
return false ;
- if ( slotIsSet() )
+ if ( slotIsSet )
return true ;
boolean r = hasMore() ;
@@ -60,12 +55,6 @@ public abstract class IteratorSlotted<T>
slot = moveToNext() ;
slotIsSet = true ;
-
- if ( ! slotIsSet() )
- {
- close() ;
- return false ;
- }
return true ;
}
@@ -77,6 +66,7 @@ public abstract class IteratorSlotted<T>
T obj = slot ;
slot = null ;
+ slotIsSet = false ;
return obj ;
}
@@ -93,13 +83,13 @@ public abstract class IteratorSlotted<T>
throw new UnsupportedOperationException(Utils.className(this)+".remove") ;
}
- public void close()
+ public final void close()
{
if ( finished )
return ;
closeIterator() ;
slotIsSet = false ;
- slot = NULL ;
+ slot = null ;
finished = true ;
}
}