package fr.lifl.stc.stan.implicitFlow.QuineMcCluskey; import java.util.HashMap; import java.util.Iterator; /** * * @author dorina * */ public class StatsMinimization { public int MAX_VAR = -1; /** * key> => number of expression with key elements */ public HashMap noVars = new HashMap(); /** * increments the number of expressions with n elements by one * @param n number */ public void inc(int n) { Integer N = new Integer(n); int i = 0; if(noVars.containsKey(N)){ i = noVars.get(N).intValue(); } noVars.put(N, new Integer(i+1)); } public void setMax(int max) { if(max > MAX_VAR) MAX_VAR = max; } public void printStats(){ System.out.println("maximum expression : " + MAX_VAR); Iterator it = this.noVars.keySet().iterator(); while(it.hasNext()) { Integer key = it.next(); System.out.println("key "+key+" => "+noVars.get(key)+" times"); } } }