List of usage examples for java.lang Double MIN_VALUE
double MIN_VALUE
To view the source code for java.lang Double MIN_VALUE.
Click Source Link
From source file:org.bitpipeline.lib.friendlyjson.JSONEntityTest.java
@Test public void testJSonSerialization() throws JSONMappingException, JSONException { Entity orig = createEntity(); JSONObject json = orig.toJson();/*from w ww. java 2s .c om*/ assertNotNull(json); Entity copy = new Entity(json); assertNotNull(copy); assertEquals(orig.aBoolean, copy.aBoolean); assertEquals(orig.aByte, copy.aByte); assertEquals(orig.aChar, copy.aChar); assertEquals(orig.aShort, copy.aShort); assertEquals(orig.aInt, copy.aInt); assertEquals(orig.aLong, copy.aLong); assertEquals(orig.aFloat, copy.aFloat, Float.MIN_VALUE * 10.0f); assertEquals(orig.aDouble, copy.aDouble, Double.MIN_VALUE * 10.0); assertEquals(orig.aString, copy.aString); assertFalse(orig.transientValue == copy.transientValue); assertNotNull(copy.aMap); for (String key : orig.aMap.keySet()) { assertEquals(orig.aMap.get(key), copy.aMap.get(key)); } assertNotNull(copy.aMapOfLists); for (String key : orig.aMapOfLists.keySet()) { assertEquals(orig.aMapOfLists.get(key), copy.aMapOfLists.get(key)); } assertNotNull(copy.xptos); assertEquals(copy.xptos.size(), orig.xptos.size()); for (Xpto x : orig.xptos) { boolean found = false; for (Xpto y : copy.xptos) if (x.getName().equals(y.getName())) found = true; assertTrue(found); } assertEquals(orig.toString(), copy.toString()); }
From source file:etomica.math.SpecialFunctions.java
private static double gcf(double a, double x) { int imax = 500; double epsilon = 3.0e-12; double b = x + 1.0 - a; double c = 1.0 / Double.MIN_VALUE; double d = 1.0 / b; double h = d; for (int i = 0; i <= imax; i++) { double an = -i * (i - a); b += 2.0;// ww w. j a v a2s .com d = an * d + b; if (Math.abs(d) < Double.MIN_VALUE) d = Double.MIN_VALUE; c = b + an / c; if (Math.abs(c) < Double.MIN_VALUE) c = Double.MIN_VALUE; d = 1.0 / d; double del = d * c; h *= del; if (Math.abs(del - 1.0) < epsilon) break; } return Math.exp(-x + a * Math.log(x) - lnGamma(a)) * h; }
From source file:org.tinymediamanager.ui.panels.MediaScraperConfigurationPanel.java
private JPanel createConfigPanel() { JPanel panel = new JPanel(); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0 }; gridBagLayout.rowHeights = new int[] { 0 }; gridBagLayout.columnWeights = new double[] { Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { Double.MIN_VALUE }; panel.setLayout(gridBagLayout);//from www . j a v a 2s .c o m GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = 0; // build up the panel for being displayed in the popup MediaProviderConfig config = mediaProvider.getProviderInfo().getConfig(); for (Entry<String, MediaProviderConfigObject> entry : config.getConfigObjects().entrySet()) { if (!entry.getValue().isVisible()) { continue; } constraints.anchor = GridBagConstraints.LINE_START; constraints.ipadx = 20; // label JLabel label = new JLabel(entry.getValue().getKeyDescription()); constraints.gridx = 0; panel.add(label, constraints); JComponent comp; switch (entry.getValue().getType()) { case BOOL: // display as checkbox JCheckBox checkbox = new JCheckBox(); checkbox.setSelected(entry.getValue().getValueAsBool()); checkbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dirty = true; } }); comp = checkbox; break; case SELECT: case SELECT_INDEX: // display as combobox JComboBox<String> combobox = new JComboBox<>( entry.getValue().getPossibleValues().toArray(new String[0])); combobox.setSelectedItem(entry.getValue().getValueAsString()); combobox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dirty = true; } }); comp = combobox; break; default: // display as text JTextField tf; if (entry.getValue().isEncrypt()) { tf = new JPasswordField(config.getValue(entry.getKey())); } else { tf = new JTextField(config.getValue(entry.getKey())); } tf.setPreferredSize(new Dimension(100, 24)); tf.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { dirty = true; } @Override public void insertUpdate(DocumentEvent e) { dirty = true; } @Override public void changedUpdate(DocumentEvent e) { dirty = true; } }); comp = tf; break; } comp.putClientProperty(entry.getKey(), entry.getKey()); constraints.ipadx = 0; constraints.gridx = 1; panel.add(comp, constraints); // add a hint if a long text has been found try { String desc = BUNDLE.getString( "scraper." + mediaProvider.getProviderInfo().getId() + "." + entry.getKey() + ".desc"); //$NON-NLS-1$ if (StringUtils.isNotBlank(desc)) { JLabel lblHint = new JLabel(IconManager.HINT); lblHint.setToolTipText(desc); constraints.gridx = 2; panel.add(lblHint, constraints); } } catch (Exception ignored) { } constraints.gridy++; } return panel; }
From source file:uk.ac.babraham.BamQC.Graphs.ScatterGraph.java
private void initialise(double[] data, double[] xCategories, String[] toolTipLabels, String xLabel, String yLabel, String graphTitle) { this.data = data; this.xCategories = xCategories; this.toolTipLabels = toolTipLabels; this.xLabel = xLabel; this.yLabel = yLabel; this.graphTitle = graphTitle; // calculate minX-maxX, minY-maxY and xInterval-yInterval double[] minmax = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; calculateMinMax(this.data, minmax); minY = minmax[0];/*from ww w.ja v a2 s .c om*/ maxY = minmax[1] + minmax[1] * 0.1; // let's give some extra 10% space yInterval = findOptimalYInterval(maxY); minmax = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; calculateMinMax(this.xCategories, minmax); minX = minmax[0]; maxX = minmax[1] + minmax[1] * 0.1; // let's give some extra 10% space xInterval = findOptimalYInterval(maxX); // TOOL TIPS management label.setHorizontalAlignment(JLabel.CENTER); label.setOpaque(true); label.setBackground(Color.WHITE); label.setBorder(UIManager.getBorder("ToolTip.border")); if (!GraphicsEnvironment.isHeadless()) { toolTip = new JWindow(); toolTip.add(label); // Tool tips tipster = new Tipster(this); addMouseMotionListener(tipster); } setOpaque(true); }
From source file:com.act.lcms.db.analysis.HitOrMissReplicateFilterAndTransformer.java
/** * This function takes in a list of molecules from multiple replicates over the same time and alignes the peaks across * these replicates. If the peaks can be aligned, the function reports the min statistic across those peaks, else it * defaults to a low statistic.//from w w w.j a v a2 s. com * @param oneOrMoreReplicates * @return A pair of transformed HitOrMiss molecule and whether to save the result in the final model. */ public Pair<IonAnalysisInterchangeModel.HitOrMiss, Boolean> apply( List<IonAnalysisInterchangeModel.HitOrMiss> oneOrMoreReplicates) { List<Double> intensityValues = oneOrMoreReplicates.stream().map(molecule -> molecule.getIntensity()) .collect(Collectors.toList()); List<Double> snrValues = oneOrMoreReplicates.stream().map(molecule -> molecule.getSnr()) .collect(Collectors.toList()); List<Double> timeValues = oneOrMoreReplicates.stream().map(molecule -> molecule.getTime()) .collect(Collectors.toList()); IonAnalysisInterchangeModel.HitOrMiss result = new IonAnalysisInterchangeModel.HitOrMiss(); result.setInchi(oneOrMoreReplicates.get(REPRESENTATIVE_INDEX).getInchi()); result.setIon(oneOrMoreReplicates.get(REPRESENTATIVE_INDEX).getIon()); result.setPlot(NIL_PLOT); // We get the min and max time to calculate how much do the replicates deviate in time for the same signal. If // the deviation in the time axis is greater than our tolerance, we know the signal is bad. Double minTime = timeValues.stream().reduce(Double.MAX_VALUE, (accum, newVal) -> Math.min(accum, newVal)); Double maxTime = timeValues.stream().reduce(Double.MIN_VALUE, (accum, newVal) -> Math.max(accum, newVal)); if (maxTime - minTime < TIME_TOLERANCE_IN_SECONDS) { Double minIntensity = intensityValues.stream().reduce(Double.MAX_VALUE, (accum, newVal) -> Math.min(accum, newVal)); Integer indexOfMinIntensityReplicate = intensityValues.indexOf(minIntensity); // The SNR and Time values will be the copy of the replicate with the lowest intensity value. result.setSnr(snrValues.get(indexOfMinIntensityReplicate)); result.setIntensity(minIntensity); result.setTime(timeValues.get(indexOfMinIntensityReplicate)); return Pair.of(result, DO_NOT_THROW_OUT_MOLECULE); } else { // TODO: We can just throw out such molecules. result.setSnr(LOWEST_POSSIBLE_VALUE_FOR_PEAK_STATISTIC); result.setIntensity(LOWEST_POSSIBLE_VALUE_FOR_PEAK_STATISTIC); result.setTime(LOWEST_POSSIBLE_VALUE_FOR_PEAK_STATISTIC); return Pair.of(result, DO_NOT_THROW_OUT_MOLECULE); } }
From source file:com.nridge.core.io.gson.RangeJSON.java
/** * Parses an JSON stream and loads it into a field range. * * @param aReader Json reader stream instance. * * @throws java.io.IOException I/O related exception. *///from w w w .ja v a 2 s . c o m public FieldRange load(JsonReader aReader) throws IOException { String jsonName; boolean isFirst = true; Date firstDate = new Date(); long firstLong = Long.MIN_VALUE; int firstInt = Integer.MIN_VALUE; double firstDouble = Double.MIN_VALUE; Field.Type rangeType = Field.Type.Text; FieldRange fieldRange = new FieldRange(); aReader.beginObject(); while (aReader.hasNext()) { jsonName = aReader.nextName(); if (StringUtils.equals(jsonName, IO.JSON_TYPE_MEMBER_NAME)) rangeType = Field.stringToType(aReader.nextString()); else if (StringUtils.equals(jsonName, IO.JSON_DELIMITER_MEMBER_NAME)) fieldRange.setDelimiterChar(aReader.nextString()); else if (StringUtils.equals(jsonName, IO.JSON_VALUE_MEMBER_NAME)) fieldRange.setItems(StrUtl.expandToList(aReader.nextString(), fieldRange.getDelimiterChar())); else if (StringUtils.equals(jsonName, "min")) { switch (rangeType) { case Long: if (isFirst) { isFirst = false; firstLong = aReader.nextLong(); } else fieldRange = new FieldRange(aReader.nextLong(), firstLong); break; case Integer: if (isFirst) { isFirst = false; firstInt = aReader.nextInt(); } else fieldRange = new FieldRange(aReader.nextInt(), firstInt); break; case Double: if (isFirst) { isFirst = false; firstDouble = aReader.nextDouble(); } else fieldRange = new FieldRange(aReader.nextDouble(), firstDouble); break; case DateTime: if (isFirst) { isFirst = false; firstDate = Field.createDate(aReader.nextString()); } else fieldRange = new FieldRange(Field.createDate(aReader.nextString()), firstDate); break; default: aReader.skipValue(); break; } } else if (StringUtils.equals(jsonName, "max")) { switch (rangeType) { case Long: if (isFirst) { isFirst = false; firstLong = aReader.nextLong(); } else fieldRange = new FieldRange(firstLong, aReader.nextLong()); break; case Integer: if (isFirst) { isFirst = false; firstInt = aReader.nextInt(); } else fieldRange = new FieldRange(firstInt, aReader.nextInt()); break; case Double: if (isFirst) { isFirst = false; firstDouble = aReader.nextDouble(); } else fieldRange = new FieldRange(firstDouble, aReader.nextDouble()); break; case DateTime: if (isFirst) { isFirst = false; firstDate = Field.createDate(aReader.nextString()); } else fieldRange = new FieldRange(firstDate, Field.createDate(aReader.nextString())); break; default: aReader.skipValue(); break; } } else aReader.skipValue(); } aReader.endObject(); return fieldRange; }
From source file:com.smart.aqimonitor.client.AqiSettingDialog.java
/** * Create the dialog.//from w w w . j a v a2 s . co m */ public AqiSettingDialog(Frame owner, final AbstractAqiParser aqiParser) { super(owner); this.aqiParser = aqiParser; setTitle("\u8BBE\u7F6E"); setResizable(false); setBounds(100, 100, 450, 135); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 33, 48, 66, 41, 48, 66, 0, 0 }; gbl_contentPanel.rowHeights = new int[] { 21, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; contentPanel.setLayout(gbl_contentPanel); { JLabel lblRetryTimes = new JLabel("\u91CD\u8BD5\u6B21\u6570\uFF1A"); GridBagConstraints gbc_lblRetryTimes = new GridBagConstraints(); gbc_lblRetryTimes.anchor = GridBagConstraints.WEST; gbc_lblRetryTimes.insets = new Insets(0, 0, 5, 5); gbc_lblRetryTimes.gridx = 1; gbc_lblRetryTimes.gridy = 0; contentPanel.add(lblRetryTimes, gbc_lblRetryTimes); } { tfRetryTimes = new JTextField(); tfRetryTimes.setPreferredSize(new Dimension(6, 29)); tfRetryTimes.setMinimumSize(new Dimension(60, 29)); GridBagConstraints gbc_tfRetryTimes = new GridBagConstraints(); gbc_tfRetryTimes.anchor = GridBagConstraints.NORTHWEST; gbc_tfRetryTimes.insets = new Insets(0, 0, 5, 5); gbc_tfRetryTimes.gridx = 2; gbc_tfRetryTimes.gridy = 0; contentPanel.add(tfRetryTimes, gbc_tfRetryTimes); tfRetryTimes.setColumns(10); } { JLabel lblRetryGap = new JLabel("\u91CD\u8BD5\u95F4\u9694\uFF1A"); GridBagConstraints gbc_lblRetryGap = new GridBagConstraints(); gbc_lblRetryGap.anchor = GridBagConstraints.WEST; gbc_lblRetryGap.insets = new Insets(0, 0, 5, 5); gbc_lblRetryGap.gridx = 4; gbc_lblRetryGap.gridy = 0; contentPanel.add(lblRetryGap, gbc_lblRetryGap); } { tfRetryGap = new JTextField(); tfRetryGap.setMinimumSize(new Dimension(60, 29)); tfRetryGap.setPreferredSize(new Dimension(60, 29)); GridBagConstraints gbc_tfRetryGap = new GridBagConstraints(); gbc_tfRetryGap.insets = new Insets(0, 0, 5, 5); gbc_tfRetryGap.anchor = GridBagConstraints.NORTHWEST; gbc_tfRetryGap.gridx = 5; gbc_tfRetryGap.gridy = 0; contentPanel.add(tfRetryGap, gbc_tfRetryGap); tfRetryGap.setColumns(10); } { JLabel label = new JLabel("\u5206\u949F"); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.insets = new Insets(0, 0, 5, 0); gbc_label.gridx = 6; gbc_label.gridy = 0; contentPanel.add(label, gbc_label); } { JLabel lblExportPath = new JLabel("\u8F93\u51FA\u8DEF\u5F84\uFF1A"); GridBagConstraints gbc_lblExportPath = new GridBagConstraints(); gbc_lblExportPath.anchor = GridBagConstraints.EAST; gbc_lblExportPath.insets = new Insets(0, 0, 0, 5); gbc_lblExportPath.gridx = 1; gbc_lblExportPath.gridy = 1; contentPanel.add(lblExportPath, gbc_lblExportPath); } { tfExportPath = new JTextField(); tfExportPath.setEditable(false); tfExportPath.setPreferredSize(new Dimension(180, 29)); tfExportPath.setMinimumSize(new Dimension(180, 29)); GridBagConstraints gbc_tfExportPath = new GridBagConstraints(); gbc_tfExportPath.gridwidth = 4; gbc_tfExportPath.insets = new Insets(0, 0, 0, 5); gbc_tfExportPath.fill = GridBagConstraints.HORIZONTAL; gbc_tfExportPath.gridx = 2; gbc_tfExportPath.gridy = 1; contentPanel.add(tfExportPath, gbc_tfExportPath); tfExportPath.setColumns(10); } { JButton button = new JButton("..."); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fDialog = new JFileChooser(); // fDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fDialog.showOpenDialog(contentPanel); if (result == JFileChooser.APPROVE_OPTION) { tfExportPath.setText(fDialog.getSelectedFile().getAbsolutePath()); } } }); GridBagConstraints gbc_button = new GridBagConstraints(); gbc_button.gridx = 6; gbc_button.gridy = 1; contentPanel.add(button, gbc_button); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("\u786E\u5B9A"); okButton.setName("settingOk"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String retryTimes = tfRetryTimes.getText(); if (StringUtils.isEmpty(retryTimes) || !isNumeric(retryTimes)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } String retryGap = tfRetryGap.getText(); if (StringUtils.isEmpty(retryGap) || !isNumeric(retryGap)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } String exportPath = tfExportPath.getText(); if (StringUtils.isEmpty(exportPath)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } File testFile = new File(exportPath); if (!testFile.exists()) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } props.put("query.retryTimes", retryTimes); props.put("query.retryGap", retryGap); props.put("result.path", exportPath); try { props.store(new FileOutputStream(propertiesResource.getFile()), ""); aqiParser.setRetryTimes(Integer.parseInt(retryTimes)); aqiParser.setRetryGap(Integer.parseInt(retryGap)); aqiParser.setFilePath(exportPath); } catch (IOException e1) { e1.printStackTrace(); } finally { dispose(); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("\u53D6\u6D88"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
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 ww w . ja v a 2s .co 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: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 w w w .j a v a 2s . c o m*/ } if (values[i] > max) { max = values[i]; } } _minValue = Double.valueOf(min); _maxValue = Double.valueOf(max); }
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 a v a 2 s .com*/ series1.add(vX, vY); min = (vY < min ? vY : min); max = (vY > max ? vY : max); } dataset.addSeries(series1); y.setRange(min - 1, max + 1); } }