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:net.tourbook.photo.ImageGallery.java
/** * column: image direction degree/*from w ww . j a v a 2s . c om*/ */ private void defineColumn_ImageDirectionText() { final ColumnDefinition colDef = TableColumnFactory.PHOTO_FILE_IMAGE_DIRECTION_TEXT// .createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final Photo photo = (Photo) cell.getElement(); final double imageDirection = photo.getImageDirection(); if (imageDirection == Double.MIN_VALUE) { cell.setText(UI.EMPTY_STRING); } else { final int imageDirectionInt = (int) imageDirection; cell.setText(getDirectionText(imageDirectionInt)); } } }); }
From source file:br.fapesp.myutils.MyUtils.java
/** * Find the maximum value in the column of a matrix * /*from ww w .j a v a 2 s . c o m*/ * @param mat * @param col * @return */ public static double getMaxInCol(double[][] mat, int col) { double max = Double.MIN_VALUE; for (int i = 0; i < mat.length; i++) if (mat[i][col] > max) max = mat[i][col]; return max; }
From source file:com.rockhoppertech.music.midi.js.MIDITrack.java
public double getLongestDuration() { double longest = Double.MIN_VALUE; for (MIDINote n : notes) { double d = n.getDuration(); if (d > longest) { longest = d;// w w w. j av a 2 s .c o m } } return longest; }
From source file:edu.jhuapl.graphs.controller.GraphController.java
/** * The useItemColor is still under development to allow each bar to be a different color. *//* www . ja va2s .c om*/ private double setDataSeries(GraphDataInterface graphData, String displayKey, boolean useNoDataColor, List<DataSeries> dataSeries, LegendItemCollection legendItems, boolean useItemColor) { double[][] counts = graphData.getCounts(); int[][] colors = graphData.getColors(); String[][] altTexts = graphData.getAltTexts(); String[][] lineSetURLs = graphData.getLineSetURLs(); String[] xLabels = graphData.getXLabels(); String[] lineSetLabels = graphData.getLineSetLabels(); boolean[] displayAlerts = graphData.displayAlerts(); boolean[] displaySeverityAlerts = graphData.displaySeverityAlerts(); double[] lineSymbolSizes = graphData.getLineSymbolSizes(); Color[] graphBaseColors = graphData.getGraphBaseColors(); int displayKeyIndex = 0; double maxCount = 0; boolean singleAlertLegend = graphData.getShowSingleAlertLegend(); boolean singleSeverityLegend = graphData.getShowSingleSeverityLegend(); for (int i = 0; i < counts.length; i++) { String lineSetLabel = "series" + (i + 1); boolean displayAlert = false; boolean displaySeverityAlert = false; double lineSymbolSize = 7.0; try { lineSetLabel = lineSetLabels[i]; } catch (Exception e) { } try { displayAlert = displayAlerts[i]; } catch (Exception e) { } try { displaySeverityAlert = displaySeverityAlerts[i]; } catch (Exception e) { } try { lineSymbolSize = lineSymbolSizes[i]; } catch (Exception e) { } double xy = lineSymbolSize / 2.0 * -1; Color seriesColor = graphBaseColors[i % graphBaseColors.length]; boolean displayNormalData = displaySeries(displayKey, displayKeyIndex++) ? true : false; boolean displayWarningData = displayAlert && displaySeries(displayKey, displayKeyIndex++) ? true : false; boolean displayAlertData = displayAlert && displaySeries(displayKey, displayKeyIndex++) ? true : false; boolean displaySevereData = displaySeverityAlert && displaySeries(displayKey, displayKeyIndex++) ? true : false; List<DataPoint> points = new ArrayList<DataPoint>(); /** get graph data */ for (int j = 0; j < counts[i].length; j++) { boolean alertDataExists = false; String altText = null; String lineSetURL = null; int color = 1; try { altText = altTexts[i][j]; } catch (Exception e) { } try { lineSetURL = lineSetURLs[i][j]; } catch (Exception e) { } try { color = colors[i][j]; } catch (Exception e) { } Map<String, Object> pointMetaData = new HashMap<String, Object>(); pointMetaData.put(GraphSource.ITEM_TOOL_TIP, altText); pointMetaData.put(GraphSource.ITEM_URL, lineSetURL); pointMetaData.put(GraphSource.ITEM_SHAPE, new Ellipse2D.Double(xy, xy, lineSymbolSize, lineSymbolSize)); pointMetaData.put(GraphSource.ITEM_COLOR, seriesColor); // color 0 = GRAY (no data), color 2 = YELLOW (warning), 3 = RED (alert), // 4 = PURPLE (severe) if (useNoDataColor && color == 0) { pointMetaData.put(GraphSource.ITEM_COLOR, noDataColor); } else if (displayWarningData && color == 2) { alertDataExists = true; pointMetaData.put(GraphSource.ITEM_COLOR, warningDataColor); } else if (displayAlertData && color == 3) { alertDataExists = true; pointMetaData.put(GraphSource.ITEM_COLOR, alertDataColor); } else if (displaySevereData && color == 4) { alertDataExists = true; pointMetaData.put(GraphSource.ITEM_COLOR, severeDataColor); } if (useItemColor) { seriesColor = graphBaseColors[j % graphBaseColors.length]; pointMetaData.put(GraphSource.ITEM_COLOR, seriesColor); } if (displayNormalData || alertDataExists) { // only update the maxCount if this data point is visible if (counts[i][j] > maxCount) { maxCount = counts[i][j]; } } else { // if normal data is supposed to be hidden and no alert data exists, then hide this // data point pointMetaData.put(GraphSource.ITEM_VISIBLE, false); } // if the data is set to the Double.MIN_VALUE, then add it as a null. if (counts[i][j] != Double.MIN_VALUE) { points.add(new DataPoint(counts[i][j], xLabels[j], pointMetaData)); } else { points.add(new DataPoint(null, xLabels[j], pointMetaData)); } } /** add the series */ // series properties Map<String, Object> dataSeriesMetaData = new HashMap<String, Object>(); dataSeriesMetaData.put(GraphSource.SERIES_TITLE, lineSetLabel); dataSeriesMetaData.put(GraphSource.SERIES_COLOR, seriesColor); // if normal data is hidden for this series, hide the series connector line dataSeriesMetaData.put(GraphSource.SERIES_LINES_VISIBLE, displayNormalData); dataSeries.add(new DataSeries(points, dataSeriesMetaData)); if (legendItems != null) { if (displayNormalData && legendItems.getItemCount() < maxLegendItems) { if (displayAlert && !singleAlertLegend) { legendItems .add(new LegendItem(lineSetLabel + ": " + getTranslation("Normal"), seriesColor)); } else { legendItems.add(new LegendItem(lineSetLabel, seriesColor)); } } if (!singleAlertLegend && displayWarningData && legendItems.getItemCount() < maxLegendItems) { legendItems .add(new LegendItem(lineSetLabel + ": " + getTranslation("Warning"), warningDataColor)); } if (!singleAlertLegend && displayAlertData && legendItems.getItemCount() < maxLegendItems) { legendItems.add(new LegendItem(lineSetLabel + ": " + getTranslation("Alert"), alertDataColor)); } if (!singleSeverityLegend && displaySevereData && legendItems.getItemCount() < maxLegendItems) { legendItems .add(new LegendItem(lineSetLabel + ": " + getTranslation("Severe"), severeDataColor)); } } } if (singleAlertLegend && legendItems.getItemCount() < maxLegendItems) { legendItems.add(new LegendItem(getTranslation("Warning"), warningDataColor)); legendItems.add(new LegendItem(getTranslation("Alert"), alertDataColor)); } if (singleSeverityLegend && legendItems.getItemCount() < maxLegendItems) { legendItems.add(new LegendItem(getTranslation("Severe"), severeDataColor)); } return maxCount; }
From source file:matteroverdrive.util.RenderUtils.java
public static void rotateTowards(Vec3 from, Vec3 to, Vec3 up) { double dot = from.dotProduct(to); if (Math.abs(dot - (-1.0)) < Double.MIN_VALUE) { glRotated(180, up.xCoord, up.yCoord, up.zCoord); }/*from www . j a v a 2 s. c om*/ if (Math.abs(dot - (1.0)) < Double.MIN_VALUE) { return; } double rotAngle = Math.acos(dot); Vec3 rotAxis = from.crossProduct(to).normalize(); glRotated(rotAngle * (180d / Math.PI), rotAxis.xCoord, rotAxis.yCoord, rotAxis.zCoord); }
From source file:main.ScorePipeline.java
/** * * This method calculates similarities for MSRobin for each spectra on * yeast_human_spectra on the first data set against all yeast spectra on * the second data set//from www .j a va 2s . c om * * thydMSnSpectra-yeast-human, tsolMSnSpectra-yeast, * * @param tsolMSnSpectra * @param thydMSnSpectra * @param bw * @param fragTol * @param precTol * @throws IllegalArgumentException * @throws ClassNotFoundException * @throws IOException * @throws MzMLUnmarshallerException * @throws NumberFormatException * @throws InterruptedException */ private static void calculate_MSRobins(ArrayList<MSnSpectrum> tsolMSnSpectra, ArrayList<MSnSpectrum> thydMSnSpectra, BufferedWriter bw, double fragTol, double precTol, int calculationOptionIntensityMSRobin, int msRobinCalculationOption) throws IllegalArgumentException, ClassNotFoundException, IOException, MzMLUnmarshallerException, NumberFormatException, InterruptedException { ExecutorService excService = Executors .newFixedThreadPool(ConfigHolder.getInstance().getInt("thread.numbers")); List<Future<SimilarityResult>> futureList = new ArrayList<>(); for (MSnSpectrum thydMSnSpectrum : thydMSnSpectra) { Calculate_Similarity similarity = new Calculate_Similarity(thydMSnSpectrum, tsolMSnSpectra, fragTol, precTol, calculationOptionIntensityMSRobin, msRobinCalculationOption); Future future = excService.submit(similarity); futureList.add(future); } for (Future<SimilarityResult> future : futureList) { try { SimilarityResult get = future.get(); String tmp_charge = get.getSpectrumChargeAsString(), spectrum = get.getSpectrumName(); double tmp_precursor_mz = get.getSpectrumPrecursorMZ(), msrobin = get.getScores().get(SimilarityMethods.MSRobin); if (msrobin == Double.MIN_VALUE) { LOGGER.info("The similarity for the spectrum " + spectrum + " is too small to keep the record, therefore score is not computed."); // Means that score has not been calculated! // bw.write(tmp_Name + "\t" + tmp_charge + "\t" + tmpPrecMZ + "\t"); // bw.write("NA" + "\n"); } else { bw.write(spectrum + "\t" + tmp_charge + "\t" + tmp_precursor_mz + "\t" + get.getSpectrumToCompare() + "\t" + msrobin + "\n"); } } catch (InterruptedException | ExecutionException e) { LOGGER.error(e); } } excService.shutdown(); }
From source file:jp.terasoluna.fw.validation.FieldChecks.java
/** * ???double??????//from ww w. j ava2 s. c o m * ?????? * * <p>???10?100??????????? * true????? * * <h5>validation.xml?</h5> * <code><pre> * <form name="sample"> * * <field property="doubleField" * depends="doubleRange"> * <arg key="sample.doubleField" position="0"/> * <var> * <var-name>doubleRangeMin</var-name> * <var-value>10.0</var-value> * </var> * <var> * <var-name>doubleRangeMax</var-name> * <var-value>100.0</var-value> * </var> * </field> * * </form> * </pre></code> * * <h5>validation.xml???<var>?</h5> * <table border="1"> * <tr> * <td><center><b><code>var-name</code></b></center></td> * <td><center><b><code>var-value</code></b></center></td> * <td><center><b></b></center></td> * <td><center><b>?</b></center></td> * </tr> * <tr> * <td> doubleRangeMin </td> * <td>?</td> * <td>false</td> * <td>????????Double??? * ? * ????????</td> * </tr> * <tr> * <td> doubleRangeMax </td> * <td></td> * <td>false</td> * <td>???????Double?? * ? * ????????</td> * </tr> * </table> * * @param bean ?JavaBean * @param va ?<code>ValidatorAction</code> * @param field ?<code>Field</code> * @param errors ????? * ?? * @return ??????<code>true</code>? * ????<code>false</code>? * @throws ValidatorException validation?????? * ? */ public boolean validateDoubleRange(Object bean, ValidatorAction va, Field field, ValidationErrors errors) throws ValidatorException { // String value = extractValue(bean, field); if (StringUtils.isEmpty(value)) { return true; } // double?? --- Double?????? double dblValue = 0; try { dblValue = Double.parseDouble(value); } catch (NumberFormatException e) { rejectValue(errors, field, va, bean); return false; } // --- ?Double?????? // ???? String strMin = field.getVarValue("doubleRangeMin"); double min = Double.MIN_VALUE; if (!GenericValidator.isBlankOrNull(strMin)) { try { min = Double.parseDouble(strMin); } catch (NumberFormatException e) { String message = "Mistake on validation definition file. " + "- doubleRangeMin is not number. " + "You'll have to check it over. "; log.error(message, e); throw new ValidatorException(message); } } String strMax = field.getVarValue("doubleRangeMax"); double max = Double.MAX_VALUE; if (!GenericValidator.isBlankOrNull(strMax)) { try { max = Double.parseDouble(strMax); } catch (NumberFormatException e) { String message = "Mistake on validation definition file. " + "- doubleRangeMax is not number. " + "You'll have to check it over. "; log.error(message, e); throw new ValidatorException(message); } } // if (!GenericValidator.isInRange(dblValue, min, max)) { rejectValue(errors, field, va, bean); return false; } return true; }
From source file:com.juanhg.icewalker.IceWalkerApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTiempo = new JPanel(); panelTiempo.setToolTipText(""); panelTiempo.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblPhase = new JLabel("Velocidad:"); lblPhase.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblPosicion = new JLabel("Posici\u00F3n:"); lblPosicion.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPositionValue = new JLabel(); lblPositionValue.setText("0"); lblPositionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs/*w ww . ja va2 s . c om*/ .setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addComponent(lblPhase, GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE).addGap(26) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE) .addContainerGap(130, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addGap(26).addComponent(lblPositionValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE) .addContainerGap(130, Short.MAX_VALUE))); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblPhase).addComponent(lblVValue)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblPositionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(63))); panelOutputs.setLayout(gl_panelOutputs); panel_1 = new JPanel(); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING, false) .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelInputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) .addGroup(Alignment.TRAILING, gl_panel_control.createSequentialGroup() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addComponent(panel_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(panelTiempo, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)) .addContainerGap())))); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelTiempo, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 15, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panel_1.add(lblNewLabel); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); panel = new JPanel(); panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); label = new JLabel("Datos de la Simulaci\u00F3n"); label.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(label); btnBanana = new JButton(""); btnBanana.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnBananaEvent(); } }); bananaImage = loadImage(banana); btnBanana.setIcon(new ImageIcon(bananaImage)); btnBurger = new JButton(""); btnBurger.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnBurgerEvent(); } }); burgerImage = loadImage(burger); btnBurger.setIcon(new ImageIcon(burgerImage)); btnCookie = new JButton(""); btnCookie.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnCookieEvent(); } }); cookieImage = loadImage(cookie); btnCookie.setIcon(new ImageIcon(cookieImage)); btnCarrot = new JButton(""); carrotImage = loadImage(carrot); btnCarrot.setIcon(new ImageIcon(carrotImage)); btnCarrot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnCarrotEvent(); } }); JLabel lblNewLabel_1 = new JLabel("30 cal/100g"); JLabel lblCalg_2 = new JLabel("734 cal/100g"); lblCalg = new JLabel("90 cal/100g"); lblCalg_1 = new JLabel("433 cal/100g"); GroupLayout gl_panelTiempo = new GroupLayout(panelTiempo); gl_panelTiempo.setHorizontalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(17).addGroup(gl_panelTiempo .createParallelGroup(Alignment.LEADING, false) .addComponent(btnLaunchSimulation, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_panelTiempo.createSequentialGroup() .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING) .addComponent(btnCarrot, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING) .addComponent(btnBanana).addComponent(lblCalg, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING) .addComponent(btnCookie, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(lblCalg_1, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(6).addComponent( btnBurger, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(18).addComponent( lblCalg_2, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE))))) .addContainerGap(24, Short.MAX_VALUE))); gl_panelTiempo.setVerticalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING).addGroup(gl_panelTiempo .createSequentialGroup() .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(btnCarrot, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addComponent(btnCookie, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addComponent(btnBurger, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING, false) .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.BASELINE) .addComponent(lblCalg_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblCalg_1, GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)) .addComponent(lblCalg, GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE))) .addComponent(btnBanana, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)) .addGap(30).addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addContainerGap(33, Short.MAX_VALUE))); panelTiempo.setLayout(gl_panelTiempo); JLabel LabelStrength = new JLabel("Fuerza"); LabelStrength.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelStaticFriction = new JLabel("Roz. Est\u00E1tico"); labelStaticFriction.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelDynamicFriction = new JLabel("Roz. Din\u00E1mico"); labelDynamicFriction.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblStaticFrictionValue = new JLabel("0.2"); lblStaticFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblDynamicFrictionValue = new JLabel("0.1"); lblDynamicFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblStregthValue = new JLabel("100"); lblStregthValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderStrength = new JSlider(); sliderStrength.setMinorTickSpacing(1); sliderStrength.setMinimum(1); sliderStrength.setMaximum(300); sliderStrength.setValue(100); sliderStrength.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderStrenghtEvent(); } }); sliderStaticFriction = new JSlider(); sliderStaticFriction.setMinimum(15); sliderStaticFriction.setMaximum(80); sliderStaticFriction.setMinorTickSpacing(1); sliderStaticFriction.setValue(20); sliderStaticFriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderStaticFrictionEvent(); } }); sliderDynamicFriction = new JSlider(); sliderDynamicFriction.setValue(10); sliderDynamicFriction.setMaximum(15); sliderDynamicFriction.setMinimum(5); sliderDynamicFriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderDynamicFrictionEvent(); } }); sliderDynamicFriction.setMinorTickSpacing(1); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelDynamicFriction, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelStrength, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelStaticFriction, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120, Short.MAX_VALUE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblStregthValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblStaticFrictionValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblDynamicFrictionValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(sliderStaticFriction, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderStrength, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderDynamicFriction, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)) .addGap(26)) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)); gl_panelInputs .setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(8) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelStrength).addComponent(lblStregthValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderStrength, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelStaticFriction) .addComponent(lblStaticFrictionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderStaticFriction, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(labelDynamicFriction) .addComponent(lblDynamicFrictionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderDynamicFriction, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(75))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 432, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE) .addContainerGap())); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE) .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 598, Short.MAX_VALUE)) .addContainerGap())); GridBagLayout gbl_panel_visualizar = new GridBagLayout(); gbl_panel_visualizar.columnWidths = new int[] { 0, 0 }; gbl_panel_visualizar.rowHeights = new int[] { 0, 0, 0 }; gbl_panel_visualizar.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_panel_visualizar.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; panel_visualizar.setLayout(gbl_panel_visualizar); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); GridBagConstraints gbc_tabbedPane = new GridBagConstraints(); gbc_tabbedPane.gridheight = 2; gbc_tabbedPane.fill = GridBagConstraints.BOTH; gbc_tabbedPane.gridx = 0; gbc_tabbedPane.gridy = 0; panel_visualizar.add(tabbedPane, gbc_tabbedPane); panelSimulation = new JPanelGrafica(); tabbedPane.addTab("Simulacin", null, panelSimulation, null); panelSimulation.setBackground(Color.WHITE); getContentPane().setLayout(groupLayout); }
From source file:eu.scape_project.planning.model.tree.Leaf.java
/** * Method responsible for assessing the potential output range of this * requirement. Calculation rule: if (minPossibleTransformedValue == 0) * koFactor = 1; else koFactor = 0; potentialOutputRange = relativeWeight * * (maxPossibleTransformedValue - minPossibleTransformedValue) + koFactor; * /*from w ww. ja va2 s .co m*/ * @return potential output range. If the plan is not yet at a evaluation * stage where potential output range can be calculated 0 is * returned. */ public double getPotentialOutputRange() { // If the plan is not yet at a evaluation stage where potential output // range can be calculated - return 0. if (transformer == null) { return 0; } double outputLowerBound = 10; double outputUpperBound = -10; // Check OrdinalTransformer if (transformer instanceof OrdinalTransformer) { OrdinalTransformer ot = (OrdinalTransformer) transformer; Map<String, TargetValueObject> otMapping = ot.getMapping(); // set upper- and lower-bound for (TargetValueObject tv : otMapping.values()) { if (tv.getValue() > outputUpperBound) { outputUpperBound = tv.getValue(); } if (tv.getValue() < outputLowerBound) { outputLowerBound = tv.getValue(); } } } // Check OrdinalTransformer if (transformer instanceof NumericTransformer) { // I have to identify the scale bounds before I can calculate the // output bounds. double scaleLowerBound = Double.MIN_VALUE; double scaleUpperBound = Double.MAX_VALUE; // At Positive Scales lowerBound is 0, upperBound has to be fetched if (scale instanceof PositiveIntegerScale) { PositiveIntegerScale s = (PositiveIntegerScale) scale; scaleLowerBound = 0; scaleUpperBound = s.getUpperBound(); } if (scale instanceof PositiveFloatScale) { PositiveFloatScale s = (PositiveFloatScale) scale; scaleLowerBound = 0; scaleUpperBound = s.getUpperBound(); } // At Range Scales lowerBound and upperBound have to be fetched if (scale instanceof IntRangeScale) { IntRangeScale s = (IntRangeScale) scale; scaleLowerBound = s.getLowerBound(); scaleUpperBound = s.getUpperBound(); } if (scale instanceof FloatRangeScale) { FloatRangeScale s = (FloatRangeScale) scale; scaleLowerBound = s.getLowerBound(); scaleUpperBound = s.getUpperBound(); } // get Transformer thresholds NumericTransformer nt = (NumericTransformer) transformer; double transformerT1 = nt.getThreshold1(); double transformerT2 = nt.getThreshold2(); double transformerT3 = nt.getThreshold3(); double transformerT4 = nt.getThreshold4(); double transformerT5 = nt.getThreshold5(); // calculate output bounds if (nt.hasIncreasingOrder()) { // increasing thresholds // lower bound if (scaleLowerBound < transformerT1) { outputLowerBound = 0; } else if (scaleLowerBound < transformerT2) { outputLowerBound = 1; } else if (scaleLowerBound < transformerT3) { outputLowerBound = 2; } else if (scaleLowerBound < transformerT4) { outputLowerBound = 3; } else if (scaleLowerBound < transformerT5) { outputLowerBound = 4; } else { outputLowerBound = 5; } // upper bound if (scaleUpperBound < transformerT1) { outputUpperBound = 0; } else if (scaleUpperBound < transformerT2) { outputUpperBound = 1; } else if (scaleUpperBound < transformerT3) { outputUpperBound = 2; } else if (scaleUpperBound < transformerT4) { outputUpperBound = 3; } else if (scaleUpperBound < transformerT5) { outputUpperBound = 4; } else { outputUpperBound = 5; } } else { // decreasing thresholds // lower bound if (scaleUpperBound > transformerT1) { outputLowerBound = 0; } else if (scaleUpperBound > transformerT2) { outputLowerBound = 1; } else if (scaleUpperBound > transformerT3) { outputLowerBound = 2; } else if (scaleUpperBound > transformerT4) { outputLowerBound = 3; } else if (scaleUpperBound > transformerT5) { outputLowerBound = 4; } else { outputLowerBound = 5; } // upper bound if (scaleLowerBound > transformerT1) { outputUpperBound = 0; } else if (scaleLowerBound > transformerT2) { outputUpperBound = 1; } else if (scaleLowerBound > transformerT3) { outputUpperBound = 2; } else if (scaleLowerBound > transformerT4) { outputUpperBound = 3; } else if (scaleLowerBound > transformerT5) { outputUpperBound = 4; } else { outputUpperBound = 5; } } } double koFactor = 0; if (outputLowerBound == 0) { koFactor = 1; } double potentialOutputRange = getTotalWeight() * (outputUpperBound - outputLowerBound) + koFactor; return potentialOutputRange; }
From source file:shnakkydoodle.measuring.provider.MetricsProviderSQLServer.java
/** * Gets statistics for the specified metric * //from w w w.ja va 2 s. com * @param metricNamespace * @param metricName * @param startDate * @param endDate * @return all the statics for a metric */ @Override public HashMap<MetricStatistic, Double> getMetricStatistics(String metricNamespace, String metricName, Date startDate, Date endDate) { // set up our stats Double sum = 0.00; Double max = Double.MIN_VALUE; Double min = Double.MAX_VALUE; Double cnt = 0.00; ArrayList<MetricData> data = getMetricData(metricNamespace, metricName, startDate, endDate); if (data != null) { for (MetricData dataitem : data) { sum = sum + dataitem.getValue(); if (dataitem.getValue() >= max) { max = dataitem.getValue(); } if (dataitem.getValue() <= min) { min = dataitem.getValue(); } cnt++; } } HashMap<MetricStatistic, Double> metricStatistics = new HashMap<MetricStatistic, Double>(); metricStatistics.put(MetricStatistic.Average, cnt); if (cnt > 0) { metricStatistics.put(MetricStatistic.Average, sum / cnt); } metricStatistics.put(MetricStatistic.Maximum, max); metricStatistics.put(MetricStatistic.Minumim, min); metricStatistics.put(MetricStatistic.Sum, sum); return metricStatistics; }