diff options
38 files changed, 235 insertions, 235 deletions
diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/diceSorensenMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/diceSorensenMetric.scala index 5906acf..bddae46 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/diceSorensenMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/diceSorensenMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ AsciiCaseStringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ AsciiCaseStringFilter, StringFilterDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.similarity.DiceSorensenMetric @@ -52,7 +52,7 @@ object diceSorensenMetric extends Command { DiceSorensenMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate with AsciiCaseStringCleaner).getOrElse("not comparable").toString + )(new StringFilterDelegate with AsciiCaseStringFilter).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala index 4068c84..cdb1864 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ AsciiCaseStringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ AsciiCaseStringFilter, StringFilterDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.similarity.HammingMetric @@ -52,7 +52,7 @@ object hammingMetric extends Command { HammingMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate with AsciiCaseStringCleaner).getOrElse("not comparable").toString + )(new StringFilterDelegate with AsciiCaseStringFilter).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala index 28d7abb..7e9fa07 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ AsciiCaseStringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ AsciiCaseStringFilter, StringFilterDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.similarity.JaroMetric @@ -52,7 +52,7 @@ object jaroMetric extends Command { JaroMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate with AsciiCaseStringCleaner).getOrElse("not comparable").toString + )(new StringFilterDelegate with AsciiCaseStringFilter).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala index 1a031b3..bfaa7e9 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ AsciiCaseStringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ AsciiCaseStringFilter, StringFilterDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.similarity.JaroWinklerMetric @@ -52,7 +52,7 @@ object jaroWinklerMetric extends Command { JaroWinklerMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate with AsciiCaseStringCleaner).getOrElse("not comparable").toString + )(new StringFilterDelegate with AsciiCaseStringFilter).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala index a4c917f..1364a5a 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ AsciiCaseStringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ AsciiCaseStringFilter, StringFilterDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.similarity.LevenshteinMetric @@ -53,7 +53,7 @@ object levenshteinMetric extends Command { LevenshteinMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate with AsciiCaseStringCleaner).getOrElse("not comparable").toString + )(new StringFilterDelegate with AsciiCaseStringFilter).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneMetric.scala index 9687273..6e46de9 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.StringCleanerDelegate +import org.hashtree.stringmetric.StringFilterDelegate import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.phonetic.MetaphoneMetric @@ -52,7 +52,7 @@ object metaphoneMetric extends Command { MetaphoneMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate).getOrElse("not comparable").toString + )(new StringFilterDelegate).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala index 0d52972..c9590c3 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.StringCleanerDelegate +import org.hashtree.stringmetric.StringFilterDelegate import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ import org.hashtree.stringmetric.phonetic.SoundexMetric @@ -52,7 +52,7 @@ object soundexMetric extends Command { SoundexMetric.compare( strings(0), strings(1) - )(new StringCleanerDelegate).getOrElse("not comparable").toString + )(new StringFilterDelegate).getOrElse("not comparable").toString ) } }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiCaseStringCleaner.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiCaseStringCleaner.scala deleted file mode 100755 index b70f15c..0000000 --- a/core/source/core/scala/org/hashtree/stringmetric/AsciiCaseStringCleaner.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.hashtree.stringmetric - -/** A decorator [[org.hashtree.stringmetric.StringCleaner]]. Ensures the input case-sensitivity does not matter. */ -trait AsciiCaseStringCleaner extends StringCleaner { - abstract override def clean(charArray: Array[Char]): Array[Char] = { - super.clean( - charArray.map { c => - if (c >= 65 && c <= 90) (c + 32).toChar else c - } - ) - } - - abstract override def clean(string: String): String = super.clean(string.toLowerCase) -}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiCaseStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiCaseStringFilter.scala new file mode 100755 index 0000000..cb78cef --- /dev/null +++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiCaseStringFilter.scala @@ -0,0 +1,14 @@ +package org.hashtree.stringmetric + +/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures the input case-sensitivity does not matter. */ +trait AsciiCaseStringFilter extends StringFilter { + abstract override def filter(charArray: Array[Char]): Array[Char] = { + super.filter( + charArray.map { c => + if (c >= 65 && c <= 90) (c + 32).toChar else c + } + ) + } + + abstract override def filter(string: String): String = super.filter(string.toLowerCase) +}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringCleaner.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringCleaner.scala deleted file mode 100755 index 5a93b30..0000000 --- a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringCleaner.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.hashtree.stringmetric - -/** A decorator [[org.hashtree.stringmetric.StringCleaner]]. Ensures only ASCII letters matter. */ -trait AsciiLetterOnlyStringCleaner extends StringCleaner { - abstract override def clean(charArray: Array[Char]): Array[Char] = { - super.clean( - charArray.filter { c => - (c >= 65 && c <= 90 ) || (c >= 97 && c <= 122) - } - ) - } - - abstract override def clean(string: String): String = clean(string.toCharArray).mkString -}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala new file mode 100755 index 0000000..ebbc1de --- /dev/null +++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala @@ -0,0 +1,14 @@ +package org.hashtree.stringmetric + +/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures only ASCII letters matter. */ +trait AsciiLetterOnlyStringFilter extends StringFilter { + abstract override def filter(charArray: Array[Char]): Array[Char] = { + super.filter( + charArray.filter { c => + (c >= 65 && c <= 90 ) || (c >= 97 && c <= 122) + } + ) + } + + abstract override def filter(string: String): String = filter(string.toCharArray).mkString +}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/Cleaner.scala b/core/source/core/scala/org/hashtree/stringmetric/Cleaner.scala deleted file mode 100755 index 1ce970a..0000000 --- a/core/source/core/scala/org/hashtree/stringmetric/Cleaner.scala +++ /dev/null @@ -1,6 +0,0 @@ -package org.hashtree.stringmetric - -/** Marks those which leverage traits of a cleaner. */ -trait Cleaner[T] { - def clean(t: T): T -}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/Filter.scala b/core/source/core/scala/org/hashtree/stringmetric/Filter.scala new file mode 100755 index 0000000..c79985f --- /dev/null +++ b/core/source/core/scala/org/hashtree/stringmetric/Filter.scala @@ -0,0 +1,6 @@ +package org.hashtree.stringmetric + +/** Marks those which leverage traits of a filter. */ +trait Filter[T] { + def filter(t: T): T +}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/SpaceStringCleaner.scala b/core/source/core/scala/org/hashtree/stringmetric/SpaceStringCleaner.scala deleted file mode 100755 index 4128712..0000000 --- a/core/source/core/scala/org/hashtree/stringmetric/SpaceStringCleaner.scala +++ /dev/null @@ -1,8 +0,0 @@ -package org.hashtree.stringmetric - -/** A decorator [[org.hashtree.stringmetric.StringCleaner]]. Ensures the input spacing does not matter. */ -trait SpaceStringCleaner extends StringCleaner { - abstract override def clean(charArray: Array[Char]): Array[Char] = super.clean(charArray.filter(_ != ' ')) - - abstract override def clean(string: String): String = super.clean(string.replaceAllLiterally(" ", "")) -}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/SpaceStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/SpaceStringFilter.scala new file mode 100755 index 0000000..7619e4f --- /dev/null +++ b/core/source/core/scala/org/hashtree/stringmetric/SpaceStringFilter.scala @@ -0,0 +1,8 @@ +package org.hashtree.stringmetric + +/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures the input spacing does not matter. */ +trait SpaceStringFilter extends StringFilter { + abstract override def filter(charArray: Array[Char]): Array[Char] = super.filter(charArray.filter(_ != ' ')) + + abstract override def filter(string: String): String = super.filter(string.replaceAllLiterally(" ", "")) +}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/StringAlgorithm.scala b/core/source/core/scala/org/hashtree/stringmetric/StringAlgorithm.scala index 2901010..e85f83e 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/StringAlgorithm.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/StringAlgorithm.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric /** Marks those which leverage traits of a string based [[org.hashtree.stringmetric.Algorithm]]. */ -trait StringAlgorithm extends Algorithm[String, StringCleaner] { - def compute(ca: Array[Char])(implicit stringCleaner: StringCleaner): Option[Array[Char]] +trait StringAlgorithm extends Algorithm[String, StringFilter] { + def compute(ca: Array[Char])(implicit stringFilter: StringFilter): Option[Array[Char]] }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/StringCleaner.scala b/core/source/core/scala/org/hashtree/stringmetric/StringCleaner.scala deleted file mode 100755 index b6d2671..0000000 --- a/core/source/core/scala/org/hashtree/stringmetric/StringCleaner.scala +++ /dev/null @@ -1,6 +0,0 @@ -package org.hashtree.stringmetric - -/** Marks those which leverage traits of a string based [[org.hashtree.stringmetric.Cleaner]]. */ -trait StringCleaner extends Cleaner[String] { - def clean(charArray: Array[Char]): Array[Char] -}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/StringCleanerDelegate.scala b/core/source/core/scala/org/hashtree/stringmetric/StringCleanerDelegate.scala deleted file mode 100755 index 988715f..0000000 --- a/core/source/core/scala/org/hashtree/stringmetric/StringCleanerDelegate.scala +++ /dev/null @@ -1,7 +0,0 @@ -package org.hashtree.stringmetric - -class StringCleanerDelegate extends StringCleaner { - override def clean(charArray: Array[Char]): Array[Char] = charArray - - override def clean(string: String): String = string -}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/StringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/StringFilter.scala new file mode 100755 index 0000000..6d2b532 --- /dev/null +++ b/core/source/core/scala/org/hashtree/stringmetric/StringFilter.scala @@ -0,0 +1,6 @@ +package org.hashtree.stringmetric + +/** Marks those which leverage traits of a string based [[org.hashtree.stringmetric.Filter]]. */ +trait StringFilter extends Filter[String] { + def filter(charArray: Array[Char]): Array[Char] +}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/StringFilterDelegate.scala b/core/source/core/scala/org/hashtree/stringmetric/StringFilterDelegate.scala new file mode 100755 index 0000000..e5154b4 --- /dev/null +++ b/core/source/core/scala/org/hashtree/stringmetric/StringFilterDelegate.scala @@ -0,0 +1,7 @@ +package org.hashtree.stringmetric + +class StringFilterDelegate extends StringFilter { + override def filter(charArray: Array[Char]): Array[Char] = charArray + + override def filter(string: String): String = string +}
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/StringMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/StringMetric.scala index 115a9e9..57add60 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/StringMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/StringMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric /** Marks those which leverage traits of a string based [[org.hashtree.stringmetric.Metric]]. */ -trait StringMetric extends Metric[String, StringCleaner] { - def compare(ca1: Array[Char], ca2: Array[Char])(implicit stringCleaner: StringCleaner): Option[AnyVal] +trait StringMetric extends Metric[String, StringFilter] { + def compare(ca1: Array[Char], ca2: Array[Char])(implicit stringFilter: StringFilter): Option[AnyVal] }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/package.scala b/core/source/core/scala/org/hashtree/stringmetric/package.scala index 6c842ba..e46661f 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/package.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/package.scala @@ -6,5 +6,5 @@ package object stringmetric { type MatchTuple[T] = Tuple2[Array[T], Array[T]] - implicit val stringCleaner = new StringCleanerDelegate + implicit val stringFilter = new StringFilterDelegate }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/phonetic/Metaphone.scala b/core/source/core/scala/org/hashtree/stringmetric/phonetic/Metaphone.scala index 4305a58..7fe848d 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/phonetic/Metaphone.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/phonetic/Metaphone.scala @@ -1,12 +1,12 @@ package org.hashtree.stringmetric.phonetic -import org.hashtree.stringmetric.{ StringAlgorithm, StringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ StringAlgorithm, StringFilter, StringFilterDelegate } import scala.annotation.tailrec /** An implementation of the Metaphone [[org.hashtree.stringmetric.StringAlgorithm]]. */ object Metaphone extends StringAlgorithm { - override def compute(charArray: Array[Char])(implicit stringCleaner: StringCleaner): Option[Array[Char]] = { - val ca = stringCleaner.clean(charArray) + override def compute(charArray: Array[Char])(implicit stringFilter: StringFilter): Option[Array[Char]] = { + val ca = stringFilter.filter(charArray) if (ca.length == 0) None else { @@ -20,8 +20,8 @@ object Metaphone extends StringAlgorithm { } } - override def compute(string: String)(implicit stringCleaner: StringCleaner): Option[String] = { - compute(stringCleaner.clean(string.toCharArray))(new StringCleanerDelegate) match { + override def compute(string: String)(implicit stringFilter: StringFilter): Option[String] = { + compute(stringFilter.filter(string.toCharArray))(new StringFilterDelegate) match { case Some(mp) => Some(mp.mkString) case None => None } diff --git a/core/source/core/scala/org/hashtree/stringmetric/phonetic/MetaphoneMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/phonetic/MetaphoneMetric.scala index 727d432..bd3f9bc 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/phonetic/MetaphoneMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/phonetic/MetaphoneMetric.scala @@ -1,12 +1,12 @@ package org.hashtree.stringmetric.phonetic -import org.hashtree.stringmetric.{ StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ StringFilter, StringFilterDelegate, StringMetric } /** An implementation of the Metaphone [[org.hashtree.stringmetric.StringMetric]]. */ object MetaphoneMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Boolean] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Boolean] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) if (ca1.length == 0 || ca2.length == 0) None else { @@ -20,11 +20,11 @@ object MetaphoneMetric extends StringMetric { } } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Boolean] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Boolean] = { // Unable to perform simple equality check, due to situations where no letters are passed. compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/phonetic/Soundex.scala b/core/source/core/scala/org/hashtree/stringmetric/phonetic/Soundex.scala index 75762ca..4d69b28 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/phonetic/Soundex.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/phonetic/Soundex.scala @@ -1,12 +1,12 @@ package org.hashtree.stringmetric.phonetic -import org.hashtree.stringmetric.{ StringAlgorithm, StringCleaner, StringCleanerDelegate } +import org.hashtree.stringmetric.{ StringAlgorithm, StringFilter, StringFilterDelegate } import scala.annotation.tailrec /** An implementation of the Soundex [[org.hashtree.stringmetric.StringAlgorithm]]. */ object Soundex extends StringAlgorithm { - override def compute(charArray: Array[Char])(implicit stringCleaner: StringCleaner): Option[Array[Char]] = { - val ca = stringCleaner.clean(charArray) + override def compute(charArray: Array[Char])(implicit stringFilter: StringFilter): Option[Array[Char]] = { + val ca = stringFilter.filter(charArray) if (ca.length == 0) None else { @@ -28,8 +28,8 @@ object Soundex extends StringAlgorithm { } } - override def compute(string: String)(implicit stringCleaner: StringCleaner): Option[String] = { - compute(stringCleaner.clean(string.toCharArray))(new StringCleanerDelegate) match { + override def compute(string: String)(implicit stringFilter: StringFilter): Option[String] = { + compute(stringFilter.filter(string.toCharArray))(new StringFilterDelegate) match { case Some(se) => Some(se.mkString) case None => None } diff --git a/core/source/core/scala/org/hashtree/stringmetric/phonetic/SoundexMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/phonetic/SoundexMetric.scala index cc891ab..cca2f4e 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/phonetic/SoundexMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/phonetic/SoundexMetric.scala @@ -1,12 +1,12 @@ package org.hashtree.stringmetric.phonetic -import org.hashtree.stringmetric.{ StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ StringFilter, StringFilterDelegate, StringMetric } /** An implementation of the Soundex [[org.hashtree.stringmetric.StringMetric]]. */ object SoundexMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Boolean] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Boolean] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) if (ca1.length == 0 || ca2.length == 0) None else { @@ -20,11 +20,11 @@ object SoundexMetric extends StringMetric { } } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Boolean] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Boolean] = { // Unable to perform simple equality check, due to situations where no letters are passed. compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/similarity/DiceSorensenMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/similarity/DiceSorensenMetric.scala index e7d3dbe..64a3c1a 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/similarity/DiceSorensenMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/similarity/DiceSorensenMetric.scala @@ -1,13 +1,13 @@ package org.hashtree.stringmetric.similarity -import org.hashtree.stringmetric.{ CompareTuple, MatchTuple, StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ CompareTuple, MatchTuple, StringFilter, StringFilterDelegate, StringMetric } import scala.annotation.tailrec /** An implementation of the Dice, and Sorensen, [[org.hashtree.stringmetric.StringMetric]]. */ object DiceSorensenMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Double] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Double] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) if (ca1.length == 0 || ca2.length == 0) None else { @@ -18,13 +18,13 @@ object DiceSorensenMetric extends StringMetric { } } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Double] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Double] = { if (string1.length > 0 && string1.length == string2.length && string1 == string2) Some(1d) else compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } private[this] def bigrams(ct: CompareTuple[Char]): MatchTuple[String] = { diff --git a/core/source/core/scala/org/hashtree/stringmetric/similarity/HammingMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/similarity/HammingMetric.scala index 673e7fe..04001f5 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/similarity/HammingMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/similarity/HammingMetric.scala @@ -1,24 +1,24 @@ package org.hashtree.stringmetric.similarity -import org.hashtree.stringmetric.{ CompareTuple, StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ CompareTuple, StringFilter, StringFilterDelegate, StringMetric } /** An implementation of the Hamming [[org.hashtree.stringmetric.StringMetric]]. */ object HammingMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Int] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Int] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) if (ca1.length == 0 || ca2.length == 0 || ca1.length != ca2.length) None else Some(hamming(ca1, ca2)) } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Int] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Int] = { if (string1.length > 0 && string1.length == string2.length && string1 == string2) Some(0) else compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } private[this] def hamming(ct: CompareTuple[Char]) = { diff --git a/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroMetric.scala index 8cc7b23..503b497 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.similarity -import org.hashtree.stringmetric.{ CompareTuple, MatchTuple, StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ CompareTuple, MatchTuple, StringFilter, StringFilterDelegate, StringMetric } import scala.collection.mutable.{ ArrayBuffer, HashSet } /** @@ -9,9 +9,9 @@ import scala.collection.mutable.{ ArrayBuffer, HashSet } * distance in these scenarios. */ object JaroMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Double] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Double] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) if (ca1.length == 0 || ca2.length == 0) None else { @@ -25,13 +25,13 @@ object JaroMetric extends StringMetric { } } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Double] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Double] = { if (string1.length > 0 && string1.length == string2.length && string1 == string2) Some(1d) else compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } private[this] def `match`(ct: CompareTuple[Char]): MatchTuple[Char] = { diff --git a/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroWinklerMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroWinklerMetric.scala index fed4c6b..9b797bc 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroWinklerMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/similarity/JaroWinklerMetric.scala @@ -1,6 +1,6 @@ package org.hashtree.stringmetric.similarity -import org.hashtree.stringmetric.{ StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ StringFilter, StringFilterDelegate, StringMetric } /** * An implementation of the Jaro-Winkler [[org.hashtree.stringmetric.StringMetric]]. One differing detail in this @@ -8,11 +8,11 @@ import org.hashtree.stringmetric.{ StringCleaner, StringCleanerDelegate, StringM * penalized distance in these scenarios (e.g. comparing henka and henkan distance is 0.9666 versus the typical 0.9722). */ object JaroWinklerMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Double] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Double] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) - JaroMetric.compare(ca1, ca2)(new StringCleanerDelegate) match { + JaroMetric.compare(ca1, ca2)(new StringFilterDelegate) match { case Some(jaro) => { val prefix = ca1.zip(ca2).takeWhile(t => t._1 == t._2).map(_._1) @@ -22,12 +22,12 @@ object JaroWinklerMetric extends StringMetric { } } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Double] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Double] = { if (string1.length > 0 && string1.length == string2.length && string1 == string2) Some(1d) else compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/similarity/LevenshteinMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/similarity/LevenshteinMetric.scala index 53af158..3e6a926 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/similarity/LevenshteinMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/similarity/LevenshteinMetric.scala @@ -1,12 +1,12 @@ package org.hashtree.stringmetric.similarity -import org.hashtree.stringmetric.{ CompareTuple, StringCleaner, StringCleanerDelegate, StringMetric } +import org.hashtree.stringmetric.{ CompareTuple, StringFilter, StringFilterDelegate, StringMetric } /** An implementation of the Levenshtein [[org.hashtree.stringmetric.StringMetric]]. */ object LevenshteinMetric extends StringMetric { - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Int] = { - val ca1 = stringCleaner.clean(charArray1) - val ca2 = stringCleaner.clean(charArray2) + override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringFilter: StringFilter): Option[Int] = { + val ca1 = stringFilter.filter(charArray1) + val ca2 = stringFilter.filter(charArray2) if (ca1.length == 0 && ca2.length == 0) None else { @@ -16,13 +16,13 @@ object LevenshteinMetric extends StringMetric { } } - override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Int] = { + override def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[Int] = { if (string1.length > 0 && string1.length == string2.length && string1 == string2) Some(0) else compare( - stringCleaner.clean(string1.toCharArray), - stringCleaner.clean(string2.toCharArray) - )(new StringCleanerDelegate) + stringFilter.filter(string1.toCharArray), + stringFilter.filter(string2.toCharArray) + )(new StringFilterDelegate) } private[this] def levenshtein(f: CompareTuple[Char] => Int)(ct: CompareTuple[Char]): Int = { diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiCaseStringCleanerSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiCaseStringFilterSpec.scala index 52239ba..62cd4de 100755 --- a/core/source/test/scala/org/hashtree/stringmetric/AsciiCaseStringCleanerSpec.scala +++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiCaseStringFilterSpec.scala @@ -4,30 +4,30 @@ import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) -final class AsciiCaseStringCleanerSpec extends ScalaTest { - private final val Cleaner = new StringCleanerDelegate with AsciiCaseStringCleaner +final class AsciiCaseStringFilterSpec extends ScalaTest { + private final val Filter = new StringFilterDelegate with AsciiCaseStringFilter - "AsciiCaseStringCleaner" should provide { - "overloaded clean method" when passed { + "AsciiCaseStringFilter" should provide { + "overloaded filter method" when passed { "String with mixed case" should returns { "String with the same case" in { - Cleaner.clean("HelloWorld") should (equal ("helloworld") or equal ("HELLOWORLD")) - Cleaner.clean("Hello World") should (equal ("hello world") or equal ("HELLO WORLD")) - Cleaner.clean("H e l l o W o r l d") should + Filter.filter("HelloWorld") should (equal ("helloworld") or equal ("HELLOWORLD")) + Filter.filter("Hello World") should (equal ("hello world") or equal ("HELLO WORLD")) + Filter.filter("H e l l o W o r l d") should (equal ("h e l l o w o r l d") or equal ("H E L L O W O R L D")) - Cleaner.clean("H e l l o W o r l d") should + Filter.filter("H e l l o W o r l d") should (equal ("h e l l o w o r l d") or equal ("H E L L O W O R L D")) } } "character array with mixed case" should returns { "character array with the same case" in { - Cleaner.clean("HelloWorld".toCharArray) should + Filter.filter("HelloWorld".toCharArray) should (equal ("helloworld".toCharArray) or equal ("HELLOWORLD".toCharArray)) - Cleaner.clean("Hello World".toCharArray) should + Filter.filter("Hello World".toCharArray) should (equal ("hello world".toCharArray) or equal ("HELLO WORLD".toCharArray)) - Cleaner.clean("H e l l o W o r l d".toCharArray) should + Filter.filter("H e l l o W o r l d".toCharArray) should (equal ("h e l l o w o r l d".toCharArray) or equal ("H E L L O W O R L D".toCharArray)) - Cleaner.clean("H e l l o W o r l d".toCharArray) should + Filter.filter("H e l l o W o r l d".toCharArray) should (equal ("h e l l o w o r l d".toCharArray) or equal ("H E L L O W O R L D".toCharArray)) } } diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringCleanerSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringCleanerSpec.scala deleted file mode 100755 index 99ed40d..0000000 --- a/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringCleanerSpec.scala +++ /dev/null @@ -1,26 +0,0 @@ -package org.hashtree.stringmetric - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class AsciiLetterOnlyStringCleanerSpec extends ScalaTest { - private final val Cleaner = new StringCleanerDelegate with AsciiLetterOnlyStringCleaner - - "AsciiLetterOnlyStringCleaner" should provide { - "overloaded clean method" when passed { - "String with mixed characters" should returns { - "String with non-letters removed" in { - Cleaner.clean("!@#$%^&*()abc") should equal ("abc") - Cleaner.clean("!@#$%^&*()abc123") should equal ("abc") - } - } - "character array with mixed characters" should returns { - "character array with non-letters removed" in { - Cleaner.clean("!@#$%^&*()abc".toCharArray) should equal ("abc".toCharArray) - Cleaner.clean("!@#$%^&*()abc123".toCharArray) should equal ("abc".toCharArray) - } - } - } - } -}
\ No newline at end of file diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilterSpec.scala new file mode 100755 index 0000000..7360b72 --- /dev/null +++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilterSpec.scala @@ -0,0 +1,26 @@ +package org.hashtree.stringmetric + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class AsciiLetterOnlyStringFilterSpec extends ScalaTest { + private final val Filter = new StringFilterDelegate with AsciiLetterOnlyStringFilter + + "AsciiLetterOnlyStringFilter" should provide { + "overloaded filter method" when passed { + "String with mixed characters" should returns { + "String with non-letters removed" in { + Filter.filter("!@#$%^&*()abc") should equal ("abc") + Filter.filter("!@#$%^&*()abc123") should equal ("abc") + } + } + "character array with mixed characters" should returns { + "character array with non-letters removed" in { + Filter.filter("!@#$%^&*()abc".toCharArray) should equal ("abc".toCharArray) + Filter.filter("!@#$%^&*()abc123".toCharArray) should equal ("abc".toCharArray) + } + } + } + } +}
\ No newline at end of file diff --git a/core/source/test/scala/org/hashtree/stringmetric/SpaceStringCleanerSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/SpaceStringCleanerSpec.scala deleted file mode 100755 index f58a4df..0000000 --- a/core/source/test/scala/org/hashtree/stringmetric/SpaceStringCleanerSpec.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.hashtree.stringmetric - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class SpaceStringCleanerSpec extends ScalaTest { - private final val Cleaner = new StringCleanerDelegate with SpaceStringCleaner - - "SpaceStringCleaner" should provide { - "overloaded clean method" when passed { - "String with spaces" should returns { - "String with spaces removed" in { - Cleaner.clean("HelloWorld") should equal ("HelloWorld") - Cleaner.clean(" HelloWorld ") should equal ("HelloWorld") - Cleaner.clean("Hello World") should equal ("HelloWorld") - Cleaner.clean("H e l l o W o r l d") should equal ("HelloWorld") - Cleaner.clean("H e l l o W o r l d") should equal ("HelloWorld") - } - } - "character array with spaces" should returns { - "character array with spaces removed" in { - Cleaner.clean("HelloWorld".toCharArray) should equal ("HelloWorld".toCharArray) - Cleaner.clean(" HelloWorld ".toCharArray) should equal ("HelloWorld".toCharArray) - Cleaner.clean("Hello World".toCharArray) should equal ("HelloWorld".toCharArray) - Cleaner.clean("H e l l o W o r l d".toCharArray) should equal ("HelloWorld".toCharArray) - Cleaner.clean("H e l l o W o r l d".toCharArray) should equal ("HelloWorld".toCharArray) - } - } - } - } -}
\ No newline at end of file diff --git a/core/source/test/scala/org/hashtree/stringmetric/SpaceStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/SpaceStringFilterSpec.scala new file mode 100755 index 0000000..9396461 --- /dev/null +++ b/core/source/test/scala/org/hashtree/stringmetric/SpaceStringFilterSpec.scala @@ -0,0 +1,32 @@ +package org.hashtree.stringmetric + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class SpaceStringFilterSpec extends ScalaTest { + private final val Filter = new StringFilterDelegate with SpaceStringFilter + + "SpaceStringFilter" should provide { + "overloaded filter method" when passed { + "String with spaces" should returns { + "String with spaces removed" in { + Filter.filter("HelloWorld") should equal ("HelloWorld") + Filter.filter(" HelloWorld ") should equal ("HelloWorld") + Filter.filter("Hello World") should equal ("HelloWorld") + Filter.filter("H e l l o W o r l d") should equal ("HelloWorld") + Filter.filter("H e l l o W o r l d") should equal ("HelloWorld") + } + } + "character array with spaces" should returns { + "character array with spaces removed" in { + Filter.filter("HelloWorld".toCharArray) should equal ("HelloWorld".toCharArray) + Filter.filter(" HelloWorld ".toCharArray) should equal ("HelloWorld".toCharArray) + Filter.filter("Hello World".toCharArray) should equal ("HelloWorld".toCharArray) + Filter.filter("H e l l o W o r l d".toCharArray) should equal ("HelloWorld".toCharArray) + Filter.filter("H e l l o W o r l d".toCharArray) should equal ("HelloWorld".toCharArray) + } + } + } + } +}
\ No newline at end of file diff --git a/core/source/test/scala/org/hashtree/stringmetric/StringCleanerDelegateSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/StringCleanerDelegateSpec.scala deleted file mode 100755 index 5016500..0000000 --- a/core/source/test/scala/org/hashtree/stringmetric/StringCleanerDelegateSpec.scala +++ /dev/null @@ -1,24 +0,0 @@ -package org.hashtree.stringmetric - -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class StringCleanerDelegateSpec extends ScalaTest { - private final val Cleaner = new StringCleanerDelegate - - "StringCleanerDelegate" should provide { - "overloaded clean method" when passed { - "String" should returns { - "the same String" in { - Cleaner.clean("Hello World") should equal ("Hello World") - } - } - "character array" should returns { - "the same character array" in { - Cleaner.clean("Hello World".toCharArray) should equal ("Hello World".toCharArray) - } - } - } - } -}
\ No newline at end of file diff --git a/core/source/test/scala/org/hashtree/stringmetric/StringFilterDelegateSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/StringFilterDelegateSpec.scala new file mode 100755 index 0000000..7b1b3c6 --- /dev/null +++ b/core/source/test/scala/org/hashtree/stringmetric/StringFilterDelegateSpec.scala @@ -0,0 +1,24 @@ +package org.hashtree.stringmetric + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class StringFilterDelegateSpec extends ScalaTest { + private final val Filter = new StringFilterDelegate + + "StringFilterDelegate" should provide { + "overloaded filter method" when passed { + "String" should returns { + "the same String" in { + Filter.filter("Hello World") should equal ("Hello World") + } + } + "character array" should returns { + "the same character array" in { + Filter.filter("Hello World".toCharArray) should equal ("Hello World".toCharArray) + } + } + } + } +}
\ No newline at end of file |