org.ggp.base.apps.research.Histogram Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alloy-ggp-base Show documentation
Show all versions of alloy-ggp-base Show documentation
A modified version of the GGP-Base library for Alloy.
The newest version!
package org.ggp.base.apps.research;
/**
* Histogram is a way of visualizing an unordered collection with repeated
* elements, by mapping each element to the number of times that it appears.
* It is an aggregation that maps keys to counts.
*
* @author Sam Schreiber
*/
public final class Histogram extends Aggregation
{
public void add(String key) {
if (!containsEntry(key)) {
createEntry(key, new Counter());
}
getEntryData(key).addValue(1);
}
}