protected Statistics update(Statistics st, String value) { st.add(value, 1.0d); return st; }
protected Statistics update(Statistics st, String value) { st.add(value, 1.0d); return st; }
protected Statistics update(Statistics st, String value) { st.add(value, 1.0d); return st; }
public Statistics(Statistics stats) { this(stats.getName()); this.add(stats); }
public Statistics(Statistics stats) { this(stats.getName()); this.add(stats); }
/** * @see stream.data.DataListener#dataArrived(stream.Data) */ public void dataArrived(Data item) { log.debug("Data arrived: {}", item); Statistics stats = new Statistics(""); for (String key : item.keySet()) { try { Serializable val = item.get(key); if (val instanceof Number) { stats.add(key, new Double(val.toString())); } // Double val = new Double("" + item.get(key)); // stats.add(key, val); } catch (Exception e) { log.error("Error: {}", e.getMessage()); } } dataArrived(stats); }
/** * @see stream.statistics.History#add(java.lang.Long, java.lang.Object) */ @Override public void add(Long timestamp, Statistics data) { Long x = adjust(timestamp); Statistics st = get(x); if (st == null) { st = new Statistics(data); this.map.put(x, st); } else { st.add(data); } this.last = x; } }
/** * @see stream.statistics.History#add(java.lang.Long, java.lang.Object) */ @Override public void add(Long timestamp, Statistics data) { Long x = adjust(timestamp); Statistics st = get(x); if (st == null) { st = new Statistics(data); this.map.put(x, st); } else { st.add(data); } this.last = x; } }
/** * @see stream.statistics.History#add(java.lang.Long, java.lang.Object) */ @Override public void add(Long timestamp, Statistics data) { Long x = adjust(timestamp); Statistics st = get(x); if (st == null) { st = new Statistics(data); this.map.put(x, st); } else { st.add(data); } this.last = x; } }
protected Statistics update(Statistics st, Double value) { Double min = st.get("minimum"); if (min == null) min = value; else min = Math.min(min, value); st.put("minimum", min); Double max = st.get("maximum"); if (max == null) max = value; else max = Math.max(max, value); st.put("maximum", max); st.add("sum", value); st.add("count", 1.0d); st.put("average", st.get("sum") / st.get("count")); return st; }
protected Statistics update(Statistics st, Double value) { Double min = st.get("minimum"); if (min == null) min = value; else min = Math.min(min, value); st.put("minimum", min); Double max = st.get("maximum"); if (max == null) max = value; else max = Math.max(max, value); st.put("maximum", max); st.add("sum", value); st.add("count", 1.0d); st.put("average", st.get("sum") / st.get("count")); return st; }
protected Statistics update(Statistics st, Double value) { Double min = st.get("minimum"); if (min == null) min = value; else min = Math.min(min, value); st.put("minimum", min); Double max = st.get("maximum"); if (max == null) max = value; else max = Math.max(max, value); st.put("maximum", max); st.add("sum", value); st.add("count", 1.0d); st.put("average", st.get("sum") / st.get("count")); return st; }
/** * @see stream.statistics.Sum#updateStatistics(stream.Data) */ @Override public void updateStatistics(Data item) { if (keys == null) return; count += 1.0d; for (String key : keys) { Double val = null; try { val = new Double(item.get(key) + ""); } catch (Exception e) { val = null; } if (val != null) { statistics.add(key, val); if (prefix != null) item.put(prefix + key, statistics.get(key) / count); else item.put(key, statistics.get(key) / count); } } }
/** * @see stream.statistics.Sum#updateStatistics(stream.Data) */ @Override public void updateStatistics(Data item) { if (keys == null) return; count += 1.0d; for (String key : keys) { Double val = null; try { val = new Double(item.get(key) + ""); } catch (Exception e) { val = null; } if (val != null) { statistics.add(key, val); if (prefix != null) item.put(prefix + key, statistics.get(key) / count); else item.put(key, statistics.get(key) / count); } } }
/** * @see stream.statistics.StatisticsLearner#updateStatistics(stream.Data) */ @Override public void updateStatistics(Data item) { if (keys == null) return; for (String key : keys) { Double val = null; try { val = new Double(item.get(key) + ""); } catch (Exception e) { val = null; } if (val != null) { statistics.add(key, val); if (prefix != null) item.put(prefix + key, statistics.get(key)); else item.put(key, statistics.get(key)); } } } }
/** * @see stream.statistics.StatisticsLearner#updateStatistics(stream.Data) */ @Override public void updateStatistics(Data item) { if (keys == null) return; for (String key : keys) { Double val = null; try { val = new Double(item.get(key) + ""); } catch (Exception e) { val = null; } if (val != null) { statistics.add(key, val); if (prefix != null) item.put(prefix + key, statistics.get(key)); else item.put(key, statistics.get(key)); } } } }
/** * @see stream.statistics.Sum#updateStatistics(stream.Data) */ @Override public void updateStatistics(Data item) { if (keys == null) return; count += 1.0d; for (String key : keys) { Double val = null; try { val = new Double(item.get(key) + ""); } catch (Exception e) { val = null; } if (val != null) { statistics.add(key, val); if (prefix != null) item.put(prefix + key, statistics.get(key) / count); else item.put(key, statistics.get(key) / count); } } }
/** * @see stream.statistics.StatisticsLearner#updateStatistics(stream.Data) */ @Override public void updateStatistics(Data item) { if (keys == null) return; for (String key : keys) { Double val = null; try { val = new Double(item.get(key) + ""); } catch (Exception e) { val = null; } if (val != null) { statistics.add(key, val); if (prefix != null) item.put(prefix + key, statistics.get(key)); else item.put(key, statistics.get(key)); } } } }