/// Chop off unreachable parts of the stripes.
/// Overhanging parts are pruned
Chop off unreachable parts of the stripes.
Overhanging parts are pruned
Chop off unreachable parts of the stripes . Overhanging parts are pruned
fn regularize_stripes(mut stripes: Vec<Stripe>, qry_len: usize) -> Vec<Stripe> {
  // assure stripe begin are non-decreasing -- such states would be unreachable in the alignment
  let stripes_len = stripes.len();
  stripes[0].begin = 0;
  for i in 1..stripes_len {
    stripes[i].begin = clamp(stripes[i].begin, stripes[i - 1].begin, qry_len);
  }
  // analogously, assure that strip ends are non-decreasing. this needs to be done in reverse.
  stripes[stripes_len - 1].end = qry_len + 1;
  for i in (0..(stripes_len - 1)).rev() {
    stripes[i].end = clamp(stripes[i].end, 1, stripes[i + 1].end);
  }
  stripes
}
fn regularize_stripes ( mut stripes : Vec < Stripe > , qry_len : usize ) -> Vec < Stripe > { // assure stripe begin are non-decreasing -- such states would be unreachable in the alignment let stripes_len = stripes . len ( ) ; stripes [ 0 ] . begin = 0 ; for i in 1 .. stripes_len { stripes [ i ] . begin = clamp ( stripes [ i ] . begin , stripes [ i - 1 ] . begin , qry_len ) ; } // analogously, assure that strip ends are non-decreasing. this needs to be done in reverse. stripes [ stripes_len - 1 ] . end = qry_len + 1 ; for i in ( 0 .. ( stripes_len - 1 ) ) . rev ( ) { stripes [ i ] . end = clamp ( stripes [ i ] . end , 1 , stripes [ i + 1 ] . end ) ; } stripes }
Chop off unreachable parts of the stripes.
Chop off unreachable parts of the stripes .
stripes
Vec<Stripe>
qry_len
usize