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:springfox.bean.validators.plugins.MinMaxAnnotationPlugin.java
private AllowableValues createAllowableValuesFromMinMaxForNumbers(Optional<Min> min, Optional<Max> max) { AllowableRangeValues myvalues = null; if (min.isPresent() && max.isPresent()) { LOG.debug("@Min+@Max detected: adding AllowableRangeValues to field "); myvalues = new AllowableRangeValues(Double.toString(min.get().value()), Double.toString(max.get().value())); } else if (min.isPresent()) { LOG.debug("@Min detected: adding AllowableRangeValues to field "); // use Max value until "infinity" works myvalues = new AllowableRangeValues(Double.toString(min.get().value()), Double.toString(Double.MAX_VALUE)); } else if (max.isPresent()) { // use Min value until "infinity" works LOG.debug("@Max detected: adding AllowableRangeValues to field "); myvalues = new AllowableRangeValues(Double.toString(Double.MIN_VALUE), Double.toString(max.get().value())); }/* w w w .j a va 2 s. c o m*/ return myvalues; }
From source file:edu.stanford.cfuller.imageanalysistools.fitting.BisquareLinearFit.java
/** * Performs a robust least squares fit with bisquare weights to the supplied data. * * @param indVarValues A RealVector containing the values of the independent variable. * @param depVarValues A RealVector containing the values of the dependent variable. * @return a RealVector containing two elements: the slope of the fit and the y-intercept of the fit. *///from ww w . j a v a 2 s . c om public RealVector fit(RealVector indVarValues, RealVector depVarValues) { RealVector uniformWeights = new ArrayRealVector(indVarValues.getDimension(), 1.0); RealVector lastParams = new ArrayRealVector(2, Double.MAX_VALUE); RealVector currParams = wlsFit(indVarValues, depVarValues, uniformWeights); RealVector weights = uniformWeights; RealVector leverages = this.calculateLeverages(indVarValues); int c = 0; double norm_mult = 1.0; if (!this.noIntercept) { norm_mult = 2.0; } int maxiter = 10000; while (lastParams.subtract(currParams).getNorm() > CONV_NORM * norm_mult && c++ < maxiter) { lastParams = currParams; RealVector stdAdjR = this.calculateStandardizedAdjustedResiduals(indVarValues, depVarValues, leverages, currParams); weights = calculateBisquareWeights(stdAdjR); currParams = wlsFit(indVarValues, depVarValues, weights); } return currParams; }
From source file:fr.ens.transcriptome.corsen.gui.qt.ResultGraphs.java
private static final double getMin(final double[] array) { double min = Double.MAX_VALUE; if (array == null) return min; for (int i = 0; i < array.length; i++) if (array[i] < min) min = array[i];//from w ww . j a v a 2 s . c o m return min; }
From source file:com.sillelien.dollar.api.types.DollarInfinity.java
@NotNull @Override public Number toNumber() { return positive ? Double.MAX_VALUE : Double.MIN_VALUE; }
From source file:gov.va.isaac.gui.preferences.PreferencesViewController.java
@FXML void initialize() { assert tabPane_ != null : "fx:id=\"tabPane\" was not injected: check your FXML file 'PreferencesView.fxml'."; assert okButton_ != null : "fx:id=\"okButton\" was not injected: check your FXML file 'PreferencesView.fxml'."; assert cancelButton_ != null : "fx:id=\"cancelButton_\" was not injected: check your FXML file 'PreferencesView.fxml'."; tabPane_.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); tabPane_.setMaxWidth(Double.MAX_VALUE); okButton_.setOnAction((e) -> saveAndExitIfSuccessful()); cancelButton_.setOnAction((e) -> stage_.close()); }
From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java
/** * Setup an 'EXCLAMATION' error marker on the component. Automatically displays anytime that the reasonWhyControlInvalid value * is false. Hides when the isControlCurrentlyValid is true. * @param stackPane - optional - created if necessary *//*w w w . j a v a2 s. c om*/ public static StackPane setupErrorMarker(Node initialNode, StackPane stackPane, ValidBooleanBinding isNodeCurrentlyValid) { ImageView exclamation = Images.EXCLAMATION.createImageView(); if (stackPane == null) { stackPane = new StackPane(); } exclamation.visibleProperty().bind(isNodeCurrentlyValid.not()); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(isNodeCurrentlyValid.getReasonWhyInvalid()); Tooltip.install(exclamation, tooltip); tooltip.setAutoHide(true); exclamation.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { tooltip.show(exclamation, event.getScreenX(), event.getScreenY()); } }); stackPane.setMaxWidth(Double.MAX_VALUE); stackPane.getChildren().add(initialNode); StackPane.setAlignment(initialNode, Pos.CENTER_LEFT); stackPane.getChildren().add(exclamation); StackPane.setAlignment(exclamation, Pos.CENTER_RIGHT); double insetFromRight; if (initialNode instanceof ComboBox) { insetFromRight = 30.0; } else if (initialNode instanceof ChoiceBox) { insetFromRight = 25.0; } else { insetFromRight = 5.0; } StackPane.setMargin(exclamation, new Insets(0.0, insetFromRight, 0.0, 0.0)); return stackPane; }
From source file:emlab.role.market.SubmitBidsToCommodityMarketRole.java
@Transactional public void act(EnergyProducer producer) { logger.info("Purchasing commodities"); HashMap<Substance, Double> fuelAmounts = new HashMap<Substance, Double>(); for (PowerPlant plant : reps.powerPlantRepository.findOperationalPowerPlantsByOwner(producer, getCurrentTick())) {/*w w w. jav a2 s.co m*/ double totalSupply = plant.calculateElectricityOutputAtTime(getCurrentTick()); for (SubstanceShareInFuelMix share : plant.getFuelMix()) { double amount = share.getShare() * totalSupply; Substance substance = share.getSubstance(); // already in? Than add to total if (fuelAmounts.containsKey(substance)) { amount += fuelAmounts.get(substance); } fuelAmounts.put(substance, amount); } } for (Substance substance : fuelAmounts.keySet()) { // find the totals and the right market. Place one bid for each // substance (fuel) if (!fuelAmounts.get(substance).isNaN() && fuelAmounts.get(substance) > 0) { Bid bid = reps.nonTransactionalCreateRepository.submitBidToMarket( reps.marketRepository.findFirstMarketBySubstance(substance), producer, getCurrentTick(), false, Double.MAX_VALUE, fuelAmounts.get(substance)); logger.info("Submited bid " + bid); } } }
From source file:net.sf.jabref.importer.fetcher.DBLPFetcher.java
@Override public boolean processQuery(String newQuery, ImportInspector inspector, OutputPrinter status) { final HashMap<String, Boolean> bibentryKnown = new HashMap<>(); boolean res = false; this.query = newQuery; shouldContinue = true;/*w ww. j a va 2s . com*/ // we save the duplicate check threshold // we need to overcome the "smart" approach of this heuristic // and we will set it back afterwards, so maybe someone is happy again double saveThreshold = DuplicateCheck.duplicateThreshold; try { String address = makeSearchURL(); URLDownload dl = new URLDownload(address); String page = dl.downloadToString(Globals.prefs.getDefaultEncoding()); String[] lines = page.split("\n"); List<String> bibtexUrlList = new ArrayList<>(); for (final String line : lines) { if (line.startsWith("\"url\"")) { String addr = line.replace("\"url\":\"", ""); addr = addr.substring(0, addr.length() - 2); bibtexUrlList.add(addr); } } DuplicateCheck.duplicateThreshold = Double.MAX_VALUE; // 2014-11-08 // DBLP now shows the BibTeX entry using ugly HTML entities // but they also offer the download of a bib file // we find this in the page which we get from "url" // and this bib file is then in "biburl" int count = 1; for (String urlStr : bibtexUrlList) { if (!shouldContinue) { break; } final String bibtexHTMLPage = new URLDownload(urlStr) .downloadToString(Globals.prefs.getDefaultEncoding()); final String[] htmlLines = bibtexHTMLPage.split("\n"); for (final String line : htmlLines) { if (line.contains("biburl")) { int sidx = line.indexOf('{'); int eidx = line.indexOf('}'); // now we take everything within the curly braces String bibtexUrl = line.substring(sidx + 1, eidx); // we do not access dblp.uni-trier.de as they will complain bibtexUrl = bibtexUrl.replace("dblp.uni-trier.de", "www.dblp.org"); final String bibtexPage = new URLDownload(bibtexUrl) .downloadToString(Globals.prefs.getDefaultEncoding()); Collection<BibEntry> bibtexEntries = BibtexParser.fromString(bibtexPage); for (BibEntry be : bibtexEntries) { if (!bibentryKnown.containsKey(be.getCiteKey())) { inspector.addEntry(be); bibentryKnown.put(be.getCiteKey(), true); } } } } inspector.setProgress(count, bibtexUrlList.size()); count++; } // everything went smooth res = true; } catch (IOException e) { LOGGER.warn("Communcation problems", e); status.showMessage(e.getMessage()); } finally { // Restore the threshold DuplicateCheck.duplicateThreshold = saveThreshold; } return res; }
From source file:com.almende.eve.algorithms.DAAValueBean.java
/** * Generate the random array to represent this value;. * * @param value/*from w ww . j av a2 s .co m*/ * the value * @return the value bean */ public DAAValueBean generate(final double value) { if (value <= 0.0) { Arrays.fill(valueArray, Double.MAX_VALUE); } else { for (int i = 0; i < width; i++) { Double expRand = -Math.log(Math.random()) / value; valueArray[i] = expRand; } // Noise cancelation: final Double mean = computeMean(); final Double goal = 1.0 / value; offset = goal / mean; for (int i = 0; i < width; i++) { valueArray[i] = valueArray[i] * offset; } } return this; }
From source file:com.chinamobile.bcbsp.examples.kmeans.KMeansBSP.java
@Override public void compute(Iterator<BSPMessage> messages, BSPStaffContextInterface context) throws Exception { jobconf = context.getJobConf();/*from w ww . ja v a 2 s. c o m*/ superStepCount = context.getCurrentSuperStepCounter(); ArrayList<Float> thisPoint = new ArrayList<Float>(); KMVertex thisVertex = (KMVertex) context.getVertex(); Iterator<Edge> outgoingEdges = context.getOutgoingEdges(); // Init this point while (outgoingEdges.hasNext()) { KMEdge edge = (KMEdge) outgoingEdges.next(); thisPoint.add(Float.valueOf(edge.getEdgeValue())); } // Calculate the class tag of this vertex. byte tag = 0; double minDistance = Double.MAX_VALUE; // Find the shortest distance of this point with the kCenters. for (byte i = 0; i < kCenters.size(); i++) { ArrayList<Float> center = kCenters.get(i); double dist = distanceOf(thisPoint, center); if (dist < minDistance) { tag = i; minDistance = dist; } } // Write the vertex's class tag into the vertex value. thisVertex.setVertexValue(tag); context.updateVertex(thisVertex); if (this.errors < this.errorsThreshold) { context.voltToHalt(); } }