Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aa9ecf2

Browse files
committed
minor style change
1 parent 4946f58 commit aa9ecf2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/main/java/info/debatty/java/stringsimilarity/RatcliffObershelp.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class RatcliffObershelp implements
5656
* @return The RatcliffObershelp similarity in the range [0, 1]
5757
* @throws NullPointerException if s1 or s2 is null.
5858
*/
59+
@Override
5960
public final double similarity(final String s1, final String s2) {
6061
if (s1 == null) {
6162
throw new NullPointerException("s1 must not be null");
@@ -70,15 +71,13 @@ public final double similarity(final String s1, final String s2) {
7071
}
7172

7273
List<String> matches = getMatchList(s1, s2);
73-
int sumofmatches = 0;
74-
Iterator it = matches.iterator();
74+
int sum_of_matches = 0;
7575

76-
while (it.hasNext()) {
77-
String element = it.next().toString();
78-
sumofmatches += element.length();
76+
for (String match : matches) {
77+
sum_of_matches += match.length();
7978
}
8079

81-
return 2.0d * sumofmatches / (s1.length() + s2.length());
80+
return 2.0d * sum_of_matches / (s1.length() + s2.length());
8281
}
8382

8483
/**
@@ -89,6 +88,7 @@ public final double similarity(final String s1, final String s2) {
8988
* @return 1 - similarity
9089
* @throws NullPointerException if s1 or s2 is null.
9190
*/
91+
@Override
9292
public final double distance(final String s1, final String s2) {
9393
return 1.0d - similarity(s1, s2);
9494
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /