List of usage examples for java.lang Double MAX_VALUE
double MAX_VALUE
To view the source code for java.lang Double MAX_VALUE.
Click Source Link
From source file:com.aestel.chemistry.openEye.fp.apps.SDFFPNNFinder.java
/** compare compounds in inFile to eachother */ private static void perfromMatrixNNSearch(String inFile, String outFile, String tabOutput, SimComparatorFactory<OEMolBase, FPComparator, FPComparator> compFact, double minSim, int maxNeighbors, String idTag, int nCpu, String countAboveSimilarityStr, boolean printAll) throws IOException { double countAboveSimilarity = Double.MAX_VALUE; if (countAboveSimilarityStr != null) countAboveSimilarity = Double.parseDouble(countAboveSimilarityStr); MultiThreadMatrixAlgortihm alg;//from w w w . j ava2 s . c o m if (maxNeighbors > 1 || minSim > 0) { MultiNNMatrixFinderConsumerInterface c; if ("vTab".equalsIgnoreCase(tabOutput)) c = new MultiNNMatrixFinderVTConsumer(outFile); else if ("tab".equalsIgnoreCase(tabOutput)) c = new MultiNNMatrixFinderTabConsumer(outFile, idTag); else c = new MultiNNMatrixFinderConsumer(outFile, countAboveSimilarityStr); alg = new MultiNNMatrixFinder<FPComparator, FPComparator>(inFile, c, compFact, maxNeighbors, minSim, printAll, countAboveSimilarity); if ("tab".equalsIgnoreCase(tabOutput)) ((MultiNNMatrixFinderTabConsumer) c).setMatrixSize(alg.getObjectCount()); } else { NNMatrixFinderConsumerInterface c; if ("vTab".equalsIgnoreCase(tabOutput)) c = new NNMatrixFinderVTConsumer(outFile); else c = new NNMatrixFinderConsumer(outFile, countAboveSimilarityStr); alg = new NNMatrixFinder<FPComparator, FPComparator>(inFile, c, compFact, countAboveSimilarity); } MultiThreadMatrixRunner<FPComparator, FPComparator> runner = new MultiThreadMatrixRunner<FPComparator, FPComparator>( alg, nCpu); runner.run(); runner.close(); }
From source file:org.gvsig.gui.beans.graphic.GraphicChartPanel.java
/** * Recarga los datos de la grafica dependiendo del tipo de visualizacion *//*from w w w .j a va 2s.c om*/ private void reloadGraphic() { dataset.removeAllSeries(); switch (viewType) { case 0: // Normal for (int i = 0; i < series.length; i++) dataset.addSeries(series[i]); break; case 1: // Acumulado XYSeries[] seriesAcum = new XYSeries[series.length]; for (int i = 0; i < series.length; i++) { seriesAcum[i] = new XYSeries(series[i].getKey()); double total = 0; for (int j = 0; j < series[i].getItemCount(); j++) { total += series[i].getY(j).doubleValue(); seriesAcum[i].add(series[i].getX(j), total); } dataset.addSeries(seriesAcum[i]); } break; case 2: // Logaritmico XYSeries[] seriesLog = new XYSeries[series.length]; double minim = Double.MAX_VALUE; for (int i = 0; i < series.length; i++) for (int j = 0; j < series[i].getItemCount(); j++) if (minim > series[i].getY(j).doubleValue()) minim = series[i].getY(j).doubleValue(); for (int i = 0; i < series.length; i++) { seriesLog[i] = new XYSeries(series[i].getKey()); for (int j = 0; j < series[i].getItemCount(); j++) seriesLog[i].add(series[i].getX(j), java.lang.Math.log(series[i].getY(j).doubleValue() - minim + 1.0)); dataset.addSeries(seriesLog[i]); } break; } jPanelChart.repaint(); }
From source file:at.wada811.utils.CameraUtils.java
public static Size getPictureSize(Context context, Camera camera) { final List<Size> sizes = camera.getParameters().getSupportedPictureSizes(); final double ASPECT_TOLERANCE = 0.07; final boolean isPortrait = DisplayUtils.isPortrait(context); final int width = DisplayUtils.getWidth(context); final int height = DisplayUtils.getHeight(context); if (DEBUG) {//w ww. j ava 2 s . c o m LogUtils.v("width: " + width); } if (DEBUG) { LogUtils.v("height: " + height); } final double targetRatio = isPortrait ? (double) height / width : (double) width / height; final int targetHeight = isPortrait ? width : height; Size optimalSize = null; double minDiff = Double.MAX_VALUE; if (DEBUG) { LogUtils.v("targetRatio: " + targetRatio); } for (Size size : sizes) { double pictureRatio = isPortrait ? (double) size.height / size.width : (double) size.width / size.height; pictureRatio = (double) size.width / size.height; if (DEBUG) { LogUtils.v("size.width: " + size.width); } if (DEBUG) { LogUtils.v("size.height: " + size.height); } if (DEBUG) { LogUtils.v("pictureRatio: " + pictureRatio); } if (Math.abs(pictureRatio - targetRatio) > ASPECT_TOLERANCE) { continue; } if (Math.abs(size.height - targetHeight) < minDiff) { optimalSize = size; minDiff = Math.abs(size.height - targetHeight); } } if (optimalSize == null) { minDiff = Double.MAX_VALUE; for (Size size : sizes) { if (Math.abs(size.height - targetHeight) < minDiff) { optimalSize = size; minDiff = Math.abs(size.height - targetHeight); } } } if (DEBUG) { LogUtils.v("optimalSize.width: " + optimalSize.width); } if (DEBUG) { LogUtils.v("optimalSize.height: " + optimalSize.height); } return optimalSize; }
From source file:edu.uci.ics.jung.visualization.picking.ShapePickSupport.java
/** * Iterates over Vertices, checking to see if x,y is contained in the * Vertex's Shape. If (x,y) is contained in more than one vertex, use * the vertex whose center is closest to the pick point. * @see edu.uci.ics.jung.visualization.picking.PickSupport#getVertex(double, double) *//* ww w. ja va2s. com*/ public V getVertex(Layout<V, E> layout, double x, double y) { V closest = null; double minDistance = Double.MAX_VALUE; Point2D ip = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, new Point2D.Double(x, y)); x = ip.getX(); y = ip.getY(); while (true) { try { for (V v : getFilteredVertices(layout)) { Shape shape = vv.getRenderContext().getVertexShapeTransformer().transform(v); // get the vertex location Point2D p = layout.transform(v); if (p == null) continue; // transform the vertex location to screen coords p = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, p); double ox = x - p.getX(); double oy = y - p.getY(); if (shape.contains(ox, oy)) { if (style == Style.LOWEST) { // return the first match return v; } else if (style == Style.HIGHEST) { // will return the last match closest = v; } else { // return the vertex closest to the // center of a vertex shape Rectangle2D bounds = shape.getBounds2D(); double dx = bounds.getCenterX() - ox; double dy = bounds.getCenterY() - oy; double dist = dx * dx + dy * dy; if (dist < minDistance) { minDistance = dist; closest = v; } } } } break; } catch (ConcurrentModificationException cme) { } } return closest; }
From source file:cmsc105_mp2.Plot.java
public void createGraph(Data d, float window, Double threshold) { XYSeries data = new XYSeries("data"); double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; for (double num : d.plots) { if (max < num) max = num;// w ww .java 2s.c o m if (min > num) min = num; } max += 3; min -= 3; ArrayList<XYSeries> xy = new ArrayList(); ArrayList<Integer> points = new ArrayList(); for (int j = (int) (window / 2); j < d.plots.length - (window / 2); j++) { data.add(j, d.plots[j]); System.out.println(points.size()); if (d.plots[j] > threshold) { points.add(j); } else { if (points.size() >= window) { System.out.println("MIN!"); XYSeries series = new XYSeries("trend"); for (int n : points) { series.add(n, max); } xy.add(series); } points = new ArrayList(); } } if (points.size() >= window) { XYSeries series = new XYSeries("trend"); for (int n : points) { series.add(n, max); } xy.add(series); } XYSeriesCollection my_data_series = new XYSeriesCollection(); my_data_series.addSeries(data); for (XYSeries x : xy) { my_data_series.addSeries(x); } XYSeries thresh = new XYSeries("threshold"); for (int j = 0; j < d.plots.length; j++) { thresh.add(j, threshold); } my_data_series.addSeries(thresh); System.out.println(d.name); JFreeChart XYLineChart = ChartFactory.createXYLineChart(d.name, "Position", "Average", my_data_series, PlotOrientation.VERTICAL, true, true, false); bImage1 = (BufferedImage) XYLineChart.createBufferedImage(600, 300); ImageIcon imageIcon = new ImageIcon(bImage1); jLabel1.setIcon(imageIcon); }
From source file:de.perdoctus.ebikeconnect.gui.MainWindowController.java
public void showAbout() throws IOException { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.initOwner(tabPane.getScene().getWindow()); alert.initModality(Modality.WINDOW_MODAL); alert.setWidth(640);/*from ww w . j a v a 2 s.c o m*/ alert.setTitle(rb.getString("application-name")); alert.setHeaderText(rb.getString("application-name") + " Version " + rb.getString("app-version")); final String aboutInfo = IOUtils.toString(getClass().getResourceAsStream("/about-info.txt"), "UTF-8"); alert.setContentText(aboutInfo); final String licenseInfo = IOUtils.toString(getClass().getResourceAsStream("/license-info.txt"), "UTF-8"); final Label label = new Label(rb.getString("licenses")); final TextArea licenses = new TextArea(licenseInfo); licenses.setMaxWidth(Double.MAX_VALUE); licenses.setEditable(false); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(licenses, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.show(); }
From source file:com.redhat.lightblue.crud.ldap.translator.ResultTranslatorTest.java
@Test public void testTranslate_SimpleField_DoubleType() throws JSONException { SearchResultEntry result = new SearchResultEntry(-1, "uid=john.doe,dc=example,dc=com", new Attribute[] { new Attribute("key", String.valueOf(Double.MAX_VALUE)) }); EntityMetadata md = fakeEntityMetadata("fakeMetadata", new SimpleField("key", DoubleType.TYPE)); DocCtx document = new ResultTranslator(factory, md, new TrivialLdapFieldNameTranslator()).translate(result); assertNotNull(document);/* w ww.j ava2 s . c o m*/ JSONAssert.assertEquals( "{\"key\":" + String.valueOf(Double.MAX_VALUE) + ",\"dn\":\"uid=john.doe,dc=example,dc=com\"}", document.getOutputDocument().toString(), true); }
From source file:com.l2jfree.gameserver.util.Util.java
public final static double calculateDistance(L2Object obj1, L2Object obj2, boolean includeZAxis) { if (obj1 == null || obj2 == null) return Double.MAX_VALUE; final ObjectPosition pos1 = obj1.getPosition(); final ObjectPosition pos2 = obj2.getPosition(); return calculateDistance(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ(), includeZAxis);/*ww w. ja v a2 s . co m*/ }
From source file:javalibs.CSVDataNormalizer.java
private Pair getMaxMinFromCol(String columnName) { double max = Double.MIN_VALUE; double min = Double.MAX_VALUE; for (CSVRecord record : this.allRecords) { double val = NumUtils.getDoubleFromStr(record.get(columnName)); // NOTE: Floating point errors aren't really that important here, don't waste time on // a proper floating point comparison if (val > max) max = val; if (val < min) min = val; }//from w w w . j ava 2s. c o m return new Pair(max, min); }
From source file:com.yoncabt.ebr.executor.BaseReport.java
public ReportDefinition loadDefinition(File reportFile, File jsonFile) throws AssertionError, IOException, JSONException { ReportDefinition ret = new ReportDefinition(reportFile); if (!jsonFile.exists()) { ret.setCaption(jsonFile.getName().replace(".ebr.json", "")); return ret; }/*from w w w . ja va 2s .c o m*/ String jsonComment = FileUtils.readFileToString(jsonFile, "utf-8"); JSONObject jsonObject = new JSONObject(jsonComment); ret.setCaption(jsonObject.optString("title", "NOT ITTLE")); ret.setDataSource(jsonObject.optString("datasource", "default")); ret.setTextEncoding(jsonObject.optString("text-encoding", "utf-8")); ret.setTextTemplate(jsonObject.optString("text-template", "SUITABLE")); if (jsonObject.has("fields")) { JSONArray fieldsArray = jsonObject.getJSONArray("fields"); for (int i = 0; i < fieldsArray.length(); i++) { JSONObject field = fieldsArray.getJSONObject(i); FieldType fieldType = FieldType.valueOfJSONName(field.getString("type")); switch (fieldType) { case DATE: { ReportParam<Date> rp = new ReportParam<>(Date.class); readCommon(ret, rp, field); if (field.has("default-value")) { rp.setDefaultValue(new Date(field.getLong("default-value"))); } break; } case STRING: { ReportParam<String> rp = new ReportParam<>(String.class); readCommon(ret, rp, field); if (field.has("default-value")) { rp.setDefaultValue(field.getString("default-value")); } break; } case INTEGER: { ReportParam<Integer> rp = new ReportParam<>(Integer.class); readCommon(ret, rp, field); int min = field.has("min") ? field.getInt("min") : Integer.MIN_VALUE; int max = field.has("max") ? field.getInt("max") : Integer.MAX_VALUE; rp.setMax(max); rp.setMin(min); if (field.has("default-value")) { rp.setDefaultValue(field.getInt("default-value")); } break; } case LONG: { ReportParam<Long> rp = new ReportParam<>(Long.class); readCommon(ret, rp, field); long min = field.has("min") ? field.getLong("min") : Long.MIN_VALUE; long max = field.has("max") ? field.getLong("max") : Long.MAX_VALUE; rp.setMax(max); rp.setMin(min); if (field.has("default-value")) { rp.setDefaultValue(field.getLong("default-value")); } break; } case DOUBLE: { ReportParam<Double> rp = new ReportParam<>(Double.class); readCommon(ret, rp, field); double min = field.has("min") ? field.getLong("min") : Double.MIN_VALUE; double max = field.has("max") ? field.getLong("max") : Double.MAX_VALUE; rp.setMax(max); rp.setMin(min); if (field.has("default-value")) { rp.setDefaultValue(field.getDouble("default-value")); } break; } default: { throw new AssertionError(fieldType); } } } } return ret; }