metrics: move `sum` up to interface `Metric`
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 23 Apr 2015 18:58:11 +0000 (14:58 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 23 Apr 2015 19:13:52 +0000 (15:13 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/metrics/metrics_base.nit

index 7881e75..080ceec 100644 (file)
@@ -197,6 +197,9 @@ interface Metric
                end
        end
 
+       # The sum of all the values.
+       fun sum: VAL is abstract
+
        # The values standard derivation
        fun std_dev: Float is abstract
 
@@ -232,7 +235,7 @@ class IntMetric
 
        redef fun clear do values_cache.clear
 
-       fun sum: Int do return values_cache.sum
+       redef fun sum do return values_cache.sum
 
        redef fun max do
                assert not values_cache.is_empty
@@ -281,7 +284,8 @@ class FloatMetric
 
        redef fun clear do values_cache.clear
 
-       fun sum: Float do
+
+       redef fun sum do
                var sum = 0.0
                for v in values.values do sum += v
                return sum