private boolean backtrackForMonotoneWithPrevious(Featurizable<IString,String> f){
  int indexLeftCurrentPhrase=fStart(f) - 1;
  if (indexLeftCurrentPhrase < 0) {
    return (f.prior == null);
  }
 else   if (f.prior == null) {
    return false;
  }
  if (fStart(f) < fStart(f.prior))   return false;
  int indexRightPreviousPhrase=fEnd(f.prior) + 1;
  if (indexRightPreviousPhrase - 1 == indexLeftCurrentPhrase)   return true;
  CoverageSet fCoverage=f.derivation.sourceCoverage;
  for (int i=indexRightPreviousPhrase; i <= indexLeftCurrentPhrase; ++i) {
    if (!fCoverage.get(i))     return false;
  }
  if (fCoverage.nextClearBit(0) > indexLeftCurrentPhrase && fCoverage.nextSetBit(fEnd(f) + 1) < 0)   return true;
  Featurizable<IString,String> tmp_f=f.prior;
  tmpCoverage.clear();
  boolean foundAdjPhrase=false;
  while (true) {
    if (fEnd(tmp_f) == indexLeftCurrentPhrase)     foundAdjPhrase=true;
    int fStart=fStart(tmp_f);
    int fEnd=fEnd(tmp_f);
    tmpCoverage.set(fStart,fEnd + 1);
    if (foundAdjPhrase && contiguous(tmpCoverage))     break;
    if (fStart > indexLeftCurrentPhrase)     return false;
    tmp_f=tmp_f.prior;
    if (tmp_f == null)     return false;
  }
  return true;
}

private boolean backtrackForMonotoneWithPrevious ( Featurizable < IString , String > f ) { int indexLeftCurrentPhrase = fStart ( f ) - 1 ; if ( indexLeftCurrentPhrase < 0 ) { return ( f . prior == null ) ; } else if ( f . prior == null ) { return false ; } if ( fStart ( f ) < fStart ( f . prior ) ) return false ; int indexRightPreviousPhrase = fEnd ( f . prior ) + 1 ; if ( indexRightPreviousPhrase - 1 == indexLeftCurrentPhrase ) return true ; CoverageSet fCoverage = f . derivation . sourceCoverage ; for ( int i = indexRightPreviousPhrase ; i <= indexLeftCurrentPhrase ; ++ i ) { if ( ! fCoverage . get ( i ) ) return false ; } if ( fCoverage . nextClearBit ( 0 ) > indexLeftCurrentPhrase && fCoverage . nextSetBit ( fEnd ( f ) + 1 ) < 0 ) return true ; Featurizable < IString , String > tmp_f = f . prior ; tmpCoverage . clear ( ) ; boolean foundAdjPhrase = false ; while ( true ) { if ( fEnd ( tmp_f ) == indexLeftCurrentPhrase ) foundAdjPhrase = true ; int fStart = fStart ( tmp_f ) ; int fEnd = fEnd ( tmp_f ) ; tmpCoverage . set ( fStart , fEnd + 1 ) ; if ( foundAdjPhrase && contiguous ( tmpCoverage ) ) break ; if ( fStart > indexLeftCurrentPhrase ) return false ; tmp_f = tmp_f . prior ; if ( tmp_f == null ) return false ; } return true ; }
returns true if current block is monotone with any contiguous set of previous blocks .
