public int step ( int firstpos , int lastpos ) { for ( int i = lastpos - 1 ; i >= firstpos ; i -- ) { // walk backwards if ( this . index . indices [ i ] > this . endpoint [ i ] ) this . index . indices [ i ] = this . slices . get ( i ) . getFirst ( ) ; // reset this position else { this . index . indices [ i ] += this . slices . get ( i ) . getStride ( ) ; // move to next indices return i ; } } return - 1 ; }
return - 1 if we have completed .