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:de.chaosfisch.google.youtube.upload.Uploader.java

public void setMaxSpeed(final int maxSpeed) {
    rateLimitter.setRate(0 == maxSpeed ? Double.MAX_VALUE : maxSpeed * ONE_KILOBYTE);
}

From source file:de.tudarmstadt.lt.ltbot.postprocessor.DecesiveLoggerTest.java

@Test
public void b_content5() throws InterruptedException, JSONException, IOException {
    System.out.println("9");
    curi.getExtraInfo().put(SharedConstants.EXTRA_INFO_PERPLEXITY, String.format("%012g", Double.MAX_VALUE));
    l.process(curi);//from www .jav  a  2 s  . c om
    checkContentLastLine(true);
}

From source file:android.support.test.espresso.web.model.ModelCodecTest.java

public void testEncodeDecode_map() {
    Map<String, Object> adhoc = Maps.newHashMap();
    adhoc.put("yellow", 1234);
    adhoc.put("bar", "frog");
    adhoc.put("int_max", Integer.MAX_VALUE);
    adhoc.put("int_min", Integer.MIN_VALUE);
    adhoc.put("double_min", Double.MIN_VALUE);
    adhoc.put("double_max", Double.MAX_VALUE);
    adhoc.put("sudz", Lists.newArrayList("goodbye"));
    assertEquals(adhoc, ModelCodec.decode(ModelCodec.encode(adhoc)));
}

From source file:edu.scripps.fl.curves.plot.CurvePlot.java

public void addCurveAllPoints(Curve curve, FitFunction fitFunction, String description) {
    double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
    YIntervalSeries validSeries = new YIntervalSeries(description);
    validSeries.setDescription(description);
    YIntervalSeries invalidSeries = new YIntervalSeries("");
    for (int ii = 0; ii < curve.getConcentrations().size(); ii++) {
        Double c = curve.getConcentrations().get(ii);
        Double r = curve.getResponses().get(ii);
        if (curve.getMask().get(ii))
            validSeries.add(c, r, r, r);
        else//  w w w  .  j  a va2  s  . c o  m
            invalidSeries.add(c, r, r, r);
        min = Math.min(min, c);
        max = Math.max(max, c);
    }
    addCurve(curve, validSeries, invalidSeries, fitFunction, min, max);
}

From source file:edu.stanford.slac.archiverappliance.PB.data.BoundaryConditionsSimulationValueGenerator.java

/**
 * Get a value based on the DBR type. /* w  ww.  ja v a  2 s .c  o  m*/
 * We should check for boundary conditions here and make sure PB does not throw exceptions when we come close to MIN_ and MAX_ values 
 * @param type
 * @param secondsIntoYear
 * @return
 */
public SampleValue getSampleValue(ArchDBRTypes type, int secondsIntoYear) {
    switch (type) {
    case DBR_SCALAR_STRING:
        return new ScalarStringSampleValue(Integer.toString(secondsIntoYear));
    case DBR_SCALAR_SHORT:
        if (0 <= secondsIntoYear && secondsIntoYear < 1000) {
            // Check for some numbers around the minimum value
            return new ScalarValue<Short>((short) (Short.MIN_VALUE + secondsIntoYear));
        } else if (1000 <= secondsIntoYear && secondsIntoYear < 2000) {
            // Check for some numbers around the maximum value
            return new ScalarValue<Short>((short) (Short.MAX_VALUE - (secondsIntoYear - 1000)));
        } else {
            // Check for some numbers around 0
            return new ScalarValue<Short>((short) (secondsIntoYear - 2000));
        }
    case DBR_SCALAR_FLOAT:
        if (0 <= secondsIntoYear && secondsIntoYear < 1000) {
            // Check for some numbers around the minimum value
            return new ScalarValue<Float>(Float.MIN_VALUE + secondsIntoYear);
        } else if (1000 <= secondsIntoYear && secondsIntoYear < 2000) {
            // Check for some numbers around the maximum value
            return new ScalarValue<Float>(Float.MAX_VALUE - (secondsIntoYear - 1000));
        } else {
            // Check for some numbers around 0. Divide by a large number to make sure we cater to the number of precision digits
            return new ScalarValue<Float>((secondsIntoYear - 2000.0f) / secondsIntoYear);
        }
    case DBR_SCALAR_ENUM:
        return new ScalarValue<Short>((short) secondsIntoYear);
    case DBR_SCALAR_BYTE:
        return new ScalarValue<Byte>(((byte) (secondsIntoYear % 255)));
    case DBR_SCALAR_INT:
        if (0 <= secondsIntoYear && secondsIntoYear < 1000) {
            // Check for some numbers around the minimum value
            return new ScalarValue<Integer>(Integer.MIN_VALUE + secondsIntoYear);
        } else if (1000 <= secondsIntoYear && secondsIntoYear < 2000) {
            // Check for some numbers around the maximum value
            return new ScalarValue<Integer>(Integer.MAX_VALUE - (secondsIntoYear - 1000));
        } else {
            // Check for some numbers around 0
            return new ScalarValue<Integer>(secondsIntoYear - 2000);
        }
    case DBR_SCALAR_DOUBLE:
        if (0 <= secondsIntoYear && secondsIntoYear < 1000) {
            // Check for some numbers around the minimum value
            return new ScalarValue<Double>(Double.MIN_VALUE + secondsIntoYear);
        } else if (1000 <= secondsIntoYear && secondsIntoYear < 2000) {
            // Check for some numbers around the maximum value
            return new ScalarValue<Double>(Double.MAX_VALUE - (secondsIntoYear - 1000));
        } else {
            // Check for some numbers around 0. Divide by a large number to make sure we cater to the number of precision digits
            return new ScalarValue<Double>((secondsIntoYear - 2000.0) / (secondsIntoYear * 1000000));
        }
    case DBR_WAVEFORM_STRING:
        // Varying number of copies of a typical value
        return new VectorStringSampleValue(
                Collections.nCopies(secondsIntoYear, Integer.toString(secondsIntoYear)));
    case DBR_WAVEFORM_SHORT:
        return new VectorValue<Short>(Collections.nCopies(1, (short) secondsIntoYear));
    case DBR_WAVEFORM_FLOAT:
        // Varying number of copies of a typical value
        return new VectorValue<Float>(
                Collections.nCopies(secondsIntoYear, (float) Math.cos(secondsIntoYear * Math.PI / 3600)));
    case DBR_WAVEFORM_ENUM:
        return new VectorValue<Short>(Collections.nCopies(1024, (short) secondsIntoYear));
    case DBR_WAVEFORM_BYTE:
        // Large number of elements in the array
        return new VectorValue<Byte>(
                Collections.nCopies(65536 * secondsIntoYear, ((byte) (secondsIntoYear % 255))));
    case DBR_WAVEFORM_INT:
        // Varying number of copies of a typical value
        return new VectorValue<Integer>(
                Collections.nCopies(secondsIntoYear, secondsIntoYear * secondsIntoYear));
    case DBR_WAVEFORM_DOUBLE:
        // Varying number of copies of a typical value
        return new VectorValue<Double>(
                Collections.nCopies(secondsIntoYear, Math.sin(secondsIntoYear * Math.PI / 3600)));
    case DBR_V4_GENERIC_BYTES:
        // Varying number of copies of a typical value
        ByteBuffer buf = ByteBuffer.allocate(1024 * 10);
        buf.put(Integer.toString(secondsIntoYear).getBytes());
        buf.flip();
        return new ByteBufSampleValue(buf);
    default:
        throw new RuntimeException("We seemed to have missed a DBR type when generating sample data");
    }
}

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * Setup an 'INFORMATION' info marker on the component. Automatically displays anytime that the initialControl is disabled.
 * Put the initial control in the provided stack pane
 *//*from w w w .  j av  a2s.  c o m*/
public static Node setupDisabledInfoMarker(Control initialControl, StackPane stackPane,
        ObservableStringValue reasonWhyControlDisabled) {
    ImageView information = Images.INFORMATION.createImageView();

    information.visibleProperty().bind(initialControl.disabledProperty());
    Tooltip tooltip = new Tooltip();
    tooltip.textProperty().bind(reasonWhyControlDisabled);
    Tooltip.install(information, tooltip);
    tooltip.setAutoHide(true);

    information.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            tooltip.show(information, event.getScreenX(), event.getScreenY());

        }

    });

    stackPane.setMaxWidth(Double.MAX_VALUE);
    stackPane.getChildren().add(initialControl);
    StackPane.setAlignment(initialControl, Pos.CENTER_LEFT);
    stackPane.getChildren().add(information);
    if (initialControl instanceof Button) {
        StackPane.setAlignment(information, Pos.CENTER);
    } else if (initialControl instanceof CheckBox) {
        StackPane.setAlignment(information, Pos.CENTER_LEFT);
        StackPane.setMargin(information, new Insets(0, 0, 0, 1));
    } else {
        StackPane.setAlignment(information, Pos.CENTER_RIGHT);
        double insetFromRight = (initialControl instanceof ComboBox ? 30.0 : 5.0);
        StackPane.setMargin(information, new Insets(0.0, insetFromRight, 0.0, 0.0));
    }
    return stackPane;
}

From source file:be.makercafe.apps.makerbench.editors.JFXMillEditor.java

public JFXMillEditor(String tabText, Path path) {
    super(tabText);

    this.viewGroup = new Group();
    this.editorContainer = new BorderPane();
    this.viewContainer = new Pane();

    this.caCodeArea = new CodeArea("");
    this.caCodeArea.setEditable(true);
    this.caCodeArea.setParagraphGraphicFactory(LineNumberFactory.get(caCodeArea));
    this.caCodeArea.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);
    this.caCodeArea.getStylesheets().add(this.getClass().getResource("java-keywords.css").toExternalForm());
    this.caCodeArea.richChanges().subscribe(change -> {
        caCodeArea.setStyleSpans(0, computeHighlighting(caCodeArea.getText()));
    });/*  w w  w . ja va  2 s . c  o  m*/
    addContextMenu(this.caCodeArea);

    EventStream<Change<String>> textEvents = EventStreams.changesOf(caCodeArea.textProperty());

    textEvents.reduceSuccessions((a, b) -> b, Duration.ofMillis(3000)).subscribe(code -> {
        if (autoCompile) {
            compile(code.getNewValue());
        }
    });

    try {
        this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile()));
    } catch (IOException ex) {
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex);
    }

    SplitPane editorPane = new SplitPane(caCodeArea, viewContainer);
    editorPane.setOrientation(Orientation.HORIZONTAL);
    BorderPane rootPane = new BorderPane();

    toolBar = createToolBar();
    rootPane.setTop(toolBar);
    rootPane.setCenter(editorPane);
    this.getTab().setContent(rootPane);

}

From source file:edu.oregonstate.eecs.mcplan.ml.ConstrainedKMeans.java

private int assign(final int i) {
    int hopt = 0;
    double Jopt = Double.MAX_VALUE;
    for (int h = 0; h < k; ++h) {
        final double ji = J(i, h);
        if (ji <= Jopt) {
            Jopt = ji;/*from w w w .j  a va2  s.  c  o  m*/
            hopt = h;
        }
    }
    return hopt;
}

From source file:com.net2plan.libraries.GraphTheoryMetrics.java

private void computeSPDistanceMetrics() {
    diameter = 0;// www. j  a v  a2 s .  c om
    averageSPLength = 0;
    heterogeneity = 0;

    Graph<Node, Link> aux_graph = getGraph_JUNG();
    Transformer<Link, Double> aux_nev = getCostTransformer();

    /* Compute network diameter using nave Floyd-Warshall algorithm */
    double[][] costMatrix = new double[N][N];
    for (int n = 0; n < N; n++) {
        Arrays.fill(costMatrix[n], Double.MAX_VALUE);
        costMatrix[n][n] = 0;
    }

    for (Link edge : aux_graph.getEdges()) {
        int a_e = edge.getOriginNode().getIndex();
        int b_e = edge.getDestinationNode().getIndex();
        double newCost = aux_nev.transform(edge);
        if (newCost < costMatrix[a_e][b_e])
            costMatrix[a_e][b_e] = newCost;
    }

    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            if (i == k)
                continue;

            for (int j = 0; j < N; j++) {
                if (j == k || j == i)
                    continue;

                double newValue = costMatrix[i][k] + costMatrix[k][j];
                if (newValue < costMatrix[i][j])
                    costMatrix[i][j] = newValue;
            }
        }
    }

    int numPaths = 0;
    double sum = 0;
    double M = 0.0;
    double S = 0.0;

    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            double dist_ij = costMatrix[i][j];
            if (dist_ij < Double.MAX_VALUE) {
                sum += dist_ij;
                numPaths++;

                double tmpM = M;
                M += (dist_ij - tmpM) / numPaths;
                S += (dist_ij - tmpM) * (dist_ij - M);

                if (dist_ij > diameter)
                    diameter = dist_ij;
            }

            double dist_ji = costMatrix[j][i];
            if (dist_ji < Double.MAX_VALUE) {
                sum += dist_ji;
                numPaths++;

                double tmpM = M;
                M += (dist_ji - tmpM) / numPaths;
                S += (dist_ji - tmpM) * (dist_ji - M);

                if (dist_ji > diameter)
                    diameter = dist_ji;
            }
        }
    }

    if (numPaths == 0)
        return;

    averageSPLength = numPaths == 0 ? 0 : sum / numPaths;
    heterogeneity = averageSPLength == 0 ? 0 : Math.sqrt(S / numPaths) / averageSPLength;
}

From source file:com.ibm.bi.dml.hops.globalopt.GDFEnumOptimizer.java

@Override
public GDFGraph optimize(GDFGraph gdfgraph, Summary summary)
        throws DMLRuntimeException, DMLUnsupportedOperationException, HopsException, LopsException {
    Timing time = new Timing(true);

    Program prog = gdfgraph.getRuntimeProgram();
    ExecutionContext ec = ExecutionContextFactory.createContext(prog);
    ArrayList<GDFNode> roots = gdfgraph.getGraphRootNodes();

    //Step 1: baseline costing for branch and bound costs
    double initCosts = Double.MAX_VALUE;
    if (BRANCH_AND_BOUND_PRUNING) {
        initCosts = CostEstimationWrapper.getTimeEstimate(prog, ec);
        initCosts = initCosts * (1 + BRANCH_AND_BOUND_REL_THRES);
    }//w  w w .j  a v a2  s .  co m

    //Step 2: dynamic programming plan generation
    //(finally, pick optimal root plans over all interesting property sets)
    ArrayList<Plan> rootPlans = new ArrayList<Plan>();
    for (GDFNode node : roots) {
        PlanSet ps = enumOpt(node, _memo, initCosts);
        Plan optPlan = ps.getPlanWithMinCosts();
        rootPlans.add(optPlan);
    }
    long enumPlanMismatch = getPlanMismatches();

    //check for final containment of independent roots and pick optimal
    HashMap<Long, Plan> memo = new HashMap<Long, Plan>();
    resetPlanMismatches();
    for (Plan p : rootPlans)
        rSetRuntimePlanConfig(p, memo);
    long finalPlanMismatch = getPlanMismatches();

    //generate final runtime plan (w/ optimal config)
    Recompiler.recompileProgramBlockHierarchy(prog.getProgramBlocks(), new LocalVariableMap(), 0, false);

    ec = ExecutionContextFactory.createContext(prog);
    double optCosts = CostEstimationWrapper.getTimeEstimate(prog, ec);

    //maintain optimization summary statistics
    summary.setCostsInitial(initCosts);
    summary.setCostsOptimal(optCosts);
    summary.setNumEnumPlans(_enumeratedPlans);
    summary.setNumPrunedInvalidPlans(_prunedInvalidPlans);
    summary.setNumPrunedSuboptPlans(_prunedSuboptimalPlans);
    summary.setNumCompiledPlans(_compiledPlans);
    summary.setNumCostedPlans(_costedPlans);
    summary.setNumEnumPlanMismatch(enumPlanMismatch);
    summary.setNumFinalPlanMismatch(finalPlanMismatch);
    summary.setTimeOptim(time.stop());

    return gdfgraph;
}