package com.alvazan.orm.layer9z.spi.db.cassandra;

import java.util.Iterator;

import com.alvazan.orm.api.z8spi.KeyValue;
import com.alvazan.orm.api.z8spi.Row;
import com.alvazan.orm.api.z8spi.iter.AbstractCursor;

public class CursorReturnsEmptyRows extends AbstractCursor<KeyValue<Row>> {

	private Iterable<byte[]> keysIterable;
	private Iterator<byte[]> keys;
	public CursorReturnsEmptyRows(Iterable<byte[]> keys) {
		this.keysIterable = keys;
	}

	@Override
	public void beforeFirst() {
		keys = keysIterable.iterator();
	}

	@Override
	public com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<KeyValue<Row>> nextImpl() {
		if(!keys.hasNext())
			return null;
		byte[] key = keys.next();
		KeyValue<Row> kv = new KeyValue<Row>();
		kv.setKey(key);
		
		return new Holder<KeyValue<Row>>(kv);		
	}
}

@@ -441,16 +441,33 @@
 = keys;%0A
+%09%09beforeFirst();%0A
 %09%7D%0A%0A%09@Ov

fix smallbug breaking all tests for cassandra