List of usage examples for java.lang Double MIN_VALUE
double MIN_VALUE
To view the source code for java.lang Double MIN_VALUE.
Click Source Link
From source file:com.example.programming.proximityalerts.ProximityAlertService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Location bestLocation = null; latitude = intent.getDoubleExtra(LATITUDE_INTENT_KEY, Double.MIN_VALUE); longitude = intent.getDoubleExtra(LONGITUDE_INTENT_KEY, Double.MIN_VALUE); radius = intent.getFloatExtra(RADIUS_INTENT_KEY, Float.MIN_VALUE); for (String provider : locationManager.getProviders(false)) { if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return TODO; }// ww w .j a v a 2 s .c om Location location = locationManager.getLastKnownLocation(provider); if (bestLocation == null) { bestLocation = location; } else { if (location.getAccuracy() < bestLocation.getAccuracy()) { bestLocation = location; } } } if (bestLocation != null) { if (getDistance(bestLocation) <= radius) { inProximity = true; } else { inProximity = false; } } locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); return START_STICKY; }
From source file:io.sidecar.notification.NotificationRule.java
public NotificationRule(UUID ruleId, String name, String description, UUID appId, UUID userId, String stream, String key, double min, double max) { this.ruleId = checkNotNull(ruleId); checkArgument(StringUtils.isNotBlank(name) && name.length() <= 100); this.name = name.trim(); checkArgument(StringUtils.isBlank(description) || description.length() <= 140); this.description = (description == null) ? "" : description.trim(); this.appId = checkNotNull(appId); this.userId = checkNotNull(userId); Preconditions.checkArgument(ModelUtils.isValidStreamId(stream)); this.stream = checkNotNull(stream); checkArgument(ModelUtils.isValidReadingKey(key)); this.key = key; this.min = (min == Double.NEGATIVE_INFINITY || min == Double.NaN) ? Double.MIN_VALUE : min; this.max = (max == Double.POSITIVE_INFINITY || max == Double.NaN) ? Double.MAX_VALUE : max; }
From source file:com.basetechnology.s0.agentserver.field.MoneyField.java
public static Field fromJson(SymbolTable symbolTable, JSONObject fieldJson) { String type = fieldJson.optString("type"); if (type == null || !type.equals("money")) return null; String name = fieldJson.has("name") ? fieldJson.optString("name") : null; String label = fieldJson.has("label") ? fieldJson.optString("label") : null; String description = fieldJson.has("description") ? fieldJson.optString("description") : null; double defaultValue = fieldJson.has("default_value") ? fieldJson.optDouble("default_value") : 0; double minValue = fieldJson.has("min_value") ? fieldJson.optDouble("min_value") : Double.MIN_VALUE; double maxValue = fieldJson.has("max_value") ? fieldJson.optDouble("max_value") : Double.MAX_VALUE; int nominalWidth = fieldJson.has("nominal_width") ? fieldJson.optInt("nominal_width") : 0; String compute = fieldJson.has("compute") ? fieldJson.optString("compute") : null; return new MoneyField(symbolTable, name, label, description, defaultValue, minValue, maxValue, nominalWidth, compute);// w ww. j a va2 s. c o m }
From source file:Statistics.java
public void calc() { if (dirty) {// w ww.j a v a2 s . co m double n = (double) data.size(); max = Double.MIN_VALUE; min = Double.MAX_VALUE; sum = 0.0; variation = 0.0; for (double d : data) { sum += d; min = Math.min(d, min); max = Math.max(d, max); } average = sum / n; for (double d : data) { variation += Math.pow(d - average, 2.0); } variance = variation / n; // calculate median List<Double> copy = new ArrayList<Double>(data); Collections.sort(copy); if (copy.size() == 1) { median = copy.get(0); } else if ((copy.size() % 2) == 0) { median = copy.get(copy.size() / 2); } else { double v1 = copy.get(copy.size() / 2); double v2 = copy.get((copy.size() / 2) + 1); median = (v1 + v2) / 2.0; } } dirty = false; }
From source file:org.cloudfoundry.metron.MetronMetricWriterTest.java
@Test public void set() { this.metricWriter.onOpen(this.session, null); this.metricWriter.set(new Metric<>("test-name", Double.MIN_VALUE)); verify(this.async, new ValueMetric.Builder().name("test-name").value(Double.MIN_VALUE).unit("").build()); }
From source file:com.itemanalysis.psychometrics.irt.estimation.ItemParamPriorLogNormal.java
/** * Only compute part of the log of the density that depends on the parameter * @param p Argument of log density function (an item parameter value) * @return//from w ww .j a va 2 s.c om */ public double logDensity(double p) { //Check for value outside limits of distribution if (zeroDensity(p)) { return Double.MIN_VALUE; } double value = Math.log(p) - parameters[0]; value *= value; value /= -2.0 * variance; value -= Math.log(p); return value; }
From source file:com.appsimobile.appsii.SimpleJsonTest.java
public void testPathParsing() throws ResponseParserException { StringBuilder sb = new StringBuilder(); String testData = AssetUtils.readAssetToString(getContext().getAssets(), "parser_test_data/parser_json_object_test_restaurant.json", sb); JSONObject jsonObject;//w w w . j ava2s .c o m try { jsonObject = new JSONObject(testData); } catch (JSONException e) { AssertionError error = new AssertionError("Unexpected error"); error.initCause(e); throw error; } final SimpleJson simpleJson = new SimpleJson(jsonObject); SimpleJson test = simpleJson.childForPath("id"); assertEquals(simpleJson, test); SimpleJson location = simpleJson.childForPath("location.lat"); assertNotNull(location); assertNotSame(simpleJson, location); SimpleJson test2 = simpleJson.childForPath("location.long"); assertTrue(location == test2); SimpleJson streetName1 = simpleJson.childForPath("location.streetname.id"); SimpleJson streetName2 = location.childForPath("streetname.id"); assertTrue(streetName1 == streetName2); assertEquals("E-sites cafe", simpleJson.getString("name")); assertEquals("4814", location.getString("zipcode")); assertEquals("4814", simpleJson.getString("location.zipcode")); assertEquals("NL", simpleJson.getString("location.country.code")); assertNull(simpleJson.getString("location.country.codexxx")); try { assertEquals("", simpleJson.getString("xxx_does_not_exist.zipcode")); assertTrue(false); } catch (ResponseParserException ignore) { // expected to get here } double latitude = simpleJson.getDouble("location.lat", Double.MIN_VALUE); assertEquals(51.5906127, latitude); double longitude = simpleJson.getDouble("location.long", Double.MIN_VALUE); assertEquals(4.7622492, longitude); }
From source file:org.pentaho.plugin.jfreereport.reportcharts.BubbleChartExpression.java
private double precomputeMaxZ(final XYZDataset dataset) { double retval = Double.MIN_VALUE; for (int series = 0; series < dataset.getSeriesCount(); series++) { final int itemcount = dataset.getItemCount(series); for (int item = 0; item < itemcount; item++) { final double value = dataset.getZValue(series, item); if (retval < value) { retval = value;/*from ww w . j a v a2 s .c om*/ } } } return retval; }
From source file:org.clueminer.clustering.algorithm.DBSCANParamEstim.java
private int findKnee(Double[] kdist) { int maxX = maxX(kdist); slope = slope(kdist, maxX);//w ww. ja va2 s .c o m double dist; double max = Double.MIN_VALUE; int maxIdx = 0; for (int i = 1; i < maxX; i++) { dist = localMin(kdist, i, i + localNeighborhood, slope); if (dist > max) { max = dist; maxIdx = i; } //System.out.println(i + " => " + kx + ", max = " + max); } System.out.println("max = " + max + ", at " + maxIdx); return maxIdx; }
From source file:com.jennifer.ui.chart.brush.ColumnBrush.java
@Override public Object draw() { Transform[] t = new Transform[target.length()]; double[] maxValue = new double[target.length()]; for (int i = 0; i < maxValue.length; i++) { maxValue[i] = Double.MIN_VALUE; }// w w w . ja va2s . c o m for (int i = 0; i < count; i++) { double startX = x.get(i) - half_width / 2; Transform group = root.group(); for (int j = 0, len = target.length(); j < len; j++) { double valueValue = chart.dataDouble(i, target.getString(j)); double startY = y.get(((minCheck && valueValue == 0) ? 1 : valueValue)); double h = Math.abs(zeroY - startY); String _color = this.color(j); JSONObject o = new JSONObject().put("x", startX).put("height", h).put("width", columnWidth) .put("fill", _color); if (startY <= zeroY) { o.put("y", startY); } else { o.put("y", zeroY); } group.rect(o); // display max value if (valueValue > maxValue[j]) { maxValue[j] = valueValue; t[j] = createMaxElement(startX + half_width / 2, startY, formatNumber(valueValue), _color); } startX = startX + (columnWidth + innerPadding); } } // Max Element for (int i = 0; i < t.length; i++) { root.append(t[i]); } return new JSONObject().put("root", root); }