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:net.openhft.smoothie.MathDecisions.java
static int chooseOptimalCap(int average, int refSize) { double minFootprint = Double.MAX_VALUE; int bestCap = -1; for (int cap = average; cap <= Math.min(average * 2, 63); cap++) { double footprint = footprint(average, refSize, 1, cap); if (footprint < minFootprint) { minFootprint = footprint;/*from ww w. ja v a 2s .c o m*/ bestCap = cap; } } return bestCap; }
From source file:org.pdfsam.ui.module.ProgressPane.java
public ProgressPane() { this.getStyleClass().add("progress-pane"); this.statusLabel.getStyleClass().add("progress-status"); this.failed.setVisible(false); this.open.setVisible(false); this.bar.getStyleClass().add("pdfsam-footer-bar"); StackPane buttons = new StackPane(failed, open); HBox progressStatusBox = new HBox(statusLabel, buttons); progressStatusBox.getStyleClass().add("progress-status-pane"); HBox.setHgrow(statusLabel, Priority.ALWAYS); statusLabel.setMaxWidth(Double.MAX_VALUE); getChildren().addAll(progressStatusBox, bar); eventStudio().addAnnotatedListeners(this); }
From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java
@Override protected BatchUpdateDialog createDialog() { ObservableList<UpdateFileNamesFromTagsItem> items = FXCollections.observableArrayList( this.getOtherFiles().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList())); StringProperty patternFieldProperty = new SimpleStringProperty(); List<String> patternItems = Arrays.asList("${track} ${title}"); ComboBox<String> patternBox = new ComboBox<>(FXCollections.observableArrayList(patternItems)); patternBox.setEditable(true);//from w w w . java 2 s . c o m patternBox.setMaxWidth(Double.MAX_VALUE); Bindings.bindBidirectional(patternFieldProperty, patternBox.editorProperty().get().textProperty()); HBox.setHgrow(patternBox, Priority.ALWAYS); Button executeButton = new Button(this.getLocalization().executeRename(), new ImageView(new Image(UpdateFileNamesFromTagsActionEventHandler.class.getClassLoader() .getResourceAsStream("icons/16/save.png")))); executeButton.setDisable(true); patternFieldProperty .addListener((o, oldValue, newValue) -> executeButton.setDisable(newValue.length() <= 0)); HBox patternFieldPane = new HBox(10, patternBox, executeButton); patternFieldPane.setPadding(new Insets(5, 5, 5, 5)); TitledPane patternFieldTitlePane = new TitledPane(this.getLocalization().fileNamePattern(), patternFieldPane); patternFieldTitlePane.setCollapsible(false); TableView<?> newFileNamesPane = this.createNewFileNamesPane(items); newFileNamesPane.setPrefHeight(400); VBox.setVgrow(newFileNamesPane, Priority.ALWAYS); VBox actionPane = new VBox(10, patternFieldTitlePane, newFileNamesPane); // Create the dialog and finish BatchUpdateDialog dialog = new BatchUpdateDialog(); dialog.setDialogPrefWidth(800); dialog.setDialogTitle(this.getLocalization().updateFileNames()); dialog.setActionPane(actionPane); dialog.setLegendPane(this.createLegendPane()); // Add listeners this.getOtherFiles().addListener( new WeakListChangeListener<>((Change<? extends TaggableFile> change) -> items.setAll(change .getList().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList())))); patternFieldProperty.addListener((o, oldValue, newValue) -> this.computeNewFileNames(items, newValue)); executeButton.setOnAction(event -> { this.updateNewFileNames(items); ((Stage) executeButton.getScene().getWindow()).close(); }); return dialog; }
From source file:juicebox.tools.utils.common.MatrixTools.java
/** * @return minimal positive entry in the matrix greater than 0 *//*from w ww.j av a 2 s .co m*/ private static double minimumPositive(double[][] data) { double minVal = Double.MAX_VALUE; for (double[] row : data) { for (double val : row) { if (val > 0 && val < minVal) minVal = val; } } if (minVal == Double.MAX_VALUE) minVal = 0; return minVal; }
From source file:com.opengamma.web.server.conversion.LocalVolatilitySurfaceMoneynessConverter.java
@Override public Object convertForDisplay(ResultConverterCache context, ValueSpecification valueSpec, LocalVolatilitySurfaceMoneyness value, ConversionMode mode) { Map<String, Object> result = new HashMap<String, Object>(); if (value.getSurface() instanceof InterpolatedDoublesSurface) { InterpolatedDoublesSurface interpolated = (InterpolatedDoublesSurface) value.getSurface(); result.put("xCount", interpolated.getXData().length); result.put("yCount", interpolated.getYData().length); if (mode == ConversionMode.FULL) { Double[] xs = interpolated.getXData(); Double[] ys = interpolated.getYData(); List<Double> uniqueX = new ArrayList<Double>(); List<Double> uniqueY = new ArrayList<Double>(); for (Double x : xs) { if (!uniqueX.contains(x)) { uniqueX.add(x);//from w ww . jav a2 s . c om } } for (Double y : ys) { if (!uniqueY.contains(y)) { uniqueY.add(y); } } Collections.sort(uniqueX); Collections.sort(uniqueY); Object[] xLabels = new Object[uniqueX.size()]; Object[] yLabels = new Object[uniqueY.size()]; double[][] surface = new double[xs.length][ys.length]; boolean[][] missingValues = new boolean[xs.length][ys.length]; for (int i = 0; i < uniqueX.size(); i++) { xLabels[i] = uniqueX.get(i).toString(); for (int j = 0; j < uniqueY.size(); j++) { if (i == 0) { yLabels[j] = uniqueY.get(j).toString(); } try { surface[i][j] = interpolated.getZValue(uniqueX.get(i), uniqueY.get(i)); } catch (MathException e) { surface[i][j] = Double.MAX_VALUE; missingValues[i][j] = true; } } } result.put("xs", uniqueX.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); result.put("ys", uniqueY.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); result.put("surface", surface); result.put("missingValues", missingValues); } } else if (value.getSurface() instanceof FunctionalDoublesSurface) { FunctionalDoublesSurface functional = (FunctionalDoublesSurface) value.getSurface(); final double[] expiries = { 0.1, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 2.5, 3., 4., 5. }; final int nX = expiries.length; result.put("xCount", nX); result.put("yCount", 21); if (mode == ConversionMode.FULL) { String[] xLabels = new String[nX]; String[] yLabels = new String[21]; double[][] surface = new double[21][nX]; boolean[][] missingValues = new boolean[21][nX]; for (int i = 0; i < nX; i++) { double x = expiries[i]; xLabels[i] = LABEL_FORMAT.format(x); double y = .45; // Moneyness from 0.5 to 2.0 for (int j = 0; j < 21; j++) { y += 0.05; if (i == 0) { yLabels[j] = LABEL_FORMAT.format(y); } surface[j][i] = 100 * functional.getZValue(x, y); } } result.put("xs", xLabels); result.put("ys", yLabels); result.put("surface", surface); result.put("missingValues", missingValues); } } return result; }
From source file:com.redhat.lightblue.metadata.types.DoubleTypeTest.java
@Test public void testCastDouble() { assertTrue(doubleType.cast(Double.MAX_VALUE) instanceof Double); }
From source file:com.canoo.dolphin.todo.client.ToDoClient.java
private void showError(String header, String content, Exception e) { e.printStackTrace();/* www.j a va 2 s . c om*/ Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText(header); alert.setContentText(content); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); String exceptionText = sw.toString(); Label label = new Label("The exception stacktrace was:"); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); System.exit(-1); }
From source file:Statistics.java
public static double minimum(double... vals) { double ret = Double.MAX_VALUE; for (double d : vals) { ret = Math.min(ret, d);/*from www.j a v a 2s. c o m*/ } return ret; }
From source file:classif.random.DTWKNNClassifierRandom.java
@Override public double evalErrorRate(ClassedSequence[] testSequences) { if (distances == null) { initDistances(testSequences);/*from w w w . j a v a 2 s . c o m*/ } int nbCorrectlyClassified = 0; for (int s = 0; s < testSequences.length; s++) { double minD = Double.MAX_VALUE; String classValue = null; for (int p = 0; p < prototypes.size(); p++) { int indexProtoInTrainData = indexPrototypeInTrainData.get(p); // double tmpD = testSequences[s].sequence.distance(prototypes.get(p).sequence); double tmpD = distances[s][indexProtoInTrainData]; if (tmpD < minD) { minD = tmpD; classValue = prototypes.get(p).classValue; } } if (classValue.equals(testSequences[s].classValue)) { nbCorrectlyClassified++; } } return 1.0 - 1.0 * nbCorrectlyClassified / (testSequences.length); }
From source file:com.redhat.lightblue.metadata.types.BigDecimalTypeTest.java
@Test public void testCastDouble() { assertTrue(bigDecimalType.cast(Double.MAX_VALUE) instanceof BigDecimal); }