* a progress monitor
* @return the fuzz factor or -1 if the hunk could not be matched
*/
public int calculateFuzz(List lines, IProgressMonitor monitor) {
this.fMatches = false;
PatchConfiguration configuration = getConfiguration();
int fuzz = 0;
int maxFuzz = configuration.getFuzz() == -1 ? MAXIMUM_FUZZ_FACTOR
: configuration.getFuzz();
for (; fuzz <= maxFuzz; fuzz++) {
// try to apply using lines coordinates from the patch
if (this.fHunk.tryPatch(configuration, lines, this.fShift, fuzz)) {
// it's a perfect match, no adjustment is needed
this.fShift += this.fHunk.doPatch(configuration, lines, this.fShift, fuzz);