// Path: src/main/java/com/googlecode/javaewah/IntIterator.java
// public interface IntIterator {
// 
//     /**
//      * Is there more?
//      *
//      * @return true, if there is more, false otherwise
//      */
//     boolean hasNext();
// 
//     /**
//      * Return the next integer
//      *
//      * @return the integer
//      */
//     int next();
// }


import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import junit.framework.Assert;
import org.junit.Test;
import com.googlecode.javaewah.IntIterator;
package com.googlecode.javaewah.datastructure;







public class BitSetTest
{
	
	
	public static ImmutableBitSet toImmutableBitSet(BitSet b) throws IOException {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		b.serialize(new DataOutputStream(bos));
		ByteBuffer bb = ByteBuffer.wrap(bos.toByteArray());
		ImmutableBitSet rmap = new ImmutableBitSet(bb.asLongBuffer());
		System.out.println("bitmap 1 (mapped) : " + rmap);
		if (!rmap.equals(b))
			throw new RuntimeException("Will not happen");
		return rmap;	
	}
	@Test
	public void simpleImmuExample() throws IOException {
		ImmutableBitSet Bitmap1 = toImmutableBitSet(BitSet.bitmapOf(0, 2, 55, 64, 512));
		ImmutableBitSet Bitmap2 = toImmutableBitSet(BitSet.bitmapOf(1, 3, 64, 512));
		System.out.println("bitmap 1: " + Bitmap1);
		System.out.println("bitmap 2: " + Bitmap2);
		assertEquals(Bitmap1.cardinality(),5);
		assertEquals(Bitmap2.cardinality(),4);
		assertFalse(Bitmap1.hashCode()==Bitmap2.hashCode());
// Path: src/main/java/com/googlecode/javaewah/IntIterator.java
// public interface IntIterator {
// 
//     /**
//      * Is there more?
//      *
//      * @return true, if there is more, false otherwise
//      */
//     boolean hasNext();
// 
//     /**
//      * Return the next integer
//      *
//      * @return the integer
//      */
//     int next();
// }


// Path: src/test/java/com/googlecode/javaewah/datastructure/BitSetTest.java
import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import junit.framework.Assert;
import org.junit.Test;
import com.googlecode.javaewah.IntIterator;

package com.googlecode.javaewah.datastructure;







public class BitSetTest
{
	
	
	public static ImmutableBitSet toImmutableBitSet(BitSet b) throws IOException {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		b.serialize(new DataOutputStream(bos));
		ByteBuffer bb = ByteBuffer.wrap(bos.toByteArray());
		ImmutableBitSet rmap = new ImmutableBitSet(bb.asLongBuffer());
		System.out.println("bitmap 1 (mapped) : " + rmap);
		if (!rmap.equals(b))
			throw new RuntimeException("Will not happen");
		return rmap;	
	}
	@Test
	public void simpleImmuExample() throws IOException {
		ImmutableBitSet Bitmap1 = toImmutableBitSet(BitSet.bitmapOf(0, 2, 55, 64, 512));
		ImmutableBitSet Bitmap2 = toImmutableBitSet(BitSet.bitmapOf(1, 3, 64, 512));
		System.out.println("bitmap 1: " + Bitmap1);
		System.out.println("bitmap 2: " + Bitmap2);
		assertEquals(Bitmap1.cardinality(),5);
		assertEquals(Bitmap2.cardinality(),4);
		assertFalse(Bitmap1.hashCode()==Bitmap2.hashCode());
		IntIterator is = Bitmap1.intIterator();