de.retest.recheck.ui.diff.Match Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of recheck Show documentation
Show all versions of recheck Show documentation
Replace traditional assertions with a single check.
package de.retest.recheck.ui.diff;
import de.retest.recheck.ui.descriptors.Element;
public class Match implements Comparable {
final double similarity;
final Element element;
public static Match of( final double similarity, final Element element ) {
return new Match( similarity, element );
}
public static Match ofEqual( final Element element ) {
return new Match( 1.0, element );
}
private Match( final double similarity, final Element element ) {
this.similarity = similarity;
this.element = element;
}
@Override
public int compareTo( final Match o ) {
final int result = Double.compare( o.similarity, similarity );
// same similarity should not be overwritten in the Tree
if ( result == 0 ) {
return -1;
}
return result;
}
@Override
public String toString() {
return "Match[similarity='" + similarity + "', element='" + element + "']";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy