Example usage for java.lang Double MAX_VALUE

List of usage examples for java.lang Double MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Double MAX_VALUE.

Prototype

double MAX_VALUE

To view the source code for java.lang Double MAX_VALUE.

Click Source Link

Document

A constant holding the largest positive finite value of type double , (2-2-52)·21023.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    HBox hbox = new HBox();
    Button button1 = new Button("Add");
    Button button2 = new Button("Remove");
    HBox.setHgrow(button1, Priority.ALWAYS);
    HBox.setHgrow(button2, Priority.ALWAYS);
    button1.setMaxWidth(Double.MAX_VALUE);
    button2.setMaxWidth(Double.MAX_VALUE);
    hbox.getChildren().addAll(button1, button2);

    hbox.setPrefWidth(400);//from   www .ja v a  2 s  . c om

    System.out.println(hbox.getContentBias());

    root.getChildren().add(hbox);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

public void start(Stage stage) {
    Node top = null;/*  w  w  w.  j  a va  2  s . co m*/
    Node left = null;

    VBox center = getCenter();

    Button okBtn = new Button("Ok");
    Button cancelBtn = new Button("Cancel");

    okBtn.setMaxWidth(Double.MAX_VALUE);
    VBox right = new VBox(okBtn, cancelBtn);
    right.setStyle("-fx-padding: 10;");

    Label statusLbl = new Label("Status: Ready");
    HBox bottom = new HBox(statusLbl);
    BorderPane.setMargin(bottom, new Insets(10, 0, 0, 0));

    BorderPane root = new BorderPane(center, top, right, bottom, left);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    HBox hbox = new HBox();
    Button button1 = new Button("Add               ");
    Button button2 = new Button("Remove   ");
    HBox.setHgrow(button1, Priority.ALWAYS);
    HBox.setHgrow(button2, Priority.ALWAYS);
    button1.setMaxWidth(Double.MAX_VALUE);
    button2.setMaxWidth(Double.MAX_VALUE);
    hbox.getChildren().addAll(button1, button2);

    root.getChildren().add(hbox);// w w w .j a v a2  s .  c  o m
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    HBox hbox = new HBox();
    Button button1 = new Button("Add               ");
    Button button2 = new Button("Remove   ");
    HBox.setHgrow(button1, Priority.ALWAYS);
    HBox.setHgrow(button2, Priority.ALWAYS);
    button1.setMaxWidth(Double.MAX_VALUE);
    button2.setMaxWidth(Double.MAX_VALUE);
    hbox.getChildren().addAll(button1, button2);

    hbox.setPrefWidth(400);/* w ww.  j  a va 2  s. c om*/

    root.getChildren().add(hbox);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

public static double calculateVariance(List<Double> list, double mean) {
    if (mean == Double.MAX_VALUE)
        return mean;
    if (list.size() == 1)
        return 0;
    double sum = 0;
    for (double num : list) {
        sum += Math.pow(num - mean, 2);
    }/*from   w ww  .  j a va2  s.c  o m*/
    return sum / (list.size() - 1);
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    HBox hbox = new HBox(8);//space
    Button button1 = new Button("Add               ");
    Button button2 = new Button("Remove   ");
    HBox.setHgrow(button1, Priority.ALWAYS);
    HBox.setHgrow(button2, Priority.ALWAYS);
    button1.setMaxWidth(Double.MAX_VALUE);
    button2.setMaxWidth(Double.MAX_VALUE);
    hbox.getChildren().addAll(button1, button2);

    hbox.setPrefWidth(400);/* w w w .  j  a v a  2s. com*/

    root.getChildren().add(hbox);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 180, 250);

    String[] keys = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#" };

    GridPane numPad = new GridPane();
    for (int i = 0; i < 12; i++) {
        Button button = new Button(keys[i]);
        button.getStyleClass().add("num-button");
        numPad.add(button, i % 3, (int) Math.ceil(i / 3));
    }//w w w  .  j  av a  2 s.  co  m

    Button call = new Button("Call");
    call.setId("call-button");
    call.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    numPad.add(call, 0, 4);

    GridPane.setColumnSpan(call, 3);
    GridPane.setHgrow(call, Priority.ALWAYS);

    root.setCenter(numPad);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

/**
 * Iterate over supported camera preview 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.// ww w. ja  va 2  s  . com
 *
 * @param sizes Supported camera preview sizes.
 * @param w The width of the view.
 * @param h The height of the view.
 * @return Best match camera preview size to fit in the view.
 */
public static Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) {

    Log.d(TAG, "getOptimalPreviewSize");

    // Use a very small tolerance because we want an exact match.
    final double ASPECT_TOLERANCE = 0.1;
    double targetRatio = (double) w / h;
    if (sizes == null)
        return null;

    Camera.Size optimalSize = null;

    // Start with max value and refine as we iterate over available preview 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 preview 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 : sizes) {
        double ratio = (double) size.width / size.height;
        if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE)
            continue;
        if (Math.abs(size.height - targetHeight) < minDiff) {
            optimalSize = size;
            minDiff = Math.abs(size.height - targetHeight);
        }
    }

    // Cannot find preview size that matches the aspect ratio, ignore the requirement
    if (optimalSize == null) {
        minDiff = Double.MAX_VALUE;
        for (Camera.Size size : sizes) {
            if (Math.abs(size.height - targetHeight) < minDiff) {
                optimalSize = size;
                minDiff = Math.abs(size.height - targetHeight);
            }
        }
    }
    return optimalSize;
}

From source file:lu.lippmann.cdb.weka.SilhouetteUtil.java

/**
 * res.get(clusterIdx) = silhouettes values map for instances 
 * @param result//from   w w w .  j  ava  2s . co m
 * @return
 */
protected static Map<Integer, List<Double>> computeSilhouette(final Instances ds,
        final WekaClusteringResult result) {
    final List<Instances> clusters = result.getClustersList();
    final List<Double> res = new ArrayList<Double>();
    final int cs = clusters.size();

    final double[] ass = result.getAss();

    final EuclideanDistance euclidian = new EuclideanDistance(ds);
    //euclidian.setDontNormalize(true);
    ds.setClassIndex(-1);

    //Loop through every cluster
    final int dss = ds.numInstances();
    for (int i = 0; i < dss; i++) {
        final int clusterIndex = (int) ass[i];
        double distAo = -1;
        double distBo = Double.MAX_VALUE;
        boolean distanceIsZero = false;
        for (int j = 0; j < cs; j++) {
            //Compute distCo, for all C
            double distCo = 0;
            Instances cluster = result.getClustersList().get(j);
            final int cls = cluster.numInstances();
            for (int k = 0; k < cls; k++) {
                distCo += euclidian.distance(cluster.instance(k), ds.instance(i));
            }
            distCo /= cls;
            if (j != clusterIndex && distCo < distBo) {
                distBo = distCo;
            }

            if (j == clusterIndex) {
                if (distCo == 0) {
                    distanceIsZero = true;
                } else {
                    distAo = distCo;
                }
            }
        }
        if (distanceIsZero) {
            res.add(0d);
        } else {
            res.add((distBo - distAo) / Math.max(distAo, distBo));
        }
    }

    final Map<Integer, List<Double>> sils = new HashMap<Integer, List<Double>>();
    for (int i = 0; i < dss; i++) {
        final int clusterIndex = (int) ass[i];
        if (!sils.containsKey(clusterIndex)) {
            sils.put(clusterIndex, new ArrayList<Double>());
        }
        sils.get(clusterIndex).add(res.get(i));
    }
    for (final List<Double> list : sils.values()) {
        Collections.sort(list, Collections.reverseOrder());
    }
    return sils;

}

From source file:ch.aonyx.broker.ib.api.order.OrderComboLeg.java

public OrderComboLeg() {
    price = Double.MAX_VALUE;
}