lib: fix Counter::clear
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 25 Mar 2014 21:21:08 +0000 (17:21 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 25 Apr 2014 01:56:13 +0000 (21:56 -0400)
Now the sum is also set to 0 when call to clear

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/counter.nit

index 2f16944..75278d2 100644 (file)
@@ -52,7 +52,10 @@ class Counter[E: Object]
 
        redef fun is_empty do return map.is_empty
 
-       redef fun clear do map.clear
+       redef fun clear do
+               sum = 0
+               map.clear
+       end
 
        # Count one more occurrence of `e`
        fun inc(e: E)