protected void preProcess() {
    int i = 0;
    int j = -1;
    borders_[i] = j;
    while (i < pattern_.length) {
      while (j >= 0 && pattern_[i] != pattern_[j]) {
        j = borders_[j];
      }
      borders_[++i] = ++j;
    }
  }
protected void preProcess() {
    int i = 0;
    int j = -1;
    borders_[i] = j;
    while (i < pattern_.length) {
      while (j >= 0 && pattern_[i] != pattern_[j]) {
        j = borders_[j];
      }
      borders_[++i] = ++j;
    }
  }
protected void preProcess ( ) { int i = 0 ; int j = - 1 ; borders_ [ i ] = j ; while ( i < pattern_ . length ) { while ( j >= 0 && pattern_ [ i ] != pattern_ [ j ] ) { j = borders_ [ j ] ; } borders_ [ ++ i ] = ++ j ; } }
Builds up a table of longest "borders" for each prefix of the pattern to find. This table is stored internally
and aids in implementation of the Knuth-Moore-Pratt string search.
<p>
For more information, see: http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm.
Builds up a table of longest borders for each prefix of the pattern to find . This table is stored internally and aids in implementation of the Knuth - Moore - Pratt string search . <p > For more information see : http : // www . inf . fh - flensburg . de / lang / algorithmen / pattern / kmpen . htm .