int cigar12I = 0, cigar23I = 0;
int elt12I = 0, elt23I = 0;
while ( cigar12I < nElements12 && cigar23I < nElements23 ) {
final CigarElement elt12 = firstToSecond.getCigarElement(cigar12I);
final CigarElement elt23 = secondToThird.getCigarElement(cigar23I);
final CigarPairTransform transform = getTransformer(elt12.getOperator(), elt23.getOperator());
if ( DEBUG )
System.out.printf("Transform %s => %s with elt1 = %d %s @ %d elt2 = %d %s @ %d with transform %s%n",
firstToSecond, secondToThird, cigar12I, elt12.getOperator(), elt12I, cigar23I, elt23.getOperator(), elt23I, transform);
if ( transform.op13 != null ) // skip no ops
newElements.add(new CigarElement(1, transform.op13));
elt12I += transform.advance12;
elt23I += transform.advance23;
// if have exhausted our current element, advance to the next one
if ( elt12I == elt12.getLength() ) { cigar12I++; elt12I = 0; }
if ( elt23I == elt23.getLength() ) { cigar23I++; elt23I = 0; }
}
return AlignmentUtils.consolidateCigar(new Cigar(newElements));
}