private ArrayList algorithm1 ( String S , String T ) { ArrayList candidateList = new ArrayList ( ) ; int bound = ( int ) ( 1.0 / tr ) ; for ( int t = 0 ; t < S . length ( ) ; t ++ ) { char chT = S . charAt ( t ) ; double lastTr = - 1 ; for ( int u = Math . max ( 0 , t - bound ) , flag = 0 ; u < Math . min ( t + bound + 1 , T . length ( ) ) && flag == 0 ; u ++ ) { double tr2 = ( ( double ) Math . abs ( t - u ) ) ; if ( ( lastTr >= 0.0 ) && ( lastTr < tr2 ) ) { flag = 1 ; } else { char chU = T . charAt ( u ) ; double charScore = 0.0 ; if ( chT == chU ) { charScore = 1.0 ; } if ( charScore > 0.0 ) { if ( charScore == 1.0 ) { lastTr = tr2 ; } charScore = charScore - ( tr * tr2 ) ; if ( charScore == 1.0 ) { flag = 1 ; } candidateList . add ( new TagLink . Candidates ( t , u , charScore ) ) ; } } } } return candidateList ; }
algorithm1 select the considered most appropiate character pairs are return a list of candidates .