next up previous contents index
Next: Filtered and mapped views Up: Collections Previous: Collectors

Histograms

In histogram.cecil:


let var max_histogram_values_to_keep:int; 
template object histogram[T <= ordered_hashable[T]] 
isa hash_CR_table[T,integer];
field title(@:histogram[`T]):string; 
field individual_values(@:histogram[`T]):hash_table[T,m_bag[any]]; 
method new_histogram[T <= ordered_hashable[T]]():histogram[T]; 
method new_histogram[T <= ordered_hashable[T]](t:string):histogram[T]; 
method increment(t@:histogram[`T], x:T):void; 
method increment_by_count(t@:histogram[`T], x:T, cnt:integer):void; 
method add_value(t@:histogram[`T], k:T, elem:any):void; 
method increment(t@:histogram[`T], x:T, elem:any):void; 
method print_statistics(t@:histogram[`T]):string; 
method print_statistics(t@:histogram[`T], some_key:T|string):string; 
method print_statistics(t@:histogram[`T <= num], some_key@num:T):string; 
method sort_it(t@:histogram[`T]):m_sorted_collection[T]; 
method print_string(t@:histogram[`T]):string; 
method print(t@:histogram[`T]):void; 
method frequency_sorted_print_string(t@:histogram[`T]):string; 
method percent_print_string(t@:histogram[`T]):string; 
method truncated_percent_print_string(t@:histogram[`T], over:T):string; 
method distribution[`T <= ordered_hashable[T]]( 
nm:string, cl:&(increment:&(value:T):void,
add_value:&(value:T, elem:any):void):void
):histogram[T];
method distribution(nm:string, 
cl:&(increment:&(value:int):void,
add_value:&(value:int, elem:any):void):void
):histogram[int];
A histogram supports accumulating counts for particular values and then printing out the results in a reasonable fashion. Abstractly, a histogram is a mapping from some domain of values to integers. The increment operation bumps the count associated with a particular value. To support the histogram's hash-table-based implementation and its sorted print_string output, the values being counted by the histogram must be both hashable and ordered.


next up previous contents index
Next: Filtered and mapped views Up: Collections Previous: Collectors

The Cecil project