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:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);/*from w ww .j a v a 2 s .com*/ gridpane.setVgap(10); ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE); ColumnConstraints column2 = new ColumnConstraints(50); ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE); column1.setHgrow(Priority.ALWAYS); column3.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2, column3); Label candidatesLbl = new Label("Candidates"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); Label selectedLbl = new Label("selected"); gridpane.add(selectedLbl, 2, 0); GridPane.setHalignment(selectedLbl, HPos.CENTER); // Candidates final ObservableList<String> candidates = FXCollections.observableArrayList("Z", "A", "B", "C", "D"); final ListView<String> candidatesListView = new ListView<>(candidates); gridpane.add(candidatesListView, 0, 1); final ObservableList<String> selected = FXCollections.observableArrayList(); final ListView<String> heroListView = new ListView<>(selected); gridpane.add(heroListView, 2, 1); Button sendRightButton = new Button(" > "); sendRightButton.setOnAction((ActionEvent event) -> { String potential = candidatesListView.getSelectionModel().getSelectedItem(); if (potential != null) { candidatesListView.getSelectionModel().clearSelection(); candidates.remove(potential); selected.add(potential); } }); Button sendLeftButton = new Button(" < "); sendLeftButton.setOnAction((ActionEvent event) -> { String s = heroListView.getSelectionModel().getSelectedItem(); if (s != null) { heroListView.getSelectionModel().clearSelection(); selected.remove(s); candidates.add(s); } }); VBox vbox = new VBox(5); vbox.getChildren().addAll(sendRightButton, sendLeftButton); gridpane.add(vbox, 1, 1); root.setCenter(gridpane); GridPane.setVgrow(root, Priority.ALWAYS); primaryStage.setScene(scene); primaryStage.show(); }
From source file:gda.device.scannable.DummyScannable.java
public DummyScannable() { this.setInputNames(new String[] { "" }); try {//from w w w. ja v a 2s . com this.setLowerGdaLimits(-Double.MAX_VALUE); this.setUpperGdaLimits(Double.MAX_VALUE); } catch (Exception e) { } }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);// w w w .j ava 2 s. co m gridpane.setVgap(10); ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE); ColumnConstraints column2 = new ColumnConstraints(50); ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE); column1.setHgrow(Priority.ALWAYS); column3.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2, column3); // Candidates label Label candidatesLbl = new Label("Candidates"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); // Heroes label Label heroesLbl = new Label("Letters"); gridpane.add(heroesLbl, 2, 0); GridPane.setHalignment(heroesLbl, HPos.CENTER); final ObservableList<String> candidates = FXCollections.observableArrayList("A", "B", "C", "D"); final ListView<String> candidatesListView = new ListView<>(candidates); gridpane.add(candidatesListView, 0, 1); final ObservableList<String> heroes = FXCollections.observableArrayList(); final ListView<String> heroListView = new ListView<>(heroes); gridpane.add(heroListView, 2, 1); Button sendRightButton = new Button(" > "); sendRightButton.setOnAction((ActionEvent event) -> { String potential = candidatesListView.getSelectionModel().getSelectedItem(); if (potential != null) { candidatesListView.getSelectionModel().clearSelection(); candidates.remove(potential); heroes.add(potential); } }); Button sendLeftButton = new Button(" < "); sendLeftButton.setOnAction((ActionEvent event) -> { String notHero = heroListView.getSelectionModel().getSelectedItem(); if (notHero != null) { heroListView.getSelectionModel().clearSelection(); heroes.remove(notHero); candidates.add(notHero); } }); // place the buttons VBox vbox = new VBox(5); vbox.setAlignment(Pos.CENTER); vbox.getChildren().addAll(sendRightButton, sendLeftButton); GridPane.setHalignment(vbox, HPos.CENTER); gridpane.add(vbox, 1, 1); // place the grid root.setCenter(gridpane); GridPane.setVgrow(root, Priority.ALWAYS); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
/** * Iterate over supported camera video sizes to see which one best fits the * dimensions of the given view while maintaining the aspect ratio. If none can, * be lenient with the aspect ratio.//from ww w.jav a2s. c o m * * @param supportedVideoSizes Supported camera video sizes. * @param previewSizes Supported camera preview sizes. * @param w The width of the view. * @param h The height of the view. * @return Best match camera video size to fit in the view. */ public static Camera.Size getOptimalVideoSize(List<Camera.Size> supportedVideoSizes, List<Camera.Size> previewSizes, int w, int h) { // Use a very small tolerance because we want an exact match. final double ASPECT_TOLERANCE = 0.1; double targetRatio = (double) w / h; // Supported video sizes list might be null, it means that we are allowed to use the preview // sizes List<Camera.Size> videoSizes; if (supportedVideoSizes != null) { videoSizes = supportedVideoSizes; } else { videoSizes = previewSizes; } Camera.Size optimalSize = null; // Start with max value and refine as we iterate over available video sizes. This is the // minimum difference between view and camera height. double minDiff = Double.MAX_VALUE; // Target view height int targetHeight = h; // Try to find a video size that matches aspect ratio and the target view size. // Iterate over all available sizes and pick the largest size that can fit in the view and // still maintain the aspect ratio. for (Camera.Size size : videoSizes) { double ratio = (double) size.width / size.height; if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE) continue; if (Math.abs(size.height - targetHeight) < minDiff && previewSizes.contains(size)) { optimalSize = size; minDiff = Math.abs(size.height - targetHeight); } } // Cannot find video size that matches the aspect ratio, ignore the requirement if (optimalSize == null) { minDiff = Double.MAX_VALUE; for (Camera.Size size : videoSizes) { if (Math.abs(size.height - targetHeight) < minDiff && previewSizes.contains(size)) { optimalSize = size; minDiff = Math.abs(size.height - targetHeight); } } } return optimalSize; }
From source file:Main.java
/** * Iterate over supported camera video sizes to see which one best fits the * dimensions of the given view while maintaining the aspect ratio. If none can, * be lenient with the aspect ratio./* w w w . j a v a 2 s . com*/ * * @param supportedVideoSizes Supported camera video sizes. * @param previewSizes Supported camera preview sizes. * @param w The width of the view. * @param h The height of the view. * @return Best match camera video size to fit in the view. */ public static Camera.Size getOptimalVideoSize(List<Camera.Size> supportedVideoSizes, List<Camera.Size> previewSizes, int w, int h) { // Use a very small tolerance because we want an exact match. final double ASPECT_TOLERANCE = 0.1; double targetRatio = (double) w / h; // Supported video sizes list might be null, it means that we are allowed to use the preview // sizes List<Camera.Size> videoSizes; if (supportedVideoSizes != null) { videoSizes = supportedVideoSizes; } else { videoSizes = previewSizes; } Camera.Size optimalSize = null; // Start with max value and refine as we iterate over available video sizes. This is the // minimum difference between view and camera height. double minDiff = Double.MAX_VALUE; // Target view height int targetHeight = h; // Try to find a video size that matches aspect ratio and the target view size. // Iterate over all available sizes and pick the largest size that can fit in the view and // still maintain the aspect ratio. for (Camera.Size size : videoSizes) { double ratio = (double) size.height / size.width; if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE) continue; if (Math.abs(size.height - targetHeight) < minDiff && previewSizes.contains(size)) { optimalSize = size; minDiff = Math.abs(size.height - targetHeight); } } // Cannot find video size that matches the aspect ratio, ignore the requirement if (optimalSize == null) { minDiff = Double.MAX_VALUE; for (Camera.Size size : videoSizes) { if (Math.abs(size.height - targetHeight) < minDiff && previewSizes.contains(size)) { optimalSize = size; minDiff = Math.abs(size.height - targetHeight); } } } return optimalSize; }
From source file:lirmm.inria.fr.math.OpenLongToDoubleHashMapTest.java
@Before public void setUp() throws Exception { javaMap.put(Long.valueOf(50), 100.0); javaMap.put(Long.valueOf(75), 75.0); javaMap.put(Long.valueOf(25), 500.0); javaMap.put(Long.MAX_VALUE, Double.MAX_VALUE); javaMap.put(Long.valueOf(0), -1.0); javaMap.put(Long.valueOf(1), 0.0); javaMap.put(Long.valueOf(33), -0.1); javaMap.put(Long.valueOf(23234234), -242343.0); javaMap.put(Long.valueOf(23321), Double.MIN_VALUE); javaMap.put(Long.valueOf(-4444), 332.0); javaMap.put(Long.valueOf(-1), -2323.0); javaMap.put(Long.MIN_VALUE, 44.0); javaMap.put(Long.valueOf("7263934625316938832"), 224.0); /* Add a few more to cause the table to rehash */ javaMap.putAll(generate());/*from ww w . j a va 2 s . c om*/ }
From source file:com.cidre.algorithms.CidreMath.java
public static double[][] min(List<double[][]> stack) { double[][] minImage = stack.get(0); double[][] currentImage; double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; for (int i = 1; i < stack.size(); i++) { currentImage = stack.get(i);/*from w ww.j av a 2s . c om*/ for (int x = 0; x < currentImage.length; x++) { for (int y = 0; y < currentImage[x].length; y++) { if (currentImage[x][y] < minImage[x][y]) { minImage[x][y] = currentImage[x][y]; if (currentImage[x][y] < min) { min = currentImage[x][y]; } if (currentImage[x][y] > max) { max = currentImage[x][y]; } } else { if (minImage[x][y] < min) { min = minImage[x][y]; } if (minImage[x][y] > max) { max = minImage[x][y]; } } } } } log.info("Min: {}, Max: {}", min, max); return minImage; }
From source file:com.offbynull.peernetic.debug.visualizer.VisualizerUtils.java
/** * Creates point on a circle.//from ww w . j a va 2 s . c o m * @param radius radius of circle * @param percentage 0 to 1 percentage of where point is on circle -- 0.0 indicates that the point is at the top middle * @return new point on circle specified by {@code radius} and {@code percentage} * @throws IllegalArgumentException if {@code radius} is negative or a special double value (e.g. NaN/infinite/etc..), or if * {@code percentage} isn't between {@code 0.0 - 1.0} */ public static Point pointOnCircle(double radius, double percentage) { Validate.inclusiveBetween(0.0, Double.MAX_VALUE, radius); Validate.inclusiveBetween(0.0, 1.0, percentage); double angle = percentage * Math.PI * 2.0; angle -= Math.PI / 2.0; // adjust so that percentage 0.0 is at top middle, if not it'ld be at middle right double y = (Math.sin(angle) * radius) + radius; // NOPMD double x = (Math.cos(angle) * radius) + radius; // NOPMD return new Point((int) x, (int) y); }
From source file:net.bither.model.TrendingGraphicData.java
public static TrendingGraphicData format(JSONArray jsonArray) throws JSONException { double high = 0; double low = Double.MAX_VALUE; double rate = ExchangeUtil.getExchangeRate(); double[] prices = new double[jsonArray.length()]; for (int i = 0; i < jsonArray.length(); i++) { double price = jsonArray.getDouble(i) / 100 * rate; if (price == 0) { if (i == 0) { int j = i; while (price == 0 && j < jsonArray.length()) { price = jsonArray.getDouble(j) / 100 * rate; j++;/* w ww .ja v a 2 s. com*/ } } else { int j = i - 1; price = jsonArray.getDouble(i - 1) / 100 * rate; while (price == 0 && j > 0) { price = jsonArray.getDouble(j) / 100 * rate; j--; } } } prices[i] = price; if (high < price) { high = price; } if (low > price) { low = price; } } TrendingGraphicData trendingGraphicData = new TrendingGraphicData(high, low, prices); return trendingGraphicData; }
From source file:br.unicamp.ic.recod.gpsi.measures.gpsiClusterDistortionScore.java
@Override public double score(double[][][] samples) { double score = 0.0; double[] centroid; double[][] vectors; int nClasses = samples.length, m = 0, m_i = 0, i; VectorialMean meanOperator;/* w w w. j a v a 2 s.co m*/ EuclideanDistance distance = new EuclideanDistance(); for (int label = 0; label < samples.length; label++) { vectors = samples[label]; meanOperator = new VectorialMean(vectors[0].length); for (i = 0; i < vectors.length; i++) meanOperator.increment(vectors[i]); centroid = meanOperator.getResult(); m_i = vectors.length; for (i = 0; i < m_i; i++) { score += distance.compute(centroid, vectors[i]); } m += m_i; } if (score <= 1E-30) return Double.MAX_VALUE; return score / m; }