// Path: src/main/java/es/cnio/bioinfo/bicycle/gatk/ListerFilter.java
// protected static class CigarIterator implements Iterator<CigarOperator> {
// 
// 	private final boolean reverse;
// 	private List<CigarElement> cigarElements;
// 	private int currentCigarElementsPos;
// 
// 	private int repetitionsOfCurrentOperation = 0;
// 	private CigarOperator currentOperator = null;
// 
// 	public CigarIterator(String cigar, boolean reverse) {
// 		this.cigarElements = new ArrayList(TextCigarCodec.getSingleton().decode(cigar).getCigarElements());
// 		this.reverse = reverse;
// 		this.currentCigarElementsPos = this.reverse ? cigarElements.size() : -1;
// 		this.advanceCigarElement();
// 	}
// 
// 	@Override
// 	public boolean hasNext() {
// 		return repetitionsOfCurrentOperation > 0
// 				|| (this.currentCigarElementsPos >= 0 && this.currentCigarElementsPos < this.cigarElements.size());
// 	}
// 
// 	@Override
// 	public CigarOperator next() {
// 
// 		CigarOperator result = this.currentOperator;
// 		this.repetitionsOfCurrentOperation--;
// 		if (repetitionsOfCurrentOperation == 0 && (this.currentCigarElementsPos >= 0 && this
// 				.currentCigarElementsPos < this.cigarElements.size())) {
// 			advanceCigarElement();
// 		}
// 
// 		return result;
// 	}
// 
// 	private void advanceCigarElement() {
// 		this.currentCigarElementsPos = this.currentCigarElementsPos + (this.reverse ? -1 : 1);
// 		if (this.currentCigarElementsPos >= 0 && this.currentCigarElementsPos < this.cigarElements.size()) {
// 			CigarElement element = this.cigarElements.get(this.currentCigarElementsPos);
// 			this.repetitionsOfCurrentOperation = element.getLength();
// 			this.currentOperator = element.getOperator();
// 		}
// 	}
// }


import static junit.framework.Assert.assertEquals;
import java.io.IOException;
import org.junit.Test;
import es.cnio.bioinfo.bicycle.gatk.ListerFilter.CigarIterator;
import net.sf.samtools.CigarOperator;
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
	}

	@Test
	public void testInsertions() {
		CigarIterator iterator = new CigarIterator("3M2I1M", false);

		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
	}

	@Test
	public void testInsertionsReverse() {
		CigarIterator iterator = new CigarIterator("3M2I1M", true);

		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
	}

	@Test
	public void testDeletions() {
// Path: src/main/java/es/cnio/bioinfo/bicycle/gatk/ListerFilter.java
// protected static class CigarIterator implements Iterator<CigarOperator> {
// 
// 	private final boolean reverse;
// 	private List<CigarElement> cigarElements;
// 	private int currentCigarElementsPos;
// 
// 	private int repetitionsOfCurrentOperation = 0;
// 	private CigarOperator currentOperator = null;
// 
// 	public CigarIterator(String cigar, boolean reverse) {
// 		this.cigarElements = new ArrayList(TextCigarCodec.getSingleton().decode(cigar).getCigarElements());
// 		this.reverse = reverse;
// 		this.currentCigarElementsPos = this.reverse ? cigarElements.size() : -1;
// 		this.advanceCigarElement();
// 	}
// 
// 	@Override
// 	public boolean hasNext() {
// 		return repetitionsOfCurrentOperation > 0
// 				|| (this.currentCigarElementsPos >= 0 && this.currentCigarElementsPos < this.cigarElements.size());
// 	}
// 
// 	@Override
// 	public CigarOperator next() {
// 
// 		CigarOperator result = this.currentOperator;
// 		this.repetitionsOfCurrentOperation--;
// 		if (repetitionsOfCurrentOperation == 0 && (this.currentCigarElementsPos >= 0 && this
// 				.currentCigarElementsPos < this.cigarElements.size())) {
// 			advanceCigarElement();
// 		}
// 
// 		return result;
// 	}
// 
// 	private void advanceCigarElement() {
// 		this.currentCigarElementsPos = this.currentCigarElementsPos + (this.reverse ? -1 : 1);
// 		if (this.currentCigarElementsPos >= 0 && this.currentCigarElementsPos < this.cigarElements.size()) {
// 			CigarElement element = this.cigarElements.get(this.currentCigarElementsPos);
// 			this.repetitionsOfCurrentOperation = element.getLength();
// 			this.currentOperator = element.getOperator();
// 		}
// 	}
// }


// Path: src/test/java/es/cnio/bioinfo/bicycle/gatk/CigarIteratorTest.java
import static junit.framework.Assert.assertEquals;
import java.io.IOException;
import org.junit.Test;
import es.cnio.bioinfo.bicycle.gatk.ListerFilter.CigarIterator;
import net.sf.samtools.CigarOperator;

		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
	}

	@Test
	public void testInsertions() {
		CigarIterator iterator = new CigarIterator("3M2I1M", false);

		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
	}

	@Test
	public void testInsertionsReverse() {
		CigarIterator iterator = new CigarIterator("3M2I1M", true);

		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.INSERTION, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
		assertEquals(CigarOperator.MATCH_OR_MISMATCH, iterator.next());
	}

	@Test
	public void testDeletions() {
		CigarIterator iterator = new CigarIterator("3M2D1M", false);