List of usage examples for java.lang Math log10
@HotSpotIntrinsicCandidate public static double log10(double a)
From source file:OrdenacaoGUI.java
private static void runSort(int[] array, int tipo) { switch (tipo) { case 0: // comb sort combSort.combSort(array);/*from w ww. ja va2 s . co m*/ break; case 1: // shell sort shellSort.shellSort(array); break; case 2: // heapsort heapSort.heapSort(array); break; case 3: // radix sort int k = (int) Math.ceil(Math.log10(array.length)); radixSort.radixSort(array, k); break; case 4: // counting sort countingSort.countingSort(array); break; } }
From source file:edu.cmu.cs.hcii.cogtool.model.CachedGoogleSimilarity.java
/** * No need for a similarity URL processor; word similarity is computed * purely using word frequencies.//from www . j a v a2 s.c o m */ @Override protected Double fetchWordSimilarity(String goalWord, String searchWord, List<String> errors) { double indexSize = CogToolPref.PMI_G_SIZE.getDouble(); if (indexSize == CachedGoogleSimilarity.PMI_G_SIZE_AUTOMATIC) { indexSize = getWordFrequency(COMMON_WORD, errors); } double numerator = (getWordFrequency(goalWord + " " + searchWord, errors)) / indexSize; double denominator = ((getWordFrequency(goalWord, errors)) / indexSize) * ((getWordFrequency(searchWord, errors)) / indexSize); // TODO we may want to normalize the results differently if (denominator != 0.0) { double unnormalized = Math.log10(numerator / denominator); double normalized = unnormalized / Math.log10(indexSize); CogTool.logger.finer(String.format("Normalizing PMI-G (word) value (%s, %s) from %g to %g", goalWord, searchWord, unnormalized, normalized)); return new Double(normalized); } CogTool.logger.finer(String.format("Unknown PMI-G (word) similarity for %s, %s", goalWord, searchWord)); return UNKNOWN_SIMILARITY; }
From source file:adapters.AxisAdapter.java
/** * Formats and returns a string containing a <SPAN CLASS="logo,LaTeX">L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X</SPAN>-compatible * source code which represents this axis and its parameters. * * @return LaTeX source code in a String. * @param scale current axis wished scale. * * *///www .j a va 2s.c o m public String toLatex(double scale) { Formatter formatter = new Formatter(Locale.US); double maxAxis = Math.max(axis.getRange().getUpperBound(), twinAxisPosition); //valeur du label le plus grand double minAxis = Math.min(axis.getRange().getLowerBound(), twinAxisPosition); //valeur du label le plus petit String precisionAffichageLabel; //determine combien de decimales seront affichees pour les labels double pas = axis.getTickUnit().getSize(); //step d'affichage des labels pas = fixStep(minAxis, maxAxis, pas); int puissDix; //echelle des valeurs sur l'axe if (Math.log10(pas) < 0) puissDix = (int) Math.log10(pas) - 1; else puissDix = (int) Math.log10(pas); //Placement des fleches, on pourrait facilement les rendre personnalisables... String arrowLeftType = "latex"; String arrowRightType = "latex"; String arrowLeftMargin = "3mm"; String arrowRightMargin = "3mm"; if (twinAxisPosition == minAxis) { arrowLeftType = ""; arrowLeftMargin = "0mm"; } else if (twinAxisPosition == maxAxis) { arrowRightType = ""; arrowRightMargin = "0mm"; } // Label pour l'axe, avec eventuellement l'echelle String label = axis.getLabel(); if (label == null) label = " "; if (puissDix < -2 || puissDix > 2) label = label + " $(10^{" + puissDix + "})$"; else puissDix = 0; if (orientation) { //on est sur l'axe des abscisses //affichage de l'axe formatter.format("\\draw [%s-%s] ([xshift=-%s] %s,0) -- ([xshift=%s] %s,0) node[right] {%s};%n", arrowLeftType, arrowRightType, arrowLeftMargin, (minAxis - twinAxisPosition) * scale, arrowRightMargin, (maxAxis - twinAxisPosition) * scale, label); if (labelsFlag) { //labels manuels String name; double value; double labelTemp; for (int i = 0; i < labelsValue.length; i++) { value = labelsValue[i]; if (labelsName == null) { labelTemp = (value * 100.0 / Math.pow(10, puissDix)); // if(labelTemp == (int)(labelTemp)) name = Integer.toString((int) (labelTemp / 100.0)); // else // name = Double.toString(Math.round(labelTemp)/100.0); } else name = labelsName[i]; if (value == twinAxisPosition && tick0Flag) formatter.format("\\draw (%s,00) -- +(0mm,1mm) -- +(0mm,-1mm) node[below right] {%s};%n", (value - twinAxisPosition) * scale, name); else formatter.format("\\draw (%s,0) -- +(0mm,1mm) -- +(0mm,-1mm) node[below] {%s};%n", (value - twinAxisPosition) * scale, name); } } else { //labels automatiques double labelTemp; double k = twinAxisPosition; labelTemp = (Math.round(k * 100 / Math.pow(10, puissDix))) / 100.0; if (labelTemp == (int) (labelTemp)) precisionAffichageLabel = "0"; else if (labelTemp * 10 == (int) (labelTemp * 10)) precisionAffichageLabel = "1"; else precisionAffichageLabel = "2"; if (tick0Flag) formatter.format("\\draw (%s,0) -- +(0mm,1mm) -- +(0mm,-1mm) node[below right] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); else formatter.format("\\draw (%s,0) -- +(0mm,1mm) -- +(0mm,-1mm) node[below] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); k += pas; while (k <= maxAxis) { //cote positif labelTemp = (Math.round(k * 100 / Math.pow(10, puissDix))) / 100.0; if (labelTemp == (int) (labelTemp)) precisionAffichageLabel = "0"; else if (labelTemp * 10 == (int) (labelTemp * 10)) precisionAffichageLabel = "1"; else precisionAffichageLabel = "2"; formatter.format("\\draw (%s,0) -- +(0mm,1mm) -- +(0mm,-1mm) node[below] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); k += pas; } k = twinAxisPosition - pas; while (k >= minAxis) { //cote negatif labelTemp = (Math.round(k * 100 / Math.pow(10, puissDix))) / 100.0; if (labelTemp == (int) (labelTemp)) precisionAffichageLabel = "0"; else if (labelTemp * 10 == (int) (labelTemp * 10)) precisionAffichageLabel = "1"; else precisionAffichageLabel = "2"; formatter.format("\\draw (%s,0) -- +(0mm,1mm) -- +(0mm,-1mm) node[below] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); k -= pas; } } } else { //On est sur l'axe des ordonnees //affichage de l'axe formatter.format("\\draw [%s-%s] ([yshift=-%s] 0,%s) -- ([yshift=%s] 0, %s) node[above] {%s};%n", arrowLeftType, arrowRightType, arrowLeftMargin, (minAxis - twinAxisPosition) * scale, arrowRightMargin, (maxAxis - twinAxisPosition) * scale, label); if (labelsFlag) { //labels manuels String name; double value; double labelTemp; for (int i = 0; i < labelsValue.length; i++) { value = labelsValue[i]; if (labelsName == null) { labelTemp = (value * scale * 100 / Math.pow(10, puissDix)); if (labelTemp == (int) (labelTemp)) name = Integer.toString((int) (labelTemp / 100.0)); else name = Double.toString(Math.round(labelTemp) / 100.0); } else name = labelsName[i]; if (value == twinAxisPosition && tick0Flag) formatter.format("\\draw (%s,%s) -- +(1mm,0mm) -- +(-1mm,0mm) node[above left] {%s};%n", 0, (value - twinAxisPosition) * scale, name); else formatter.format("\\draw (%s,%s) -- +(1mm,0mm) -- +(-1mm,0mm) node[left] {%s};%n", 0, (value - twinAxisPosition) * scale, name); } } else { //Les labels automatiques double k = twinAxisPosition; double labelTemp; labelTemp = (Math.round(k * 100 / Math.pow(10, puissDix))) / 100.0; if (labelTemp == (int) (labelTemp)) precisionAffichageLabel = "0"; else if (labelTemp * 10 == (int) (labelTemp * 10)) precisionAffichageLabel = "1"; else precisionAffichageLabel = "2"; if (tick0Flag) formatter.format("\\draw (0,%s) -- +(1mm,0mm) -- +(-1mm,0mm) node[above left] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); else formatter.format("\\draw (0,%s) -- +(1mm,0mm) -- +(-1mm,0mm) node[left] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); k += pas; while (k <= maxAxis) { //cote positif de l'axe labelTemp = (Math.round(k * 100 / Math.pow(10, puissDix))) / 100.0; if (labelTemp == (int) (labelTemp)) precisionAffichageLabel = "0"; else if (labelTemp * 10 == (int) (labelTemp * 10)) precisionAffichageLabel = "1"; else precisionAffichageLabel = "2"; formatter.format("\\draw (0,%s) -- +(1mm,0mm) -- +(-1mm,0mm) node[left] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); k += pas; } k = twinAxisPosition - pas; while (k >= minAxis) { //cote negatif de l'axe labelTemp = (Math.round(k * 100 / Math.pow(10, puissDix))) / 100.0; if (labelTemp == (int) (labelTemp)) precisionAffichageLabel = "0"; else if (labelTemp * 10 == (int) (labelTemp * 10)) precisionAffichageLabel = "1"; else precisionAffichageLabel = "2"; formatter.format("\\draw (0,%s) -- +(1mm,0mm) -- +(-1mm,0mm) node[left] {%." + precisionAffichageLabel + "f};%n", (k - twinAxisPosition) * scale, labelTemp); k -= pas; } } } return formatter.toString(); }
From source file:com.rapidminer.gui.plotter.charts.Abstract2DChartPlotter.java
private void prepareNumericalData() { this.nominal = false; dataSet = new DefaultXYZDataset(); if (axis[X_AXIS] >= 0 && axis[Y_AXIS] >= 0) { this.minColor = Double.POSITIVE_INFINITY; this.maxColor = Double.NEGATIVE_INFINITY; List<double[]> dataList = new LinkedList<double[]>(); List<String> idList = new LinkedList<String>(); synchronized (dataTable) { Iterator<DataTableRow> i = this.dataTable.iterator(); while (i.hasNext()) { DataTableRow row = i.next(); double xValue = Double.NaN; if (axis[X_AXIS] >= 0) { xValue = row.getValue(axis[X_AXIS]); }/* w ww . j a v a2 s.c o m*/ double yValue = Double.NaN; if (axis[Y_AXIS] >= 0) { yValue = row.getValue(axis[Y_AXIS]); } double colorValue = Double.NaN; if (colorColumn >= 0) { colorValue = row.getValue(colorColumn); } if (plotColumnsLogScale) { if (Tools.isLessEqual(colorValue, 0.0d)) { colorValue = 0; } else { colorValue = Math.log10(colorValue); } } // TM: removed check // if (!Double.isNaN(xValue) && !Double.isNaN(yValue)) { double[] data = new double[3]; data[X_AXIS] = xValue; data[Y_AXIS] = yValue; data[COLOR_AXIS] = colorValue; if (!Double.isNaN(colorValue)) { this.minColor = Math.min(this.minColor, colorValue); this.maxColor = Math.max(this.maxColor, colorValue); } dataList.add(data); idList.add(row.getId()); // } } } double[][] data = new double[3][dataList.size()]; double minX = Double.POSITIVE_INFINITY; double maxX = Double.NEGATIVE_INFINITY; double minY = Double.POSITIVE_INFINITY; double maxY = Double.NEGATIVE_INFINITY; int index = 0; for (double[] d : dataList) { data[X_AXIS][index] = d[X_AXIS]; data[Y_AXIS][index] = d[Y_AXIS]; data[COLOR_AXIS][index] = d[COLOR_AXIS]; minX = MathFunctions.robustMin(minX, d[X_AXIS]); maxX = MathFunctions.robustMax(maxX, d[X_AXIS]); minY = MathFunctions.robustMin(minY, d[Y_AXIS]); maxY = MathFunctions.robustMax(maxY, d[Y_AXIS]); index++; } // jittering if (this.jitterAmount > 0) { Random jitterRandom = new Random(2001); double oldXRange = maxX - minX; double oldYRange = maxY - minY; for (int i = 0; i < dataList.size(); i++) { if (Double.isInfinite(oldXRange) || Double.isNaN(oldXRange)) { oldXRange = 0; } if (Double.isInfinite(oldYRange) || Double.isNaN(oldYRange)) { oldYRange = 0; } double pertX = oldXRange * (jitterAmount / 200.0d) * jitterRandom.nextGaussian(); double pertY = oldYRange * (jitterAmount / 200.0d) * jitterRandom.nextGaussian(); data[X_AXIS][i] += pertX; data[Y_AXIS][i] += pertY; } } // add data ((DefaultXYZDataset) dataSet).addSeries("All", data); // id handling int idCounter = 0; for (String id : idList) { idMap.put(new SeriesAndItem(0, idCounter++), id); } } }
From source file:tech.tablesaw.columns.numbers.NumberMapFunctions.java
/** * Returns the base 10 log of the values in this column as a NumberColumn. *///ww w. ja v a 2s. c o m default DoubleColumn log10() { DoubleColumn newColumn = DoubleColumn.create(name() + "[log10]", size()); for (int i = 0; i < size(); i++) { newColumn.set(i, Math.log10(getDouble(i))); } return newColumn; }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.MapViewFragment.java
/** * Sets the default zoom level for the mapview. This takes the max and min * of both lat and long, and zooms to span the area required. It also * animates to the startGeoPoint, which is the location of the topComment. * The values must be padded with a zoom_factor, which is a static class * variable/*from w ww . j a v a 2s . com*/ * * @param geoLocation * GeoLocation used to start the basis of the distance */ public void setZoomLevel(GeoLocation geoLocation) { // get the mapController and set the zoom IMapController mapController = mapData.getController(); int zoomFactor; int zoomSpan = calculateZoomSpan(); // calculates the appropriate zoom level zoomFactor = 19 - (int) (Math.log10(zoomSpan) * 2.2); if (zoomFactor > 18 || zoomSpan < 1) { zoomFactor = 18; } else if (zoomFactor < 2) { zoomFactor = 2; } // set the zoom center mapController.setZoom(zoomFactor); mapController.animateTo(geoLocation.makeGeoPoint()); }
From source file:org.esa.s1tbx.calibration.gpf.calibrators.ALOSCalibrator.java
/** * Called by the framework in order to compute a tile for the given target band. * <p>The default implementation throws a runtime exception with the message "not implemented".</p> * * @param targetBand The target band.//from w w w. j a v a 2 s. c o m * @param targetTile The current tile associated with the target band to be computed. * @param pm A progress monitor which should be used to determine computation cancelation requests. * @throws OperatorException If an error occurs during computation of the target raster. */ public void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm) throws OperatorException { final Rectangle targetTileRectangle = targetTile.getRectangle(); final int x0 = targetTileRectangle.x; final int y0 = targetTileRectangle.y; final int w = targetTileRectangle.width; final int h = targetTileRectangle.height; Tile sourceRaster1 = null; ProductData srcData1 = null; ProductData srcData2 = null; Band sourceBand1 = null; final String[] srcBandNames = targetBandNameToSourceBandName.get(targetBand.getName()); if (srcBandNames.length == 1) { sourceBand1 = sourceProduct.getBand(srcBandNames[0]); sourceRaster1 = calibrationOp.getSourceTile(sourceBand1, targetTileRectangle); srcData1 = sourceRaster1.getDataBuffer(); } else { sourceBand1 = sourceProduct.getBand(srcBandNames[0]); final Band sourceBand2 = sourceProduct.getBand(srcBandNames[1]); sourceRaster1 = calibrationOp.getSourceTile(sourceBand1, targetTileRectangle); final Tile sourceRaster2 = calibrationOp.getSourceTile(sourceBand2, targetTileRectangle); srcData1 = sourceRaster1.getDataBuffer(); srcData2 = sourceRaster2.getDataBuffer(); } final Unit.UnitType tgtBandUnit = Unit.getUnitType(targetBand); final Unit.UnitType srcBandUnit = Unit.getUnitType(sourceBand1); // copy band if unit is phase if (tgtBandUnit == Unit.UnitType.PHASE) { targetTile.setRawSamples(sourceRaster1.getRawSamples()); return; } final ProductData trgData = targetTile.getDataBuffer(); final TileIndex srcIndex = new TileIndex(sourceRaster1); final TileIndex tgtIndex = new TileIndex(targetTile); final int maxY = y0 + h; final int maxX = x0 + w; double sigma, dn, dn2, i, q, phaseTerm = 0.0; int srcIdx, tgtIdx; for (int y = y0; y < maxY; ++y) { srcIndex.calculateStride(y); tgtIndex.calculateStride(y); for (int x = x0; x < maxX; ++x) { srcIdx = srcIndex.getIndex(x); tgtIdx = tgtIndex.getIndex(x); if (srcBandUnit == Unit.UnitType.AMPLITUDE) { dn = srcData1.getElemDoubleAt(srcIdx); dn2 = dn * dn; } else if (srcBandUnit == Unit.UnitType.INTENSITY) { dn2 = srcData1.getElemDoubleAt(srcIdx); } else if (srcBandUnit == Unit.UnitType.REAL) { i = srcData1.getElemDoubleAt(srcIdx); q = srcData2.getElemDoubleAt(srcIdx); dn2 = i * i + q * q; if (tgtBandUnit == Unit.UnitType.REAL) { phaseTerm = i / Math.sqrt(dn2); } else if (tgtBandUnit == Unit.UnitType.IMAGINARY) { phaseTerm = q / Math.sqrt(dn2); } } else if (srcBandUnit == Unit.UnitType.INTENSITY_DB) { dn2 = FastMath.pow(10, srcData1.getElemDoubleAt(srcIdx) / 10.0); // convert dB to linear scale } else { throw new OperatorException("ALOS Calibration: unhandled unit"); } sigma = dn2 * calibrationFactor; if (isComplex && outputImageInComplex) { sigma = Math.sqrt(sigma) * phaseTerm; } if (outputImageScaleInDb) { // convert calibration result to dB if (sigma < underFlowFloat) { sigma = -underFlowFloat; } else { sigma = 10.0 * Math.log10(sigma); } } trgData.setElemDoubleAt(tgtIdx, sigma); } } }
From source file:ask.springboot.controller.XiangLiaoController.java
@RequestMapping(value = "/tubiao1") @ResponseBody//from w w w.ja va 2 s . c o m public List<String> zhanshi(XiangLiao xiangliao) { List<XiangLiao> xiangliaoList = xiangliaoService.getAll(); List<String> lisresult = new ArrayList<String>(); Set<String> liss = new HashSet<String>(); for (XiangLiao xiangliao1 : xiangliaoList) { liss.add(xiangliao1.getXiangyunleibie()); } if (liss.size() == 14) { List<String> lis = new ArrayList<String>(); lis.add(""); lis.add(" "); lis.add(" (?)"); lis.add(""); lis.add(""); lis.add(""); lis.add(""); lis.add("??"); lis.add(""); lis.add(""); lis.add("?"); lis.add(""); lis.add(""); lis.add(""); System.out.println(lis); for (String str : lis) { double sum = 0.0; for (XiangLiao xiangliao1 : xiangliaoList) { if (xiangliao1.getXiangyunleibie().equals(str)) { String a1 = xiangliao1.getZuoyongyuzhi(); double sum1 = 0; if (a1.contains("*")) { String a12 = a1.substring(0, a1.indexOf("*")); System.out.println("a12=" + a12); String a11 = a1.substring(a1.indexOf("-") + 1, a1.length()); System.out.println("a11=" + a11); sum1 = Double.valueOf(a12) * Math.pow(10, (-1) * Double.valueOf(a11)); System.out.println("Math.pow(10,(-1)*Double.valueOf(a11)=" + Math.pow(10, (-1) * Double.valueOf(a11))); System.out.println("sum1=" + sum1); } else { sum1 = Double.valueOf(sum1); } String a2 = xiangliao1.getHanliang(); double sum2 = Double.valueOf(a2) * 1000; System.out.println("sum2=" + sum2); sum = sum + sum2 / sum1; } } double summ = Math.log10(sum); lisresult.add(String.valueOf(summ)); } } else { List<String> lis = new ArrayList<String>(); lis.add(""); lis.add(" "); lis.add(" (?)"); lis.add(""); lis.add(""); lis.add("??"); lis.add(""); lis.add(""); lis.add("?"); lis.add(""); lis.add(""); lis.add(""); System.out.println(lis); for (String str : lis) { double sum = 0.0; for (XiangLiao xiangliao1 : xiangliaoList) { if (xiangliao1.getXiangyunleibie().equals(str)) { String a1 = xiangliao1.getZuoyongyuzhi(); double sum1 = 0; if (a1.contains("*")) { String a12 = a1.substring(0, a1.indexOf("*")); System.out.println("a12=" + a12); String a11 = a1.substring(a1.indexOf("-") + 1, a1.length()); System.out.println("a11=" + a11); sum1 = Double.valueOf(a12) * Math.pow(10, (-1) * Double.valueOf(a11)); System.out.println("Math.pow(10,(-1)*Double.valueOf(a11)=" + Math.pow(10, (-1) * Double.valueOf(a11))); System.out.println("sum1=" + sum1); } else { sum1 = Double.valueOf(sum1); } String a2 = xiangliao1.getHanliang(); double sum2 = Double.valueOf(a2) * 1000; System.out.println("sum2=" + sum2); sum = sum + sum2 / sum1; } } double summ = Math.log10(sum); lisresult.add(String.valueOf(summ)); } } System.out.println("lisresult=" + lisresult); System.out.println("lisresult.size=" + lisresult.size()); return lisresult; }
From source file:com.epam.parso.impl.CSVDataWriterImpl.java
/** * The function to convert a double value into a string. If the text presentation of the double is longer * than {@link CSVDataWriterImpl#ROUNDING_LENGTH}, the rounded off value of the double includes * the {@link CSVDataWriterImpl#ACCURACY} number of digits from the first non-zero value. * * @param value the input numeric value to convert. * @return the string with the text presentation of the input numeric value. */// w w w .j a va 2 s . c o m protected static String convertDoubleElementToString(Double value) { String valueToPrint = String.valueOf(value); if (valueToPrint.length() > ROUNDING_LENGTH) { int lengthBeforeDot = (int) Math.ceil(Math.log10(Math.abs(value))); BigDecimal bigDecimal = new BigDecimal(value); bigDecimal = bigDecimal.setScale(ACCURACY - lengthBeforeDot, BigDecimal.ROUND_HALF_UP); valueToPrint = String.valueOf(bigDecimal.doubleValue()); } valueToPrint = trimZerosFromEnd(valueToPrint); return valueToPrint; }
From source file:us.mn.state.health.lims.reports.action.implementation.PatientARVReport.java
private void assignResultsToAVRReportData(ARVReportData data, String testName, String resultValue) { if (testName.equals("Glycmie")) { data.setGlyc(resultValue);//w w w. ja v a2 s . c o m } else if (testName.equals("Cratininmie")) { data.setCreatininemie(resultValue); } else if (testName.equals("Transaminases ALTL")) { data.setSgpt(resultValue); } else if (testName.equals("Transaminases ASTL")) { data.setSgot(resultValue); } else if (testName.equals("GB")) { data.setGb(resultValue); } else if (testName.equals("GR")) { data.setGr(resultValue); } else if (testName.equals("Hb")) { data.setHb(resultValue); } else if (testName.equals("HCT")) { data.setHct(resultValue); } else if (testName.equals("VGM")) { data.setVgm(resultValue); } else if (testName.equals("PLQ")) { data.setPlq(resultValue); } else if (testName.equals("Neut %")) { data.setNper(resultValue); } else if (testName.equals("Lymph %")) { data.setLper(resultValue); } else if (testName.equals("Mono %")) { data.setMper(resultValue); } else if (testName.equals("Eo %")) { data.setEoper(resultValue); } else if (testName.equals("Baso %")) { data.setBper(resultValue); } else if (testName.equals("CD4 absolute count")) { data.setCd4(resultValue); } else if (testName.equals("CD4 percentage count")) { data.setCd4per(resultValue); } else if (testName.equals("TCMH")) { data.setTcmh(resultValue); } else if (testName.equals("CCMH")) { data.setCcmh(resultValue); } else if (testName.equals("DNA PCR")) { data.setPcr(resultValue); } else if (testName.equals("Viral Load")) { data.setShowVirologie(Boolean.TRUE); // Results entered via analyzer have log value, results entered // manually may not String baseValue = resultValue; if (!GenericValidator.isBlankOrNull(resultValue) && resultValue.contains("(")) { String[] splitValue = resultValue.split("\\("); data.setAmpli2(splitValue[0]); baseValue = splitValue[0]; } else { data.setAmpli2(resultValue); } if (!GenericValidator.isBlankOrNull(baseValue) && !"0".equals(baseValue)) { try { double viralLoad = Double.parseDouble(baseValue); data.setAmpli2lo(String.format("%.3g%n", Math.log10(viralLoad))); } catch (NumberFormatException nfe) { data.setAmpli2lo(""); } } } else if (testName.equals("Murex") || testName.equals("Intgral")) { data.setShowSerologie(Boolean.TRUE); if (GenericValidator.isBlankOrNull(data.getVih())) { data.setVih(invalidValue); } } }