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:com.panemu.tiwulfx.form.BaseControl.java
public BaseControl(String propertyName, E control) { this.inputControl = control; this.propertyName = propertyName; HBox.setHgrow(control, Priority.ALWAYS); setAlignment(Pos.CENTER_LEFT);//from www. java 2s. c o m control.setMaxWidth(Double.MAX_VALUE); control.setMinHeight(USE_PREF_SIZE); getChildren().add(control); getChildren().add(imagePlaceHolder); required.addListener(imageListener); valid.addListener(imageListener); this.getStyleClass().add("form-control"); value = new SimpleObjectProperty<>(); bindValuePropertyWithControl(control); bindEditablePropertyWithControl(control); addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getEventType() == MouseEvent.MOUSE_MOVED && !isValid() && !getPopup().isShowing()) { Point2D p = BaseControl.this.localToScene(0.0, 0.0); getPopup().show(BaseControl.this, p.getX() + getScene().getX() + getScene().getWindow().getX(), p.getY() + getScene().getY() + getScene().getWindow().getY() + getInputComponent().getHeight() - 1); } else if (event.getEventType() == MouseEvent.MOUSE_EXITED && getPopup().isShowing()) { getPopup().hide(); } } }); getInputComponent().addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { if (!isValid() && getPopup().isShowing()) { getPopup().hide(); } } }); }
From source file:gov.va.isaac.gui.listview.operations.RefsetValueUtils.java
protected RefsetValueUtils(boolean indent) { if (indent) { refsetTypeLabel_.setPadding(new Insets(0, 0, 0, 10)); valueLabel_.setPadding(new Insets(0, 0, 0, 10)); }/* www.j a va 2s . c o m*/ booleanValue_.getItems().add("True"); booleanValue_.getItems().add("False"); booleanValue_.getSelectionModel().select(0); for (RefsetType rt : RefsetType.values()) { refsetType_.getItems().add(rt); } refsetType_.getSelectionModel().select(0); swappable.getChildren().add(booleanValue_); booleanValue_.setMaxWidth(Double.MAX_VALUE); swappable.getChildren().add(conceptValue_.getNode()); swappable.getChildren().add(wrappedStringOrIntegerValue_); stringOrIntegerValue_.setMaxWidth(Double.MAX_VALUE); isValid_ = new UpdateableBooleanBinding() { { setComputeOnInvalidate(true); } @Override protected boolean computeValue() { if (refsetType_.getValue() == RefsetType.rfConcept) { return conceptValue_.isValid().get(); } else if (refsetType_.getValue() == RefsetType.rfInteger || refsetType_.getValue() == RefsetType.rfString) { if (StringUtils.isBlank(stringOrIntegerValue_.getText())) { stringOrIntegerErrorMessage_ .set(refsetType_.getValue() == RefsetType.rfInteger ? "An integer must be provided" : "A String must be provided"); return false; } if (refsetType_.getValue() == RefsetType.rfInteger) { try { Integer.parseInt(stringOrIntegerValue_.getText()); stringOrIntegerErrorMessage_.set(""); return true; } catch (NumberFormatException e) { stringOrIntegerErrorMessage_.set("The value must be an integer"); return false; } } else if (refsetType_.getValue() == RefsetType.rfString) { stringOrIntegerErrorMessage_.set(""); return true; } else { LoggerFactory.getLogger(this.getClass()).error("Design error!"); return false; } } else if (refsetType_.getValue() == RefsetType.rfBoolean) { return true; } else { LoggerFactory.getLogger(this.getClass()).error("Design error!"); return false; } } }; refsetType_.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { isValid_.clearBindings(); booleanValue_.setVisible(false); conceptValue_.getNode().setVisible(false); wrappedStringOrIntegerValue_.setVisible(false); if (refsetType_.getValue() == RefsetType.rfString || refsetType_.getValue() == RefsetType.rfInteger) { isValid_.addBinding(stringOrIntegerValue_.textProperty()); valueLabel_.setText( refsetType_.getValue() == RefsetType.rfString ? "String value" : "Integer value"); wrappedStringOrIntegerValue_.setVisible(true); } else if (refsetType_.getValue() == RefsetType.rfConcept) { isValid_.addBinding(conceptValue_.isValid()); valueLabel_.setText("Concept value"); conceptValue_.getNode().setVisible(true); } else if (refsetType_.getValue() == RefsetType.rfBoolean) { valueLabel_.setText("Boolean value"); booleanValue_.setVisible(true); } else { LoggerFactory.getLogger(this.getClass()).error("Design error!"); } isValid_.invalidate(); } }); refsetType_.getSelectionModel().select(1); }
From source file:com.genentech.chemistry.openEye.apps.SdfRMSDSphereExclusion.java
private void run(String inFile) { oemolithread ifs = new oemolithread(inFile); long start = System.currentTimeMillis(); int iCounter = 0; //Structures in the SD file. int oCounter = 0; String lastGroupByValue = "Gliberich not found in file"; OEMolBase mol = new OEGraphMol(); inLoop: while (oechem.OEReadMolecule(ifs, mol)) { iCounter++;//from w w w .j av a 2 s .com //Output "." to show that the program is running. if (iCounter % 100 == 0) System.err.print("."); if (iCounter % 4000 == 0) System.err.printf(" %d %dsec\n", iCounter, (System.currentTimeMillis() - start) / 1000); double minRMSD = Double.MAX_VALUE; if (groupByTag != null) { // check if a new group starts here and clear sleected if that is the case String groupByVal = oechem.OEGetSDData(mol, groupByTag); if (!groupByVal.equals(lastGroupByValue)) clearSelected(); lastGroupByValue = groupByVal; } OEMolBase mirMol = null; if (doMirror && selected.size() == 0 && !isChiral(mol)) { mirMol = new OEGraphMol(mol); createMirror(mirMol); } for (int i = selected.size() - 1; i >= 0; i--) { double rmsd = oechem.OERMSD(mol, selected.get(i), true, true, doOptimize); if (rmsd < 0D) System.err.println("OERMSD returned -1 are you comparing two different structures?"); if (mirMol != null) { double mirRmsd = oechem.OERMSD(mirMol, selected.get(i), true, true, doOptimize); if (mirRmsd < rmsd) rmsd = mirRmsd; } if (rmsd < radius) { if (printAll) { oechem.OESetSDData(mol, "sphereIdx", Integer.toString(i)); oechem.OESetSDData(mol, "centroidRMSD", DataFormat.formatNumber(rmsd, "si3")); oechem.OEWriteMolecule(outputOEThread, mol); } continue inLoop; } if (rmsd < minRMSD) minRMSD = rmsd; } oechem.OESetSDData(mol, "sphereIdx", Integer.toString(selected.size())); oechem.OESetSDData(mol, "includeIdx", Integer.toString(selected.size())); oechem.OESetSDData(mol, "centroidRMSD", "0"); selected.add(new OEGraphMol(mol)); oechem.OEWriteMolecule(outputOEThread, mol); if (mirMol != null) mirMol.delete(); oCounter++; } mol.delete(); ifs.close(); ifs.delete(); inFile = inFile.replaceAll(".*" + Pattern.quote(File.separator), ""); System.err.printf("%s: Read %d structures from %s. Written %d centroids in %d sec\n", MY_NAME, iCounter, inFile, oCounter, (System.currentTimeMillis() - start) / 1000); }
From source file:carskit.alg.cars.transformation.hybridfiltering.DCW.java
@Override protected void initModel() throws Exception { super.initModel(); userCorrs = buildCorrs(true);//w w w. j av a 2 s . c o m userMeans = new DenseVector(numUsers); for (int u = 0; u < numUsers; u++) { SparseVector uv = train.row(u); userMeans.set(u, uv.getCount() > 0 ? uv.mean() : globalMean); } num_dim = rateDao.numContextDims(); fitness_gbest = Double.MAX_VALUE; this.len = num_dim * num_component; pos_gbest = new DenseVector(len); swarm = new Particle_CFPSO[p]; for (int i = 0; i < p; ++i) swarm[i] = new Particle_CFPSO(len); }
From source file:com.panemu.tiwulfx.form.BaseListControl.java
public BaseListControl(String propertyName, E control) { this.inputControl = control; this.propertyName = propertyName; HBox.setHgrow(control, Priority.ALWAYS); setAlignment(Pos.CENTER_LEFT);/* ww w .ja v a 2 s .co m*/ control.setMaxWidth(Double.MAX_VALUE); control.setMinHeight(USE_PREF_SIZE); getChildren().add(control); getChildren().add(imagePlaceHolder); required.addListener(imageListener); valid.addListener(imageListener); this.getStyleClass().add("form-control"); value = new SimpleListProperty<>(); bindValuePropertyWithControl(control); bindEditablePropertyWithControl(control); addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getEventType() == MouseEvent.MOUSE_MOVED && !isValid() && !getPopup().isShowing()) { Point2D p = BaseListControl.this.localToScene(0.0, 0.0); getPopup().show(BaseListControl.this, p.getX() + getScene().getX() + getScene().getWindow().getX(), p.getY() + getScene().getY() + getScene().getWindow().getY() + getInputComponent().getHeight() - 1); } else if (event.getEventType() == MouseEvent.MOUSE_EXITED && getPopup().isShowing()) { getPopup().hide(); } } }); getInputComponent().addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { if (!isValid() && getPopup().isShowing()) { getPopup().hide(); } } }); }
From source file:ffx.numerics.ModifiedBessel.java
/** * Returns Double.MAX_VALUE in place of Double.POSITIVE_INFINITY; Returns * Double.MIN_VALUE in place of Double.NEGATIVE_INFINITY * * @param x input parameter// ww w .ja v a 2 s .co m * @return exp(x) */ private static double eToThe(double x) { double res = exp(x); if (res == Double.POSITIVE_INFINITY) { return Double.MAX_VALUE; } else if (res == Double.NEGATIVE_INFINITY) { return Double.MIN_VALUE; } return res; }
From source file:forge.limited.BoosterDraftAI.java
/** * <p>//w ww . j av a 2s . c om * Choose a CardPrinted from the list given. * </p> * * @param chooseFrom * List of CardPrinted * @param player * a int. * @return a {@link forge.item.PaperCard} object. */ public PaperCard choose(final List<PaperCard> chooseFrom, final int player) { if (ForgePreferences.DEV_MODE) { System.out.println("Player[" + player + "] pack: " + chooseFrom.toString()); } final DeckColors deckCols = this.playerColors.get(player); final ColorSet currentChoice = deckCols.getChosenColors(); final boolean canAddMoreColors = deckCols.canChoseMoreColors(); final List<Pair<PaperCard, Double>> rankedCards = rankCards(chooseFrom); for (final Pair<PaperCard, Double> p : rankedCards) { double valueBoost = 0; // If a card is not ai playable, somewhat decrease its rating if (p.getKey().getRules().getAiHints().getRemAIDecks()) { valueBoost = TAKE_BEST_THRESHOLD; } // if I cannot choose more colors, and the card cannot be played with chosen colors, decrease its rating. if (!canAddMoreColors && !p.getKey().getRules().getManaCost().canBePaidWithAvaliable(currentChoice.getColor())) { valueBoost = TAKE_BEST_THRESHOLD * 3; } if (valueBoost > 0) { p.setValue(p.getValue() + valueBoost); //System.out.println(p.getKey() + " is now " + p.getValue()); } } double bestRanking = Double.MAX_VALUE; PaperCard bestPick = null; final List<PaperCard> possiblePick = new ArrayList<PaperCard>(); for (final Pair<PaperCard, Double> p : rankedCards) { final double rating = p.getValue(); if (rating <= bestRanking + .01) { if (rating < bestRanking) { // found a better card start a new list possiblePick.clear(); bestRanking = rating; } possiblePick.add(p.getKey()); } } bestPick = Aggregates.random(possiblePick); if (canAddMoreColors) { deckCols.addColorsOf(bestPick); } System.out.println("Player[" + player + "] picked: " + bestPick + " ranking of " + bestRanking); this.deck.get(player).add(bestPick); return bestPick; }
From source file:co.turnus.common.util.CommonDataUtil.java
public static <T> double minOf(Map<T, StatisticalData> map) { double val = Double.MAX_VALUE; for (Entry<T, StatisticalData> s : map.entrySet()) { val = FastMath.min(val, s.getValue().getMin()); }/*from w ww . j a v a2 s . co m*/ return val; }
From source file:Main.java
@Override public void start(Stage primaryStage) { final Label label = new Label("Progress:"); final ProgressBar progressBar = new ProgressBar(0); final ProgressIndicator progressIndicator = new ProgressIndicator(0); final Button startButton = new Button("Start"); final Button cancelButton = new Button("Cancel"); final TextArea textArea = new TextArea(); startButton.setOnAction((ActionEvent event) -> { startButton.setDisable(true);//from w w w . ja v a 2 s . co m progressBar.setProgress(0); progressIndicator.setProgress(0); textArea.setText(""); cancelButton.setDisable(false); copyWorker = createWorker(numFiles); progressBar.progressProperty().unbind(); progressBar.progressProperty().bind(copyWorker.progressProperty()); progressIndicator.progressProperty().unbind(); progressIndicator.progressProperty().bind(copyWorker.progressProperty()); copyWorker.messageProperty().addListener( (ObservableValue<? extends String> observable, String oldValue, String newValue) -> { textArea.appendText(newValue + "\n"); }); new Thread(copyWorker).start(); }); cancelButton.setOnAction((ActionEvent event) -> { startButton.setDisable(false); cancelButton.setDisable(true); copyWorker.cancel(true); progressBar.progressProperty().unbind(); progressBar.setProgress(0); progressIndicator.progressProperty().unbind(); progressIndicator.setProgress(0); textArea.appendText("File transfer was cancelled."); }); BorderPane root = new BorderPane(); Scene scene = new Scene(root, 500, 250, javafx.scene.paint.Color.WHITE); FlowPane topPane = new FlowPane(5, 5); topPane.setPadding(new Insets(5)); topPane.setAlignment(Pos.CENTER); topPane.getChildren().addAll(label, progressBar, progressIndicator); GridPane middlePane = new GridPane(); middlePane.setPadding(new Insets(5)); middlePane.setHgap(20); middlePane.setVgap(20); ColumnConstraints column1 = new ColumnConstraints(300, 400, Double.MAX_VALUE); middlePane.getColumnConstraints().addAll(column1); middlePane.setAlignment(Pos.CENTER); middlePane.add(textArea, 0, 0); FlowPane bottomPane = new FlowPane(5, 5); bottomPane.setPadding(new Insets(5)); bottomPane.setAlignment(Pos.CENTER); bottomPane.getChildren().addAll(startButton, cancelButton); root.setTop(topPane); root.setCenter(middlePane); root.setBottom(bottomPane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:co.turnus.profiling.util.ProfilingWeightsEstimator.java
public ProfilingWeights estimate(ProfilingData data) { ProfilingFactory f = ProfilingFactory.eINSTANCE; ProfilingWeights netWeights = f.createProfilingWeights(); netWeights.setNetwork(data.getNetwork()); Table<Actor, Action, ActionProfilingData> table = data.asTable(); double networkCost = estimateNetworkCost(data); for (Actor actor : table.rowKeySet()) { ActorProfilingWeights actorWeights = f.createActorProfilingWeights(); actorWeights.setActor(actor);/* ww w . j a v a 2 s .c o m*/ double actorCost = 0; for (Entry<Action, ActionProfilingData> actionEntry : table.row(actor).entrySet()) { ActionProfilingData aData = actionEntry.getValue(); ActionProfilingWeights actionWeights = f.createActionProfilingWeights(); actionWeights.setAction(actionEntry.getKey()); EMap<Operator, StatisticalData> opsMap = aData.getOperatorsCall(); int samples = opsMap.size(); double mean = 0; double min = 0; double max = 0; double sum = 0; if (samples > 0) { min = Double.MAX_VALUE; max = Double.MIN_VALUE; for (Entry<Operator, StatisticalData> entry : opsMap.entrySet()) { double c = operatorsWeightMap.get(entry.getKey()); sum += c * entry.getValue().getMean(); min = FastMath.min(min, c * entry.getValue().getMin()); max = FastMath.max(max, c * entry.getValue().getMax()); } mean = sum / samples; } // set clock cycles actionWeights.setClockcycles(mean); actionWeights.setClockcyclesMin(min); actionWeights.setClockcyclesMax(max); // set workload actionWeights.setWorkload(sum / networkCost * 100); actorCost += sum; // finally, add it to the list actorWeights.getActionsWeights().add(actionWeights); } // set workload actorWeights.setWorkload(actorCost / networkCost * 100); // finally, add it to the list netWeights.getActorsWeights().add(actorWeights); } return netWeights; }