class ReusingBlockResettableIterator extends NonReusingBlockResettableIterator<T> {

	@Override
	public boolean hasNext() {
		try {
			if (this.nextElement == null) {
				if (this.readPhase) {
					// read phase, get next element from buffer
					T tmp = getNextRecord(this.reuseElement);
					if (tmp != null) {
						this.nextElement = tmp;
						return true;
					} else {
						return false;
					}
				} else {
					if (this.input.hasNext()) {
						final T next = this.input.next();
						if (writeNextRecord(next)) {
							this.nextElement = next;
							return true;
						} else {
							this.leftOverElement = next;
							return false;
						}
					} else {
						this.noMoreBlocks = true;
						return false;
					}
				}
			} else {
				return true;
			}
		} catch (IOException ioex) {
			throw new RuntimeException("Error (de)serializing record in block resettable iterator.", ioex);
		}
	}

	public  ReusingBlockResettableIterator(MemoryManager memoryManager, Iterator<T> input,
			TypeSerializer<T> serializer, int numPages,
			AbstractInvokable ownerTask);
	public  ReusingBlockResettableIterator(MemoryManager memoryManager, TypeSerializer<T>
			serializer, int numPages, AbstractInvokable ownerTask);

}