public final class SimilarityComputer extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static int | MINIMUM_LENGTHThe minimum length both sides must have to not be ignored (short text contents might seem similar and
 cause false negatives). | 
| static double | THRESHOLDThe maximum percentage of differing lines contained in the content for files to be considered a rename. | 
| Modifier and Type | Method and Description | 
|---|---|
| static double | computeDifference(InputStream a,
                 InputStream b)Computes the difference between two  InputStreaminstances. | 
| static boolean | isSimilar(InputStream a,
         InputStream b)Decides whether two input streams are similar. | 
public static final int MINIMUM_LENGTH
public static final double THRESHOLD
public static boolean isSimilar(InputStream a, InputStream b) throws IOException
computeDifference(InputStream, InputStream) and compares the value with THRESHOLD.a - the first input streamb - the second input streamtrue if the input streams are similarIOException - if reading of one of the input streams failspublic static double computeDifference(InputStream a, InputStream b) throws IOException
InputStream instances. The returned value is a ratio of
 changed lines to total lines, where total lines is denoted by the maximum of the line counts of both
 input streams. This method returns Double.MAX_VALUE if one or both of the streams are
 null or if the content is too short to be compared (shorter than MINIMUM_LENGTH).a - the first input streamb - the second input streamIOException - if reading of one of the input streams fails
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.