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:eu.over9000.skadi.ui.dialogs.PerformUpdateDialog.java

public PerformUpdateDialog(RemoteVersionResult newVersion) {
    this.chosen = new SimpleObjectProperty<>(
            Paths.get(SystemUtils.USER_HOME, newVersion.getVersion() + ".jar").toFile());

    this.setHeaderText("Updating to " + newVersion.getVersion());
    this.setTitle("Skadi Updater");
    this.getDialogPane().getStyleClass().add("alert");
    this.getDialogPane().getStyleClass().add("information");

    final ButtonType restartButtonType = new ButtonType("Start New Version", ButtonBar.ButtonData.OK_DONE);
    this.getDialogPane().getButtonTypes().addAll(restartButtonType, ButtonType.CANCEL);

    Node btn = this.getDialogPane().lookupButton(restartButtonType);
    btn.setDisable(true);//from w w w. ja  v  a 2s  . c  om

    Label lbPath = new Label("Save as");
    TextField tfPath = new TextField();
    tfPath.textProperty()
            .bind(Bindings.createStringBinding(() -> this.chosen.get().getAbsolutePath(), this.chosen));
    tfPath.setPrefColumnCount(40);
    tfPath.setEditable(false);

    Button btChangePath = GlyphsDude.createIconButton(FontAwesomeIcons.FOLDER_OPEN, "Browse...");
    btChangePath.setOnAction(event -> {
        FileChooser fc = new FileChooser();
        fc.setTitle("Save downloaded jar..");
        fc.setInitialFileName(this.chosen.getValue().getName());
        fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("Jar File", ".jar"));
        fc.setInitialDirectory(this.chosen.getValue().getParentFile());
        File selected = fc.showSaveDialog(this.getOwner());
        if (selected != null) {
            this.chosen.set(selected);
        }
    });

    ProgressBar pbDownload = new ProgressBar(0);
    pbDownload.setDisable(true);
    pbDownload.setMaxWidth(Double.MAX_VALUE);
    Label lbDownload = new Label("Download");
    Label lbDownloadValue = new Label();
    Button btDownload = GlyphsDude.createIconButton(FontAwesomeIcons.DOWNLOAD, "Start");
    btDownload.setMaxWidth(Double.MAX_VALUE);
    btDownload.setOnAction(event -> {
        btChangePath.setDisable(true);
        btDownload.setDisable(true);

        this.downloadService = new DownloadService(newVersion.getDownloadURL(), this.chosen.getValue());

        lbDownloadValue.textProperty().bind(this.downloadService.messageProperty());
        pbDownload.progressProperty().bind(this.downloadService.progressProperty());

        this.downloadService.setOnSucceeded(dlEvent -> {
            btn.setDisable(false);
        });
        this.downloadService.setOnFailed(dlFailed -> {
            LOGGER.error("new version download failed", dlFailed.getSource().getException());
            lbDownloadValue.textProperty().unbind();
            lbDownloadValue.setText("Download failed, check log file for details.");
        });

        this.downloadService.start();
    });

    final GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);

    grid.add(lbPath, 0, 0);
    grid.add(tfPath, 1, 0);
    grid.add(btChangePath, 2, 0);
    grid.add(new Separator(), 0, 1, 3, 1);
    grid.add(lbDownload, 0, 2);
    grid.add(pbDownload, 1, 2);
    grid.add(btDownload, 2, 2);
    grid.add(lbDownloadValue, 1, 3);

    this.getDialogPane().setContent(grid);

    this.setResultConverter(btnType -> {
        if (btnType == restartButtonType) {
            return this.chosen.getValue();
        }

        if (btnType == ButtonType.CANCEL) {
            if (this.downloadService.isRunning()) {
                this.downloadService.cancel();
            }
        }

        return null;
    });

}

From source file:be.makercafe.apps.makerbench.Main.java

@Override
public void start(Stage primaryStage) {
    setupWorkspace();/*from  w  w w  . j a v a  2s  . c  o m*/
    rootContextMenu = createViewerContextMenu();
    viewer = createViewer();

    this.stage = primaryStage;
    BorderPane p = new BorderPane();

    p.setTop(createMenuBar());

    // p.setLeft(viewer);
    tabFolder = new TabPane();
    BorderPane bodyPane = new BorderPane();
    TextArea taConsole = new TextArea();
    taConsole.setPrefSize(Double.MAX_VALUE, 200.0);
    taConsole.setEditable(false);

    Console console = new Console(taConsole);
    PrintStream ps = new PrintStream(console, true);
    System.setOut(ps);
    System.setErr(ps);

    bodyPane.setBottom(taConsole);
    bodyPane.setCenter(tabFolder);
    SplitPane splitpane = new SplitPane();
    splitpane.getItems().addAll(viewer, bodyPane);
    splitpane.setDividerPositions(0.0f, 1.0f);
    p.setCenter(splitpane);

    Scene scene = new Scene(p, 1024, 800);
    //scene.getStylesheets().add(this.getClass().getResource("/styles/java-keywords.css").toExternalForm());

    primaryStage.setResizable(true);
    primaryStage.setTitle("Makerbench");
    primaryStage.setScene(scene);
    //primaryStage.getIcons().add(new Image("/path/to/stackoverflow.jpg"));
    primaryStage.show();
}

From source file:co.turnus.trace.scheduler.devs.DevsTraceScheduler.java

public void run() {
    if (simulationId == null) {
        throw new TurnusRuntimeException("DEVS Trace scheduler not configured!");
    }/*from w  w w.java  2  s .c o m*/

    TurnusLogger.info("Starting simulation \"" + simulationId + "\"");

    // set remaining parameters and variables
    Simulator sim = new Simulator(model);
    double t = sim.nextEventTime();
    double simTimer = -Double.MIN_VALUE;
    SimpleTimer cpuClock = new SimpleTimer();
    cpuClock.reset();

    // simulate
    while (t < Double.MAX_VALUE) {

        if (exportGantt) {
            long scaledT = getGanttTime(t);
            if (scaledT != scaledTime) {
                scaledTime = scaledT;
                logStatus(scaledTime);
            }
        }

        simTimer = t;

        sim.execNextEvent();
        t = sim.nextEventTime();
    }

    logStatus(getGanttTime(simTimer));

    boolean deadlock = checkDeadlock();

    TurnusLogger.info("Simulation \"%s\" done (deadlock: %b)", simulationId, deadlock);
    TurnusLogger.info("Throughput: " + simTimer);
    TurnusLogger.info("CPU timer : " + cpuClock.getElapsedTime());

    if (exportGantt) {
        TurnusLogger.info("Finalizing gantt chart...");
        ganttBuilder.end(getGanttTime(simTimer));
    }
}

From source file:c3.ops.priam.aws.S3FileSystem.java

@Inject
public S3FileSystem(Provider<AbstractBackupPath> pathProvider, ICompression compress,
        final IConfiguration config, ICredential cred) {
    this.pathProvider = pathProvider;
    this.compress = compress;
    this.config = config;
    int threads = config.getMaxBackupUploadThreads();
    LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(threads);
    this.executor = new BlockingSubmitThreadPoolExecutor(threads, queue, UPLOAD_TIMEOUT);
    double throttleLimit = config.getUploadThrottle();
    rateLimiter = RateLimiter.create(throttleLimit < 1 ? Double.MAX_VALUE : throttleLimit);

    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    String mbeanName = MBEAN_NAME;
    try {//from www  . j  a  v a  2  s .c  o m
        mbs.registerMBean(this, new ObjectName(mbeanName));
    } catch (Exception e) {
        logger.warn("Fail to register " + mbeanName);
        //throw new RuntimeException(e);
    }

    s3Client = new AmazonS3Client(cred.getAwsCredentialProvider());
    s3Client.setEndpoint(getS3Endpoint());
}

From source file:eu.crisis_economics.utilities.EmpiricalDistribution.java

private void reconcileDeletion(double valueDeleted) {
    maxRecordValue = -Double.MAX_VALUE;
    minRecordValue = Double.MAX_VALUE;
    Iterator<SortedDatum> it = m_sortedData.iterator();
    while (it.hasNext()) {
        SortedDatum record = it.next();/*from w  w w.j av a2 s.co m*/
        maxRecordValue = Math.max(record.value, maxRecordValue);
        minRecordValue = Math.min(record.value, minRecordValue);
        if (record.value > valueDeleted)
            record.numRecordsLessThan--;
    }
}

From source file:com.linkedin.pinot.core.realtime.converter.stats.RealtimeNoDictionaryColStatistics.java

private void computeDoubleMinMax(int[] rows) {
    double values[] = new double[_numDocIds];
    _blockValSet.getDoubleValues(rows, 0, _numDocIds, values, 0);
    double min = Double.MAX_VALUE;
    double max = Double.MIN_VALUE;
    for (int i = 0; i < _numDocIds; i++) {
        if (values[i] < min) {
            min = values[i];//from  www.  j av a  2 s.  c o m
        }
        if (values[i] > max) {
            max = values[i];
        }
    }
    _minValue = Double.valueOf(min);
    _maxValue = Double.valueOf(max);
}

From source file:edu.oregonstate.eecs.mcplan.search.fsss.EpsilonGreedyRefinementOrder.java

@Override
protected SubtreeRefinementOrder<S, A> chooseSubtree() {
    if (rng.nextDouble() > epsilon) {
        // Greedy choice of the *2nd-best* action
        final FsssAbstractActionNode<S, A> aan = root.astar_random();
        assert (aan != null);

        final ArrayList<SubtreeRefinementOrder<S, A>> astar = new ArrayList<SubtreeRefinementOrder<S, A>>();
        double ustar = -Double.MAX_VALUE;
        for (final SubtreeRefinementOrder<S, A> subtree : subtrees.values()) {
            final FsssAbstractActionNode<S, A> ai = subtree.rootAction();
            if (ai == aan) {
                // Skip the optimal subtree
                continue;
            }//from w ww  .  jav  a  2 s.  c  o m
            final double u = ai.U();
            if (u > ustar) {
                ustar = u;
                astar.clear();
                astar.add(subtree);
            } else if (u >= ustar) {
                astar.add(subtree);
            }
        }

        final SubtreeRefinementOrder<S, A> subtree = astar.get(rng.nextInt(astar.size()));
        //         System.out.println( "\tEpsilonGreedyRefinementOrder: greedy choice " + subtree.rootAction() );
        return subtree;
    } else {
        // Random choice
        final int choice = rng.nextInt(subtrees.size());
        final Iterator<SubtreeRefinementOrder<S, A>> itr = subtrees.values().iterator();
        for (int i = 0; i < choice; ++i) {
            itr.next();
        }
        final SubtreeRefinementOrder<S, A> subtree = itr.next();
        //         System.out.println( "\tEpsilonGreedyRefinementOrder: random subtree " + subtree.rootAction() );
        return subtree;
    }
}

From source file:org.sonar.server.charts.deprecated.SparkLinesChart.java

private void addMeasures(String values) {
    double min = Double.MAX_VALUE;
    double max = Double.MIN_VALUE;
    XYSeries series1 = new XYSeries("");
    if (values != null && values.length() > 0) {
        StringTokenizer st = new StringTokenizer(values, ",");
        while (st.hasMoreTokens()) {
            double vX = convertParamToDouble(st.nextToken());
            double vY = 0.0;
            if (st.hasMoreTokens()) {
                vY = convertParamToDouble(st.nextToken());
            }/*from   w  w  w  .j av  a  2s  .co  m*/
            series1.add(vX, vY);

            min = (vY < min ? vY : min);
            max = (vY > max ? vY : max);
        }
        dataset.addSeries(series1);
        y.setRange(min - 1, max + 1);
    }
}

From source file:co.turnus.common.util.CommonDataUtil.java

public static StatisticalData sum(StatisticalData[] data, double cov) {
    if (data.length == 1) {
        return EcoreUtil.copy(data[0]);
    }//from w ww  . j  a  v a2s.  c o  m

    StatisticalData sum = CommonFactory.eINSTANCE.createStatisticalData();
    sum.setMax(Double.MIN_VALUE);
    sum.setMin(Double.MAX_VALUE);
    sum.setVariance(-2 * cov); // initial offset for the first iteration...

    for (StatisticalData d : data) {
        sum.setMax(FastMath.max(sum.getMax(), d.getMax()));
        sum.setMin(FastMath.min(sum.getMin(), d.getMin()));
        sum.setMean(sum.getMean() + d.getMean());
        sum.setSamples(sum.getSamples() + d.getSamples());
        sum.setVariance(sum.getVariance() + d.getVariance() + 2 * cov);
        sum.setSamples(sum.getSamples() + d.getSamples());
    }

    return sum;
}

From source file:edu.oregonstate.eecs.mcplan.search.fsss.IncompleteEpsilonGreedyRefinementOrder.java

@Override
protected SubtreeRefinementOrder<S, A> chooseSubtree() {
    final FsssAbstractActionNode<S, A> astar = root.astar();
    int astar_idx = Integer.MAX_VALUE; // This value ensures astar_idx > tree_idx if astar subtree is closed
    double max_U = -Double.MAX_VALUE;
    int max_idx = -1;
    for (int i = 0; i < subtrees.size(); ++i) {
        final SubtreeRefinementOrder<S, A> t = subtrees.get(i);
        if (t.rootAction().a().equals(astar.a())) {
            astar_idx = i;/*from  www.j a  v  a 2s .  co  m*/
            continue;
        } else {
            assert (!t.isClosed());
            final double Ui = t.rootAction().U();
            if (Ui > max_U) {
                max_U = Ui;
                max_idx = i;
            }
        }
    }
    final int tree_idx;
    if (rng.nextDouble() < epsilon) {
        // Greedy choice
        tree_idx = max_idx;
    } else {
        // Uniform random choice
        final int candidate = rng.nextInt(subtrees.size() - 1);
        // Adjust index to skip optimal subtree
        tree_idx = (candidate < astar_idx ? candidate : candidate + 1);
    }
    final SubtreeRefinementOrder<S, A> selected_subtree = subtrees.get(tree_idx);
    return selected_subtree;
}