gamnit: make `SpriteSet` public so clients can use its services
[nit.git] / lib / counter.nit
index ceecb48..e539bc5 100644 (file)
@@ -80,6 +80,12 @@ class Counter[E]
                map.clear
        end
 
+       redef fun add_all(other) do
+               for k, v in other do
+                       self[k] += v
+               end
+       end
+
        # Count one more occurrence of `e`
        fun inc(e: E)
        do
@@ -133,6 +139,7 @@ class Counter[E]
        # @toimplement by default just call `to_s` on the element
        protected fun element_to_s(e: E): String
        do
+               if e == null then return "null"
                return e.to_s
        end