private static float computeSimilarity(Lane a,Lane b){
  int same=0;
  int diff=0;
  int firstCoordinate=Math.max(a.getFirstNonGapPosition(),b.getFirstNonGapPosition());
  int lastCoordinate=Math.min(a.getLastNonGapPosition(),b.getLastNonGapPosition());
  for (int i=firstCoordinate; i <= lastCoordinate; i++) {
    char cha=a.charAt(i);
    char chb=b.charAt(i);
    if (Character.isLetter(cha) && Character.isLetter(chb)) {
      if (Character.toLowerCase(cha) == Character.toLowerCase((chb)))       same++;
 else       diff++;
    }
  }
  return Math.max(same > 0 ? 1 : 0,same - 3 * diff);
}

private static float computeSimilarity ( Lane a , Lane b ) { int same = 0 ; int diff = 0 ; int firstCoordinate = Math . max ( a . getFirstNonGapPosition ( ) , b . getFirstNonGapPosition ( ) ) ; int lastCoordinate = Math . min ( a . getLastNonGapPosition ( ) , b . getLastNonGapPosition ( ) ) ; for ( int i = firstCoordinate ; i <= lastCoordinate ; i ++ ) { char cha = a . charAt ( i ) ; char chb = b . charAt ( i ) ; if ( Character . isLetter ( cha ) && Character . isLetter ( chb ) ) { if ( Character . toLowerCase ( cha ) == Character . toLowerCase ( ( chb ) ) ) same ++ ; else diff ++ ; } } return Math . max ( same > 0 ? 1 : 0 , same - 3 * diff ) ; }
computes the similarity of two sequences
