private boolean findLongestMatch ( final char [ ] revA , final ArrayList < Integer > list , final char [ ] revB , final int index ) { int match ; longestMatch_size = - 1 ; int size = list . size ( ) ; int revAsize = revA . length ; int revBsize = revB . length ; int start , end , count ; for ( int i = 0 ; i < size ; i ++ ) { start = list . get ( i ) ; if ( ! revABlocked [ start ] && ! revBBlocked [ index + 1 ] ) { count = index + 1 ; end = start + 1 ; while ( end < revAsize && count < revBsize && revA [ end ] == revB [ count ] && ! revABlocked [ end ] && ! revBBlocked [ count ] ) { end ++ ; count ++ ; } match = end - start ; if ( match > longestMatch_size ) { longestMatch_size = match ; longestMatch_start = start ; } } } if ( longestMatch_size <= VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING ) { return false ; } queueA . add ( new DiffBlock ( this . blockCount , longestMatch_start , longestMatch_start + longestMatch_size , index , index + longestMatch_size , true ) ) ; queueB . add ( new DiffBlock ( this . blockCount , longestMatch_start , longestMatch_start + longestMatch_size , index , index + longestMatch_size , false ) ) ; blockCount ++ ; for ( int i = 0 , j = longestMatch_start , k = index ; i < longestMatch_size ; i ++ , j ++ , k ++ ) { revABlocked [ j ] = true ; revBBlocked [ k ] = true ; } return true ; }
Searches the longest common substring