public synchronized void substract(Map<String, Double> st) { for (String key : st.keySet()) { Double d = get(key); if (d == null) d = -st.get(key); else d -= st.get(key); put(key, d); } }
public synchronized void substract(Map<String, Double> st) { for (String key : st.keySet()) { Double d = get(key); if (d == null) d = -st.get(key); else d -= st.get(key); put(key, d); } }
/** * Adds the given statistics vector to this instance. * * @param st */ public synchronized void add(Map<String, Double> st) { for (String key : st.keySet()) { Double d = get(key); if (d == null) d = st.get(key); else d += st.get(key); put(key, d); } }
/** * Adds the given statistics vector to this instance. * * @param st */ public synchronized void add(Map<String, Double> st) { for (String key : st.keySet()) { Double d = get(key); if (d == null) d = st.get(key); else d += st.get(key); put(key, d); } }
public synchronized void max(Map<String, Double> st) { List<String> keys = new LinkedList<String>(this.keySet()); for (String k : st.keySet()) if (!keys.contains(k)) keys.add(k); for (String key : keys) this.put(key, max(get(key), st.get(key))); }
public synchronized void max(Map<String, Double> st) { List<String> keys = new LinkedList<String>(this.keySet()); for (String k : st.keySet()) if (!keys.contains(k)) keys.add(k); for (String key : keys) this.put(key, max(get(key), st.get(key))); }
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.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.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); } } }
public Statistics divideBy(Double val) { Statistics st = new Statistics(); for (String k : keySet()) st.put(k, get(k) / val); return st; }
public void add(String key, Double val) { if (this.containsKey(key)) { Double d = get(key) + val; put(key, d); } else put(key, val); } }
public Statistics divideBy(Double val) { Statistics st = new Statistics(); for (String k : keySet()) st.put(k, get(k) / val); return st; }
public void add(String key, Double val) { if (this.containsKey(key)) { Double d = get(key) + val; put(key, d); } else put(key, val); } }