// Path: src/main/java/de/fhg/igd/mongomvcc/VCursor.java
// public interface VCursor extends Iterable<Map<String, Object>> {
// 	/**
// 	 * @return the number of database objects this cursor points to
// 	 */
// 	int size();
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/Filter.java
// public interface Filter<T> {
// 	/**
// 	 * Checks if the given element passes the filter
// 	 * @param t the element
// 	 * @return true if the element passes the filter, false otherwise
// 	 */
// 	boolean filter(T t);
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/FilteringIterator.java
// public class FilteringIterator<T> implements Iterator<T> {
// 	/**
// 	 * The wrapped iterator
// 	 */
// 	private final Iterator<T> _delegate;
// 	
// 	/**
// 	 * The filter that shall be applied to all elements
// 	 * in the wrapped iterator
// 	 */
// 	private final Filter<T> _filter;
// 	
// 	/**
// 	 * True if this iterator has been initialized--i.e. if the
// 	 * first element has been fetched
// 	 */
// 	private boolean _initialized = false;
// 	
// 	/**
// 	 * True if this iterator will return another element
// 	 */
// 	private boolean _hasNext = false;
// 	
// 	/**
// 	 * The next element that will be returned by {@link #next()}
// 	 */
// 	private T _nextElement = null;
// 	
// 	/**
// 	 * Creates a new filtering iterator
// 	 * @param delegate the iterator to wrap around
// 	 * @param filter the filter
// 	 */
// 	public FilteringIterator(Iterator<T> delegate, Filter<T> filter) {
// 		_delegate = delegate;
// 		_filter = filter;
// 	}
// 	
// 	private void advanceToNext() {
// 		_hasNext = false;
// 		while (_delegate.hasNext()) {
// 			T o = _delegate.next();
// 			if (_filter.filter(o)) {
// 				_hasNext = true;
// 				_nextElement = o;
// 				break;
// 			}
// 		}
// 	}
// 	
// 	private void initialize() {
// 		if (_initialized) {
// 			return;
// 		}
// 		advanceToNext();
// 		_initialized = true;
// 	}
// 	
// 	@Override
// 	public boolean hasNext() {
// 		initialize();
// 		return _hasNext;
// 	}
// 
// 	@Override
// 	public T next() {
// 		initialize();
// 		if (!_hasNext) {
// 			throw new NoSuchElementException();
// 		}
// 		T r = _nextElement;
// 		advanceToNext();
// 		return r;
// 	}
// 
// 	@Override
// 	public void remove() {
// 		throw new UnsupportedOperationException();
// 	}
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/TransformingIterator.java
// public abstract class TransformingIterator<I, O> implements Iterator<O> {
// 	/**
// 	 * The wrapped iterator
// 	 */
// 	private final Iterator<I> _delegate;
// 	
// 	/**
// 	 * Constructs a new transforming iterator
// 	 * @param delegate the iterator to wrap
// 	 */
// 	public TransformingIterator(Iterator<I> delegate) {
// 		_delegate = delegate;
// 	}
// 	
// 	@Override
// 	public boolean hasNext() {
// 		return _delegate.hasNext();
// 	}
// 
// 	@Override
// 	public O next() {
// 		return transform(_delegate.next());
// 	}
// 	
// 	/**
// 	 * Transforms an element
// 	 * @param input the element
// 	 * @return the transformed element
// 	 */
// 	abstract protected O transform(I input);
// 
// 	@Override
// 	public void remove() {
// 		_delegate.remove();
// 	}
// }


import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import de.fhg.igd.mongomvcc.VCursor;
import de.fhg.igd.mongomvcc.helper.Filter;
import de.fhg.igd.mongomvcc.helper.FilteringIterator;
import de.fhg.igd.mongomvcc.helper.TransformingIterator;
// This file is part of MongoMVCC.
//
// Copyright (c) 2012 Fraunhofer IGD
//
// MongoMVCC is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// MongoMVCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with MongoMVCC. If not, see <http://www.gnu.org/licenses/>.

package de.fhg.igd.mongomvcc.impl;




/**
 * Implementation of {@link VCursor} for MongoDB
 * @author Michel Kraemer
 */
public class MongoDBVCursor implements VCursor {
	private final DBCursor _delegate;
// Path: src/main/java/de/fhg/igd/mongomvcc/VCursor.java
// public interface VCursor extends Iterable<Map<String, Object>> {
// 	/**
// 	 * @return the number of database objects this cursor points to
// 	 */
// 	int size();
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/Filter.java
// public interface Filter<T> {
// 	/**
// 	 * Checks if the given element passes the filter
// 	 * @param t the element
// 	 * @return true if the element passes the filter, false otherwise
// 	 */
// 	boolean filter(T t);
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/FilteringIterator.java
// public class FilteringIterator<T> implements Iterator<T> {
// 	/**
// 	 * The wrapped iterator
// 	 */
// 	private final Iterator<T> _delegate;
// 	
// 	/**
// 	 * The filter that shall be applied to all elements
// 	 * in the wrapped iterator
// 	 */
// 	private final Filter<T> _filter;
// 	
// 	/**
// 	 * True if this iterator has been initialized--i.e. if the
// 	 * first element has been fetched
// 	 */
// 	private boolean _initialized = false;
// 	
// 	/**
// 	 * True if this iterator will return another element
// 	 */
// 	private boolean _hasNext = false;
// 	
// 	/**
// 	 * The next element that will be returned by {@link #next()}
// 	 */
// 	private T _nextElement = null;
// 	
// 	/**
// 	 * Creates a new filtering iterator
// 	 * @param delegate the iterator to wrap around
// 	 * @param filter the filter
// 	 */
// 	public FilteringIterator(Iterator<T> delegate, Filter<T> filter) {
// 		_delegate = delegate;
// 		_filter = filter;
// 	}
// 	
// 	private void advanceToNext() {
// 		_hasNext = false;
// 		while (_delegate.hasNext()) {
// 			T o = _delegate.next();
// 			if (_filter.filter(o)) {
// 				_hasNext = true;
// 				_nextElement = o;
// 				break;
// 			}
// 		}
// 	}
// 	
// 	private void initialize() {
// 		if (_initialized) {
// 			return;
// 		}
// 		advanceToNext();
// 		_initialized = true;
// 	}
// 	
// 	@Override
// 	public boolean hasNext() {
// 		initialize();
// 		return _hasNext;
// 	}
// 
// 	@Override
// 	public T next() {
// 		initialize();
// 		if (!_hasNext) {
// 			throw new NoSuchElementException();
// 		}
// 		T r = _nextElement;
// 		advanceToNext();
// 		return r;
// 	}
// 
// 	@Override
// 	public void remove() {
// 		throw new UnsupportedOperationException();
// 	}
// }
// 
// Path: src/main/java/de/fhg/igd/mongomvcc/helper/TransformingIterator.java
// public abstract class TransformingIterator<I, O> implements Iterator<O> {
// 	/**
// 	 * The wrapped iterator
// 	 */
// 	private final Iterator<I> _delegate;
// 	
// 	/**
// 	 * Constructs a new transforming iterator
// 	 * @param delegate the iterator to wrap
// 	 */
// 	public TransformingIterator(Iterator<I> delegate) {
// 		_delegate = delegate;
// 	}
// 	
// 	@Override
// 	public boolean hasNext() {
// 		return _delegate.hasNext();
// 	}
// 
// 	@Override
// 	public O next() {
// 		return transform(_delegate.next());
// 	}
// 	
// 	/**
// 	 * Transforms an element
// 	 * @param input the element
// 	 * @return the transformed element
// 	 */
// 	abstract protected O transform(I input);
// 
// 	@Override
// 	public void remove() {
// 		_delegate.remove();
// 	}
// }


// Path: src/main/java/de/fhg/igd/mongomvcc/impl/MongoDBVCursor.java
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import de.fhg.igd.mongomvcc.VCursor;
import de.fhg.igd.mongomvcc.helper.Filter;
import de.fhg.igd.mongomvcc.helper.FilteringIterator;
import de.fhg.igd.mongomvcc.helper.TransformingIterator;

// This file is part of MongoMVCC.
//
// Copyright (c) 2012 Fraunhofer IGD
//
// MongoMVCC is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// MongoMVCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with MongoMVCC. If not, see <http://www.gnu.org/licenses/>.

package de.fhg.igd.mongomvcc.impl;




/**
 * Implementation of {@link VCursor} for MongoDB
 * @author Michel Kraemer
 */
public class MongoDBVCursor implements VCursor {
	private final DBCursor _delegate;
	private final Filter<DBObject> _filter;