summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2013-01-31 20:59:19 -0700
committerRocky Madden <git@rockymadden.com>2013-01-31 20:59:19 -0700
commit757a02dffc1b07fa3f2a0e031076eed73ee85d61 (patch)
tree5de87845ac5ce8aa7d13c5b3a9d620aa49b39ffb /core
parent5e6ea313f56a26190831127018336c54e6500443 (diff)
downloadstringmetric-757a02dffc1b07fa3f2a0e031076eed73ee85d61.tar.gz
stringmetric-757a02dffc1b07fa3f2a0e031076eed73ee85d61.tar.bz2
stringmetric-757a02dffc1b07fa3f2a0e031076eed73ee85d61.zip
Simplified traits. Originally forked from an internal project which had non-string based metrics as well.
Diffstat (limited to 'core')
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/Filter.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/Metric.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala6
-rwxr-xr-xcore/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala6
14 files changed, 26 insertions, 58 deletions
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala
deleted file mode 100755
index bc26fd1..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all algorithms. */
-trait Algorithm[T] {
- type ComputeReturn <: AnyRef
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala b/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala
deleted file mode 100755
index e623db1..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all filters. */
-trait Filter[T] {
- def filter(t: T): T
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala
deleted file mode 100755
index d862090..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all filterable [[com.rockymadden.stringmetric.Algorithm]]. */
-trait FilterableAlgorithm[T, F <: Filter[T]] extends Algorithm[T] {
- def compute(t: T)(implicit f: F): Option[ComputeReturn]
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala
deleted file mode 100755
index cdd0814..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all filterable and configurable [[com.rockymadden.stringmetric.Algorithm]]. */
-trait FilterableConfigurableAlgorithm[T, O, F <: Filter[T]] extends Algorithm[T] {
- def compute(t: T)(o: O)(implicit f: F): Option[ComputeReturn]
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala
deleted file mode 100755
index 914ac46..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all filterable and configurable [[com.rockymadden.stringmetric.Metric]]. */
-trait FilterableConfigurableMetric[T, O, F <: Filter[T]] extends Metric[T] {
- def compare(t1: T, t2: T)(o: O)(implicit f: F): Option[CompareReturn]
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala
index 70d109a..5224354 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala
@@ -1,8 +1,8 @@
package com.rockymadden.stringmetric
-/** Trait for all string based [[com.rockymadden.stringmetric.FilterableConfigurableAlgorithm]]. */
-trait FilterableConfigurableStringAlgorithm[O]
- extends FilterableConfigurableAlgorithm[String, O, StringFilter] with StringAlgorithm {
+/** Trait for all filterable and configurable [[com.rockymadden.stringmetric.StringAlgorithm]]. */
+trait FilterableConfigurableStringAlgorithm[O] extends StringAlgorithm {
+ def compute(string: String)(o: O)(implicit stringFilter: StringFilter): Option[ComputeReturn]
def compute(charArray: Array[Char])(o: O)(implicit stringFilter: StringFilter): Option[Array[_]]
}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala
index 3aaea58..5ed42e0 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala
@@ -1,8 +1,8 @@
package com.rockymadden.stringmetric
-/** Trait for all string based [[com.rockymadden.stringmetric.FilterableConfigurableMetric]]. */
-trait FilterableConfigurableStringMetric[O]
- extends FilterableConfigurableMetric[String, O, StringFilter] with StringMetric {
+/** Trait for all filterable and configurable [[com.rockymadden.stringmetric.StringMetric]]. */
+trait FilterableConfigurableStringMetric[O] extends StringMetric {
+ def compare(string1: String, string2: String)(o: O)(implicit stringFilter: StringFilter): Option[CompareReturn]
def compare(charArray1: Array[Char], charArray2: Array[Char])(o: O)
(implicit stringFilter: StringFilter): Option[CompareReturn]
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala
deleted file mode 100755
index 2e43859..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all filterable [[com.rockymadden.stringmetric.Metric]]. */
-trait FilterableMetric[T, F <: Filter[T]] extends Metric[T] {
- def compare(t1: T, t2: T)(implicit f: F): Option[CompareReturn]
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala
index f6aef84..a85e35c 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala
@@ -1,6 +1,8 @@
package com.rockymadden.stringmetric
-/** Trait for all string based [[com.rockymadden.stringmetric.FilterableAlgorithm]]. */
-trait FilterableStringAlgorithm extends FilterableAlgorithm[String, StringFilter] with StringAlgorithm {
+/** Trait for all filterable [[com.rockymadden.stringmetric.StringAlgorithm]]. */
+trait FilterableStringAlgorithm extends StringAlgorithm {
+ def compute(string: String)(implicit stringFilter: StringFilter): Option[ComputeReturn]
+
def compute(charArray: Array[Char])(implicit stringFilter: StringFilter): Option[Array[_]]
}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala
index 5c5fd07..cec9b09 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala
@@ -1,7 +1,9 @@
package com.rockymadden.stringmetric
-/** Trait for all string based [[com.rockymadden.stringmetric.FilterableMetric]]. */
-trait FilterableStringMetric extends FilterableMetric[String, StringFilter] with StringMetric {
+/** Trait for all filterable [[com.rockymadden.stringmetric.StringMetric]]. */
+trait FilterableStringMetric extends StringMetric {
+ def compare(string1: String, string2: String)(implicit stringFilter: StringFilter): Option[CompareReturn]
+
def compare(charArray1: Array[Char], charArray2: Array[Char])
(implicit stringFilter: StringFilter): Option[CompareReturn]
}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala b/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala
deleted file mode 100755
index 8ea8116..0000000
--- a/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.rockymadden.stringmetric
-
-/** Trait for all metrics. */
-trait Metric[T] {
- type CompareReturn <: AnyVal
-}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala
index 12ac074..9bb0271 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala
@@ -3,8 +3,10 @@ package com.rockymadden.stringmetric
import com.rockymadden.stringmetric.phonetic.{ MetaphoneAlgorithm, NysiisAlgorithm, RefinedSoundexAlgorithm, SoundexAlgorithm }
import com.rockymadden.stringmetric.similarity.NGramAlgorithm
-/** Trait for all string based [[com.rockymadden.stringmetric.Algorithm]]. */
-trait StringAlgorithm extends Algorithm[String]
+/** Trait for all string algorithms. */
+trait StringAlgorithm {
+ type ComputeReturn <: AnyRef
+}
/** Standalone convenience object for all extending [[com.rockymadden.stringmetric.StringAlgorithm]]. */
object StringAlgorithm {
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala b/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala
index f6081a5..2a84360 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala
@@ -2,8 +2,10 @@ package com.rockymadden.stringmetric
import com.rockymadden.stringmetric.filter._
-/** Trait for all string based [[com.rockymadden.stringmetric.Filter]]. */
-trait StringFilter extends Filter[String] {
+/** Trait for all string filters. */
+trait StringFilter {
+ def filter(string: String): String
+
def filter(charArray: Array[Char]): Array[Char]
}
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala
index babcd46..e05ce4e 100755
--- a/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala
+++ b/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala
@@ -3,8 +3,10 @@ package com.rockymadden.stringmetric
import com.rockymadden.stringmetric.phonetic.{ MetaphoneMetric, NysiisMetric, RefinedSoundexMetric, SoundexMetric }
import com.rockymadden.stringmetric.similarity._
-/** Trait for all string based [[com.rockymadden.stringmetric.Metric]]. */
-trait StringMetric extends Metric[String]
+/** Trait for all string metrics. */
+trait StringMetric {
+ type CompareReturn <: AnyVal
+}
/** Stabdalone convenience object for all extending [[com.rockymadden.stringmetric.StringMetric]]. */
object StringMetric {