/** * Gets this mutable as an instance of Double. * * @return a Double instance containing the value from this mutable, never null */ public Double toDouble() { return new Double(doubleValue()); }
/** * Sets the value from any Number instance. * * @param value the value to set, not null * @throws NullPointerException if the object is null * @throws ClassCastException if the type is not a {@link Number} */ public void setValue(Object value) { setValue(((Number) value).doubleValue()); }
val = new MutableDouble(e.getValue().doubleValue()); basemap.put(cloneKey(e.getKey()), val); continue; double change = e.getValue().doubleValue() - val.doubleValue(); double percent = (change / val.doubleValue()) * 100; if (percent < 0.0) { percent = 0.0 - percent; alert.emit(otuple); val.setValue(e.getValue().doubleValue());
/** * Used to accumulate store metrics across multiple regions in a region * server. These metrics are not "persistent", i.e. we keep overriding them * on every update instead of incrementing, so we need to accumulate them in * a temporary map before pushing them to the global metric collection. * @param tmpMap a temporary map for accumulating store metrics * @param storeMetricType the store metric type to increment * @param val the value to add to the metric */ public void accumulateStoreMetric(final Map<String, MutableDouble> tmpMap, StoreMetricType storeMetricType, double val) { final String key = getStoreMetricName(storeMetricType); if (tmpMap.get(key) == null) { tmpMap.put(key, new MutableDouble(val)); } else { tmpMap.get(key).add(val); } if (this == ALL_SCHEMA_METRICS) { // also compute the max value across all Stores on this server final String maxKey = getStoreMetricNameMax(storeMetricType); MutableDouble cur = tmpMap.get(maxKey); if (cur == null) { tmpMap.put(maxKey, new MutableDouble(val)); } else if (cur.doubleValue() < val) { cur.setValue(val); } } else { ALL_SCHEMA_METRICS.accumulateStoreMetric(tmpMap, storeMetricType, val); } }
K key = e.getKey(); MutableDouble val = e.getValue(); tuples.put(key, getValue(val.doubleValue())); dtuples.put(key, val.doubleValue()); ituples.put(key, val.intValue()); ftuples.put(key, val.floatValue()); ltuples.put(key, val.longValue()); stuples.put(key, val.shortValue());
@Override public void endWindow() { for (AverageAlertData data : alerts) { try { avgAlertOutputPort.emit(JsonUtils.toJson(data)); } catch (IOException e) { logger.warn("Exception while converting object to JSON", e); } } alerts.clear(); for (Map.Entry<MerchantKey, MutableDouble> entry : currentSMAMap.entrySet()) { MerchantKey key = entry.getKey(); MutableDouble currentSma = entry.getValue(); MutableDouble lastSma = lastSMAMap.get(key); if (lastSma == null) { lastSma = new MutableDouble(currentSma.doubleValue()); lastSMAMap.put(key, lastSma); } else { lastSma.setValue(currentSma.getValue()); } } }
@Override public void process(String timeBucket, String key, String field, Number value) { String finalKey = timeBucket + "|" + key; Map<String, Number> m = dataMap.get(finalKey); if (value == null) { return; } if (m == null) { m = new HashMap<String, Number>(); m.put(field, new MutableDouble(value)); dataMap.put(finalKey, m); } else { Number n = m.get(field); if (n == null) { m.put(field, new MutableDouble(value)); } else { ((MutableDouble)n).add(value); } } }
MutableDouble nval = numerators.get(key); if (nval == null) { nval = new MutableDouble(0.0); } else { val = (1 - nval.doubleValue() / e.getValue().doubleValue()) * 100; } else { val = 1 - nval.doubleValue() / e.getValue().doubleValue();
@Override public void process(KeyValPair<MerchantKey, Double> tuple) { MutableDouble currentSma = currentSMAMap.get(tuple.getKey()); if (currentSma == null) { // first sma for the given key double sma = tuple.getValue(); currentSMAMap.put(tuple.getKey(), new MutableDouble(sma)); //lastSMAMap.put(tuple.getKey(), new MutableDouble(sma)); } else { // move the current SMA value to the last SMA Map //lastSMAMap.get(tuple.getKey()).setValue(currentSma.getValue()); currentSma.setValue(tuple.getValue()); // update the current SMA value } }
public void endWindow() { Map<String, Object> summary = new HashMap<String, Object>(); double avg; if (txnsInLastSecond.longValue() == 0) { avg = 0; } else { avg = amtInLastSecond.doubleValue() / txnsInLastSecond.longValue(); } summary.put("totalTxns", totalTxns); summary.put("txnsInLastSecond", txnsInLastSecond); summary.put("amtInLastSecond", amtFormatter.format(amtInLastSecond)); summary.put("avgAmtInLastSecond", amtFormatter.format(avg)); summaryTxnOutputPort.emit(summary); txnsInLastSecond.setValue(0); amtInLastSecond.setValue(0); }
resetDisplayed = false; MutableDouble duration = new MutableDouble(0d); List<SqlStatementData> sqlList = new ArrayList<>(); InvocationSequenceDataHelper.collectSqlsInInvocations(invocations, sqlList, duration); totalInvocationsDuration += inv.getDuration(); double percentage = (duration.toDouble() / totalInvocationsDuration) * 100; int slowest80 = getSlowestSqlCount(duration.toDouble(), sqlList, 0.8d, slowest80List); int slowest20 = sqlList.size() - slowest80; slowest20List = CollectionUtils.subtract(sqlList, slowest80List); totalDuration.setText("<form><p><b>" + TOTAL_DURATION + "</b> " + NumberFormatter.formatDouble(duration.doubleValue()) + " ms</p></form>", true, false);
currentDimensionKeyValPair.getKey().add(0 - tupleValue.get(dimensionKeyVal).doubleValue()); currentDimensionKeyValPair.setValue(currentDimensionKeyValPair.getValue() - 1); if (currentDimensionKeyValPair.getKey().doubleValue() == 0.0) { currentPatternMap.remove(builder.toString());
if (val == null) { if (countkey) { val = new MutableDouble(1.00); } else { val = new MutableDouble(value.doubleValue()); val.increment(); } else { val.add(value.doubleValue());
mergedVC.getAlleles().forEach(a -> genotypeLogLikelihoods.set(a, new MutableDouble(0))); genotypeLogLikelihoods.getRef().add(readRefLogLikelihood); Math.pow(10, readAltLogLikelihood) * alleleFractions.getAlt(altAllele) ); genotypeLogLikelihoods.get(altAllele).add(adjustedReadAltLL); mergedVC.getAlleles().stream().forEach(a -> result.set(a,genotypeLogLikelihoods.get(a).toDouble()));
public void add(Number n) { sum.add(n); }
protected Number convertToNumber(Object o) { if (o == null) { return null; } else if (o instanceof MutableDouble || o instanceof MutableLong) { return (Number)o; } else if (o instanceof Double || o instanceof Float) { return new MutableDouble((Number)o); } else if (o instanceof Number) { return new MutableLong((Number)o); } else { return new MutableDouble(o.toString()); } }
matrixPortrayal.setPortrayalForAll(new OvalPortrayal2D() { public void draw(Object object, Graphics2D graphics, DrawInfo2D info) { MutableDouble valueObj = (MutableDouble)object; if ( valueObj.intValue() == 0 ) { paint = new java.awt.Color(1.0F,0.0F,0.0F,0.0F); } else { paint = new java.awt.Color(1.0F,0.0F,0.0F,1.0F); } filled = true; super.draw(object, graphics, info); } });
RegionMetricsStorage.setNumericMetric(e.getKey(), e.getValue().longValue());
val = new MutableDouble(e.getValue().doubleValue()); basemap.put(cloneKey(e.getKey()), val); continue; double change = e.getValue().doubleValue() - val.doubleValue(); double percent = (change / val.doubleValue()) * 100; if (percent < 0.0) { percent = 0.0 - percent; alert.emit(otuple); val.setValue(e.getValue().doubleValue());
K key = e.getKey(); MutableDouble val = e.getValue(); tuples.put(key, getValue(val.doubleValue())); dtuples.put(key, val.doubleValue()); ituples.put(key, val.intValue()); ftuples.put(key, val.floatValue()); ltuples.put(key, val.longValue()); stuples.put(key, val.shortValue());