@Override public void computeData(Graph g, Network n, HashMap<String, Metric> m) { DataStorageList dsl = (DataStorageList) g.getProperty("DATA_STORAGE_0"); int max = 0; for (DataStorage ds : dsl.getList()) { // System.out.println("DS.size = " + ds.size()); if (ds.size() > max) { max = ds.size(); } } double[] distr = new double[max + 1]; for (DataStorage ds : dsl.getList()) { distr[ds.size()]++; } ArrayUtils.divide(distr, dsl.getList().length); this.dataItemsDistribution = new Distribution(distr); }
@Override public boolean applicable(Graph g, Network n, HashMap<String, Metric> m) { return g.hasProperty("DATA_STORAGE_0") && g.getProperty("DATA_STORAGE_0") instanceof DataStorageList; }