diff options
author | Rocky Madden <git@rockymadden.com> | 2012-10-10 22:57:52 -0600 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2012-10-10 22:57:52 -0600 |
commit | 488de0cd595a7a034d706f319ec7cdcacea6eaab (patch) | |
tree | f3924ea432946efaae01ec2010de0f188b865981 | |
parent | a852756f1ec453b9e0b800e1bc0d59443e739458 (diff) | |
download | stringmetric-488de0cd595a7a034d706f319ec7cdcacea6eaab.tar.gz stringmetric-488de0cd595a7a034d706f319ec7cdcacea6eaab.tar.bz2 stringmetric-488de0cd595a7a034d706f319ec7cdcacea6eaab.zip |
Checking the length of both strings while also checking for equality is not required.
-rwxr-xr-x | core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala | 2 | ||||
-rwxr-xr-x | core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala index 31e6a48..0161212 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala @@ -28,7 +28,7 @@ object JaroMetric extends StringMetric { override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Float = { // Return 1 if strings are an exact match. - if (string1.length > 0 && string2.length > 0 && string1 == string2) return 1f + if (string1.length > 0 && string1 == string2) return 1f compare(stringCleaner.clean(string1.toCharArray), stringCleaner.clean(string2.toCharArray))(new StringCleanerDelegate) } diff --git a/core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala index f21cc54..aab8cd9 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala @@ -17,7 +17,7 @@ object JaroWinklerMetric extends StringMetric { override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Float = { // Return 1 if strings are an exact match. - if (string1.length > 0 && string2.length > 0 && string1 == string2) return 1f + if (string1.length > 0 && string1 == string2) return 1f compare(stringCleaner.clean(string1.toCharArray), stringCleaner.clean(string2.toCharArray))(new StringCleanerDelegate) } |