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:org.hbird.business.navigation.processors.orekit.RangeCalculator.java
void calculateMinAndMax(SpacecraftState startState, AbsoluteDate endDate, TopocentricFrame locationOnEarth, Frame inertialFrame, double calculationStep, ExtendedContactParameterRange range) throws OrekitException { double minRange = Double.MAX_VALUE; double maxRange = 0; SpacecraftState current = startState.shiftedBy(0.0D); // make a copy while (current.getDate().compareTo(endDate) < 0) { double currentRange = calculateRang(current, locationOnEarth, inertialFrame); maxRange = Math.max(maxRange, currentRange); minRange = Math.min(minRange, currentRange); current = current.shiftedBy(calculationStep); }/*from w w w. j a va 2 s .c o m*/ range.setMax(maxRange); range.setMin(minRange); }
From source file:com.github.lynxdb.server.core.aggregators.MimMax.java
@Override public TimeSerie downsample(TimeSerie _serie, long _period) { return doDownsampling(_serie, _period, new Aggregator.Reducer() { double max; @Override//ww w. java 2s. c o m public void update(Entry _entry) { if (_entry.getValue() > max) { max = _entry.getValue(); } } @Override public double result() { return max; } @Override public void reset() { max = -Double.MAX_VALUE; } }); }
From source file:es.udc.gii.common.eaf.plugin.multiobjective.crowding.ObjectiveSpaceCrowding.java
@Override public void calculate(List<NSGA2Individual> list) { /* Reset all crowding distances. */ resetCrowdingDistance(list);/* www .j a v a 2 s . co m*/ if (list == null || list.isEmpty()) { return; } /* Comparator. */ MinimizingObjectiveComparator<NSGA2Individual> comparator = new MinimizingObjectiveComparator<NSGA2Individual>(); /* Number of objectives. */ int nObjectives = list.get(0).getObjectives().size(); /* For each objective. */ for (int obj = 0; obj < nObjectives; obj++) { /* Set the objective to consider. */ comparator.setObjectiveIndex(obj); /* Sort individuals considering the objective above. */ try { Collections.sort(list, comparator); } catch (IllegalArgumentException ex) { System.out.println(list.get(0).getClass().getSimpleName()); ex.printStackTrace(); } /* Individuals on the boundaries have maximal crowding distance. */ NSGA2Individual firstInd = list.get(0); firstInd.setCrowdingDistance(Double.MAX_VALUE); NSGA2Individual lastInd = list.get(list.size() - 1); lastInd.setCrowdingDistance(Double.MAX_VALUE); double minValue = firstInd.getObjectives().get(obj); double maxValue = lastInd.getObjectives().get(obj); /* If there are diferent values, i.e. if there is some distance * between individuals in objective space. */ if (minValue != maxValue) { /* Calculate the increase of crowding distance for each individual. */ for (int i = 1; i < list.size() - 1; i++) { NSGA2Individual i0 = list.get(i); NSGA2Individual i1 = list.get(i - 1); NSGA2Individual i2 = list.get(i + 1); double delta = (i2.getObjectives().get(obj) - i1.getObjectives().get(obj)) / (maxValue - minValue); i0.increaseCrowdingDistance(delta); } } } for (int i = 1; i < list.size() - 1; i++) { NSGA2Individual ind = list.get(i); double cd = ind.getCrowdingDistance() / (double) nObjectives; ind.setCrowdingDistance(cd); } }
From source file:Statistics.java
public void calc() { if (dirty) {/*from w w w . j ava2 s . co m*/ double n = (double) data.size(); max = Double.MIN_VALUE; min = Double.MAX_VALUE; sum = 0.0; variation = 0.0; for (double d : data) { sum += d; min = Math.min(d, min); max = Math.max(d, max); } average = sum / n; for (double d : data) { variation += Math.pow(d - average, 2.0); } variance = variation / n; // calculate median List<Double> copy = new ArrayList<Double>(data); Collections.sort(copy); if (copy.size() == 1) { median = copy.get(0); } else if ((copy.size() % 2) == 0) { median = copy.get(copy.size() / 2); } else { double v1 = copy.get(copy.size() / 2); double v2 = copy.get((copy.size() / 2) + 1); median = (v1 + v2) / 2.0; } } dirty = false; }
From source file:io.sidecar.notification.NotificationRule.java
public NotificationRule(UUID ruleId, String name, String description, UUID appId, UUID userId, String stream, String key, double min, double max) { this.ruleId = checkNotNull(ruleId); checkArgument(StringUtils.isNotBlank(name) && name.length() <= 100); this.name = name.trim(); checkArgument(StringUtils.isBlank(description) || description.length() <= 140); this.description = (description == null) ? "" : description.trim(); this.appId = checkNotNull(appId); this.userId = checkNotNull(userId); Preconditions.checkArgument(ModelUtils.isValidStreamId(stream)); this.stream = checkNotNull(stream); checkArgument(ModelUtils.isValidReadingKey(key)); this.key = key; this.min = (min == Double.NEGATIVE_INFINITY || min == Double.NaN) ? Double.MIN_VALUE : min; this.max = (max == Double.POSITIVE_INFINITY || max == Double.NaN) ? Double.MAX_VALUE : max; }
From source file:inflor.core.utils.PlotUtils.java
public static AbstractTransform createDefaultTransform(TransformType selectedType) { AbstractTransform newTransform = null; if (selectedType == TransformType.LINEAR || selectedType == TransformType.BOUNDARY) { newTransform = new BoundDisplayTransform(Double.MAX_VALUE, Double.MAX_VALUE); } else if (selectedType == TransformType.LOGARITHMIC) { newTransform = new LogrithmicTransform(1, 1000000); } else if (selectedType == TransformType.LOGICLE) { newTransform = new LogicleTransform(); } else {/*w w w. j a va 2 s . co m*/ // noop } return newTransform; }
From source file:com.basetechnology.s0.agentserver.field.MoneyField.java
public static Field fromJson(SymbolTable symbolTable, JSONObject fieldJson) { String type = fieldJson.optString("type"); if (type == null || !type.equals("money")) return null; String name = fieldJson.has("name") ? fieldJson.optString("name") : null; String label = fieldJson.has("label") ? fieldJson.optString("label") : null; String description = fieldJson.has("description") ? fieldJson.optString("description") : null; double defaultValue = fieldJson.has("default_value") ? fieldJson.optDouble("default_value") : 0; double minValue = fieldJson.has("min_value") ? fieldJson.optDouble("min_value") : Double.MIN_VALUE; double maxValue = fieldJson.has("max_value") ? fieldJson.optDouble("max_value") : Double.MAX_VALUE; int nominalWidth = fieldJson.has("nominal_width") ? fieldJson.optInt("nominal_width") : 0; String compute = fieldJson.has("compute") ? fieldJson.optString("compute") : null; return new MoneyField(symbolTable, name, label, description, defaultValue, minValue, maxValue, nominalWidth, compute);//from ww w . ja v a2s. c o m }
From source file:be.makercafe.apps.makerbench.editors.XMLEditor.java
public XMLEditor(String tabText, Path path) { super(tabText); 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("xml-highlighting.css").toExternalForm()); this.caCodeArea.textProperty().addListener((obs, oldText, newText) -> { this.caCodeArea.setStyleSpans(0, computeHighlighting(newText)); });//from w w w .j a v a2 s.com addContextMenu(this.caCodeArea); try { this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile())); } catch (IOException ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex); } BorderPane rootPane = new BorderPane(); toolBar = createToolBar(); rootPane.setTop(toolBar); rootPane.setCenter(caCodeArea); this.getTab().setContent(rootPane); }
From source file:classif.Majority.KMeansSymbolicSequence.java
public void cluster() { centers = new ClassedSequence[nbClusters]; affectation = new ArrayList[nbClusters]; // pickup centers int[] selected = randGen.nextPermutation(data.size(), nbClusters); for (int i = 0; i < selected.length; i++) { centers[i] = new ClassedSequence(data.get(selected[i]).sequence, data.get(selected[i]).classValue); }//from w w w .j a v a 2 s .c o m // for each iteration i for (int i = 0; i < 15; i++) { // init for (int k = 0; k < affectation.length; k++) { affectation[k] = new ArrayList<ClassedSequence>(); } // for each data point j for (int j = 0; j < data.size(); j++) { double minDist = Double.MAX_VALUE; // for each cluster k for (int k = 0; k < centers.length; k++) { // distance between cluster k and data point j double currentDist = centers[k].sequence.distance(data.get(j).sequence); if (currentDist < minDist) { clusterMap[j] = k; minDist = currentDist; } } // affect data point j to cluster affected to j affectation[clusterMap[j]].add(data.get(j)); } // redefine for (int j = 0; j < nbClusters; j++) { if (affectation[j].size() == 0) { centers[j] = null; } else { ArrayList<Sequence> copyaffectation = new ArrayList<Sequence>(); for (ClassedSequence eachClassedSequence : affectation[j]) { copyaffectation.add(eachClassedSequence.sequence); } centers[j].sequence = Sequences.mean(copyaffectation.toArray(new Sequence[0])); centers[j].classValue = MajorityClass(affectation[j]); } } } }
From source file:classif.kmedoid.KMedoidsSymbolicSequence.java
public void cluster() { // pickup centers int nbSelected = Math.min(data.size(), nbCluster); indexMedoids = randGen.nextPermutation(data.size(), nbSelected); nbCluster = nbSelected;//from w ww . j av a 2s .com double[][] distances = new double[data.size()][data.size()]; for (int i = 0; i < distances.length; i++) { for (int j = i + 1; j < distances[i].length; j++) { distances[i][j] = data.get(i).distance(data.get(j)); distances[j][i] = distances[i][j]; } } ArrayList<Sequence>[] affectation = new ArrayList[nbCluster]; // init for (int i = 0; i < affectation.length; i++) { affectation[i] = new ArrayList<Sequence>(); } boolean changed = true; // for each iteration i for (int i = 0; i < 150 && changed; i++) { changed = false; // System.out.println(i); // for each data point j for (int j = 0; j < data.size(); j++) { double minDist = Double.MAX_VALUE; // for each cluster k for (int k = 0; k < indexMedoids.length; k++) { if (indexMedoids[k] == -1) {// nothing in cluster k continue; } // distance between cluster k and data point j double currentDist = distances[indexMedoids[k]][j]; if (currentDist < minDist) { clusterMap[j] = k; minDist = currentDist; } } // affect data point j to cluster affected to j affectation[clusterMap[j]].add(data.get(j)); } // redefine for (int j = 0; j < nbCluster; j++) { int tmpIndex = Sequences.medoidIndex(affectation[j]); if (tmpIndex != indexMedoids[j]) { indexMedoids[j] = tmpIndex; changed = true; } } // reset affect for (int k = 0; k < affectation.length; k++) { affectation[k] = new ArrayList<Sequence>(); } } }