use of org.bedework.sysevents.events.StatsEvent in project bw-calendar-engine by Bedework.
the class DataValues method update.
/**
* @param ev
*/
public void update(final SysEvent ev) {
SysCode sc = ev.getSysCode();
if (ev instanceof TimedEvent) {
TimedEvent te = (TimedEvent) ev;
String lbl = te.getLabel();
DataAvg dv = timedValuesMap.get(lbl);
if (dv == null) {
dv = new DataAvg(lbl, ev.getSysCode());
timedValuesMap.put(lbl, dv);
}
dv.inc(te.getMillis());
return;
}
if (ev instanceof MillisecsEvent) {
DataAvg dv = dvMap.get(sc);
if (dv != null) {
dv.inc(((MillisecsEvent) ev).getMillis());
}
return;
}
if (sc == SysCode.STATS) {
StatsEvent se = (StatsEvent) ev;
String sname = se.getName();
DataAvg da = statMap.get(sname);
if (da == null) {
da = new DataAvg(sname, sc);
statMap.put(sname, da);
}
StatType st = StatsEvent.getStatType(sname);
if (st != StatType.lnum) {
da.inc(1);
} else if (se.getLongValue() != null) {
da.inc(se.getLongValue());
}
return;
}
}
Aggregations