+ print " {element_to_s(t)}: {self[t]} ({div(self[t]*100,self.sum)}%)"
+ end
+ end
+
+ # Return the element with the highest value
+ fun max: nullable E do
+ var max: nullable Int = null
+ var elem: nullable E = null
+ for e, v in map do
+ if max == null or v > max then
+ max = v
+ elem = e
+ end
+ end
+ return elem
+ end
+
+ # Return the couple with the lowest value
+ fun min: nullable E do
+ var min: nullable Int = null
+ var elem: nullable E = null
+ for e, v in map do
+ if min == null or v < min then
+ min = v
+ elem = e
+ end
+ end
+ return elem
+ end
+
+ # Values average
+ fun avg: Float do
+ if values.is_empty then return 0.0
+ return (sum / values.length).to_f
+ end
+
+ # The standard derivation of the counter values
+ fun std_dev: Float do
+ var avg = self.avg
+ var sum = 0.0
+ for value in map.values do
+ sum += (value.to_f - avg).pow(2.0)