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:com.px100systems.util.SpringELCtx.java
/** * Iterator-based maximum using lambdas//from w w w.ja va2s . c o m * @param val how to get element values to sum * @param grp what to group by elements by (optional) * @param iterator the iterator to iterate over * @return the maximum */ public static Map<String, Double> imax(SimpleExtractor<Double, Object> val, SimpleExtractor<String, Object> grp, Iterator<?> iterator) { Map<String, Double> result = new HashMap<String, Double>(); while (iterator.hasNext()) { Object item = iterator.next(); String key = grp == null ? "" : grp.extract(item); Double value = result.get(key); if (value == null) value = Double.MIN_VALUE; Double v = val.extract(item); if (v > value) value = v; result.put(key, value); } return result; }
From source file:ffx.algorithms.TransitionTemperedOSRW.java
/** * Send an OSRW count to all other processes while also receiving an OSRW * count from all other processes.// w w w .j a v a 2s .co m * * @param lambda * @param dEdU */ private void synchronousSend(double lambda, double dEdU) { /** * All-Gather counts from each walker. */ myRecursionWeight[0] = lambda; myRecursionWeight[1] = dEdU; myRecursionWeight[2] = temperingWeight; try { world.allGather(myRecursionWeightBuf, recursionWeightsBuf); } catch (IOException ex) { String message = " Multi-walker OSRW allGather failed."; logger.log(Level.SEVERE, message, ex); } /** * Find the minimum and maximum FLambda bin for the gathered counts. */ double minRequired = Double.MAX_VALUE; double maxRequired = Double.MIN_VALUE; for (int i = 0; i < numProc; i++) { minRequired = Math.min(minRequired, recursionWeights[i][1]); maxRequired = Math.max(maxRequired, recursionWeights[i][1]); } /** * Check that the FLambda range of the Recursion kernel includes both * the minimum and maximum FLambda value. */ checkRecursionKernelSize(minRequired); checkRecursionKernelSize(maxRequired); /** * Increment the Recursion Kernel based on the input of each walker. */ for (int i = 0; i < numProc; i++) { int walkerLambda = binForLambda(recursionWeights[i][0]); int walkerFLambda = binForFLambda(recursionWeights[i][1]); double weight = recursionWeights[i][2]; /** * If the weight is less than 1.0, then a walker has activated * tempering. */ if (tempering == false && weight < 1.0) { tempering = true; logger.info(String.format(" Tempering activated due to recieved weight of (%8.6f)", weight)); } if (resetStatistics && recursionWeights[i][0] > lambdaResetValue) { recursionKernel = new double[lambdaBins][FLambdaBins]; resetStatistics = false; logger.info(String.format(" Cleared OSRW histogram (Lambda = %6.4f).", recursionWeights[i][0])); } recursionKernel[walkerLambda][walkerFLambda] += weight; } }
From source file:edu.ku.brc.specify.tasks.subpane.VisualQueryPanel.java
/** * @param doForCount//from ww w. ja v a 2s .c o m * @return */ private String buildSQL(final boolean doForCount) { double latMin = Double.MAX_VALUE; double latMax = Double.MIN_VALUE; double lonMin = Double.MAX_VALUE; double lonMax = -1000.0; for (Position p : polyline.getPositions()) { double lat = p.getLatitude().getDegrees(); double lon = p.getLongitude().getDegrees(); if (lat <= latMin) { latMin = lat; } if (lat >= latMax) { latMax = lat; } if (lon <= lonMin) { lonMin = lon; } if (lon >= lonMax) { lonMax = lon; } } StringBuilder sb = new StringBuilder(); switch (typeCBX.getSelectedIndex()) { case 0: sb.append(doColObjSearchSQL(doForCount)); break; case 1: sb.append(getLocalitySearchSQL(doForCount)); break; case 2: sb.append(doCollEventSearchSQL(doForCount)); break; case 3: sb.append(doTaxonSearchSQL(doForCount)); break; } System.err.println(latMin + ", " + lonMin + " " + latMax + ", " + lonMax); boxSB.append(String.format(" %8.5f, %8.5f, 10\n", lonMin, latMin)); boxSB.append(String.format(" %8.5f, %8.5f, 10\n", lonMin, latMax)); boxSB.append(String.format(" %8.5f, %8.5f, 10\n", lonMax, latMax)); boxSB.append(String.format(" %8.5f, %8.5f, 10\n", lonMax, latMin)); String whereSQL = String.format( " Latitude1 >= %10.5f AND Latitude1 <= %10.5f AND Longitude1 >= %10.5f AND Longitude1 <= %10.5f", latMin, latMax, lonMin, lonMax); String sql = String.format(sb.toString(), whereSQL); //System.err.println(sql); return sql; }
From source file:org.jlinda.core.coregistration.estimation.utils.MathUtils.java
/** * Computes the maximum value in the given array. * * @param values/*from www .j a va2s . co m*/ * @return the maximum value in the given array. */ public static double maxValue(double[] values) { double maxValue = Double.MIN_VALUE; for (double val : values) { maxValue = (maxValue < val) ? val : maxValue; } return maxValue; }
From source file:com.sun.faces.util.Util.java
/** * @return true if and only if the argument * <code>attributeVal</code> is an instance of a wrapper for a * primitive type and its value is equal to the default value for * that type as given in the spec. *//*from w ww .j a v a2s. c o m*/ private static boolean shouldRenderAttribute(Object attributeVal) { if (attributeVal instanceof Boolean && ((Boolean) attributeVal).booleanValue() == Boolean.FALSE.booleanValue()) { return false; } else if (attributeVal instanceof Integer && ((Integer) attributeVal).intValue() == Integer.MIN_VALUE) { return false; } else if (attributeVal instanceof Double && ((Double) attributeVal).doubleValue() == Double.MIN_VALUE) { return false; } else if (attributeVal instanceof Character && ((Character) attributeVal).charValue() == Character.MIN_VALUE) { return false; } else if (attributeVal instanceof Float && ((Float) attributeVal).floatValue() == Float.MIN_VALUE) { return false; } else if (attributeVal instanceof Short && ((Short) attributeVal).shortValue() == Short.MIN_VALUE) { return false; } else if (attributeVal instanceof Byte && ((Byte) attributeVal).byteValue() == Byte.MIN_VALUE) { return false; } else if (attributeVal instanceof Long && ((Long) attributeVal).longValue() == Long.MIN_VALUE) { return false; } return true; }
From source file:org.matsim.pt2matsim.gtfs.GtfsFeedImpl.java
@Override public double[] transform(String targetCoordinateSystem) { double minE = Double.MAX_VALUE, minN = Double.MAX_VALUE, maxE = Double.MIN_VALUE, maxN = Double.MIN_VALUE; CoordinateTransformation transformation = TransformationFactory.getCoordinateTransformation(coordSys, targetCoordinateSystem);/* www .java2 s . c o m*/ for (Stop stop : stops.values()) { ((StopImpl) stop).setCoord(transformation.transform(stop.getCoord())); if (stop.getCoord().getX() > maxE) maxE = stop.getCoord().getX(); if (stop.getCoord().getY() > maxN) maxN = stop.getCoord().getY(); if (stop.getCoord().getX() < minE) minE = stop.getCoord().getX(); if (stop.getCoord().getY() < minN) minN = stop.getCoord().getY(); } for (RouteShape routeShape : this.shapes.values()) { ((GtfsShape) routeShape).transformCoords(transformation); } this.coordSys = targetCoordinateSystem; return new double[] { minE, minN, maxE, maxN }; }
From source file:de.tudarmstadt.tk.statistics.report.ReportGenerator.java
/** * Creates a report of the statistical evaluation in the Latex-format * //from ww w .j a va 2 s. c o m * @param outputFolder * the folder where the report will be written later to store * related images etc. there * @param evalResults * an object of type {@link EvaluationResults} comprising the * results of the statistical evaluation * @return A String representing the report of the statistical evaluation in * Latex-format */ public String createLatexReport(File outputFolder) { // Set locale to English globally to make reports independent of the // machine thei're created on, e.g. use "." as decimal points on any // machine Locale.setDefault(Locale.ENGLISH); StringBuilder report = new StringBuilder(); Statistics stats = Statistics.getInstance(true); HashMap<String, String> methodsSummary = new HashMap<String, String>(); HashMap<String, HashMap<String, List<String>>> testSummary = new HashMap<String, HashMap<String, List<String>>>(); ArrayList<String[]> figures = new ArrayList<String[]>(); testSummary.put("Parametric", new HashMap<String, List<String>>()); testSummary.put("Non-Parametric", new HashMap<String, List<String>>()); String outputFolderPath = ""; if (outputFolder != null) { outputFolderPath = outputFolder.getAbsolutePath(); } // // Header // // Packages report.append("\\documentclass[a4paper,12pt]{article}\n"); report.append("\\usepackage[english]{babel}\n"); report.append("\\usepackage[utf8]{inputenc}\n"); report.append("\\usepackage{graphicx}\n"); report.append("\\usepackage{titlesec}\n"); report.append("\\usepackage{caption}\n"); report.append("\\usepackage{subcaption}\n"); report.append("\\usepackage{adjustbox}\n"); report.append("\\usepackage{placeins}\n"); report.append("\\usepackage{longtable}\n"); report.append("\\usepackage{morefloats}\n"); // Title definition report.append("\\titleformat*{\\section}{\\large\\bfseries}\n"); report.append("\\titleformat*{\\subsection}{\\normalsize\\bfseries}\n"); report.append("\\titleformat*{\\subsubsection}{\\vspace{-0.3cm}\\normalsize\\bfseries}\n"); report.append("\\title{Statistical Evaluation Report}\n"); report.append("\\date{\\vspace{-10ex}}\n"); report.append("\\begin{document}\n"); report.append("\\maketitle\n"); // // Evaluation Overview // report.append("\\section{Evaluation Overview}"); int nModels = evalResults.getSampleData().getModelMetadata().size(); ArrayList<String> measures = evalResults.getMeasures(); int nSamples = evalResults.getSampleData().getSamples().get(measures.get(0)).get(0).size(); String ref = "tbl:models"; // Separate training/testing datasets List<String> trainingDataList = new ArrayList<String>(); List<String> testingDataList = new ArrayList<String>(); List<Pair<String, String>> datasets = evalResults.getSampleData().getDatasetNames(); Iterator<Pair<String, String>> itp = datasets.iterator(); while (itp.hasNext()) { Pair<String, String> trainTest = itp.next(); trainingDataList.add(trainTest.getKey()); if (trainTest.getValue() != null) { testingDataList.add(trainTest.getValue()); } } Set<String> trainingDataSet = new HashSet<String>(trainingDataList); Set<String> testingDataSet = new HashSet<String>(testingDataList); String pipelineDescription = null; String sampleOrigin = "per CV"; ReportTypes pipelineType = this.evalResults.getSampleData().getPipelineType(); switch (pipelineType) { // One-domain n-fold CV (ReportData=per Fold) case CV: pipelineDescription = String.format("%d-fold cross validation", evalResults.getSampleData().getnFolds()); sampleOrigin = "per fold "; break; case MULTIPLE_CV: pipelineDescription = String.format("%dx%s repeated cross validation", evalResults.getSampleData().getnRepetitions(), evalResults.getSampleData().getnFolds()); break; case CV_DATASET_LVL: pipelineDescription = String.format("%d-fold cross validation over %d datasets", evalResults.getSampleData().getnFolds(), trainingDataSet.size()); break; case MULTIPLE_CV_DATASET_LVL: pipelineDescription = String.format("%dx%s repeated cross validation over %d datasets", evalResults.getSampleData().getnRepetitions(), evalResults.getSampleData().getnFolds(), trainingDataSet.size()); sampleOrigin = "per dataset"; break; case TRAIN_TEST_DATASET_LVL: // In the train/test scenario, the number of datasets only includes // distinct ones Set<String> allDataSets = new HashSet<String>(testingDataSet); allDataSets.addAll(trainingDataSet); pipelineDescription = String.format("Train/Test over %d datasets", allDataSets.size()); sampleOrigin = "per dataset"; break; default: pipelineDescription = "!unknown pipeline type!"; sampleOrigin = "!unknown pipeline type!"; break; } boolean isBaselineEvaluation = evalResults.isBaselineEvaluation(); report.append(String.format("The system performed a %s for the %d models in Tbl \\ref{%s}. ", pipelineDescription, nModels, ref)); if (isBaselineEvaluation) { report.append(String.format("The models were compared against the first baseline model. \n", pipelineDescription, nModels, ref)); } else { report.append(String.format("The models were compared against each other. \n", pipelineDescription, nModels, ref)); } String[][] values = new String[nModels][3]; for (int r = 0; r < nModels; r++) { values[r][0] = String.format("M%d", r); // Remove package prefix for algorithms, e.g. shorten "trees.J48" to "J48". String[] algorithm = evalResults.getSampleData().getModelMetadata().get(r).getKey().split("\\."); values[r][1] = escapeLatexCharacters(algorithm[algorithm.length - 1]); values[r][2] = escapeLatexCharacters(evalResults.getSampleData().getModelMetadata().get(r).getValue()); } String table = createLatexTable("Evaluated models with classifier algorithm and feature sets", ref, new String[] { "Index", "Algorithm", "Feature Set" }, "|l|l|p{11cm}|", values); report.append(table); // List test/training datasets. Consider the case when these sets are // different. if (testingDataSet.isEmpty()) { if (trainingDataSet.size() == 1) { report.append( String.format("The models were evaluated on the dataset %s. ", trainingDataList.get(0))); } else { report.append(String.format("The models were evaluated on the datasets %s. ", this.createEnumeration(trainingDataList))); } } else { if (trainingDataSet.size() == 1 && testingDataSet.size() == 1) { report.append( String.format("The models were trained on the dataset %s and tested on the dataset %s. ", trainingDataList.get(0), testingDataList.get(0))); } else if (trainingDataSet.size() > 1 && testingDataSet.size() == 1) { report.append(String.format( "The models were trained on the datasets %s and tested on the dataset %s. ", this.createEnumeration(new ArrayList<String>(trainingDataSet)), testingDataList.get(0))); } else if (trainingDataSet.size() == 1 && testingDataSet.size() > 1) { report.append(String.format( "The models were trained on the dataset %s and tested on the datasets %s. ", trainingDataList.get(0), this.createEnumeration(new ArrayList<String>(testingDataSet)))); } else { report.append( String.format("The models were trained on the datasets %s and tested on the datasets %s. ", this.createEnumeration(new ArrayList<String>(trainingDataSet)), this.createEnumeration(new ArrayList<String>(testingDataSet)))); } } report.append(String.format("Their performance was assessed with the %s", createEnumeration(measures))); report.append( ". In the analysis, the models thus represent levels of the independent variable, while the performance measures are dependent variables.\n"); // // Results (for each measure separately) // report.append("\\FloatBarrier\n"); // All previous floats must be placed // before this point report.append("\\section{Results}\n"); report.append(String.format( "Throughout the report, p-values are annotated if they are significant. While {\\footnotesize *} indicates low significance ($p<\\alpha=%.2f$), the annotations {\\footnotesize **} and {\\footnotesize ***} represent medium ($p<\\alpha=%.2f$) and high significance ($p<\\alpha=%.2f$).", significance_low, significance_medium, significance_high)); for (int i = 0; i < measures.size(); i++) { /* * Create table with samples for the current performance measure If * samples are drawn over multiple datasets, transpose table */ String measure = measures.get(i); if (!evalResults.getSampleData().getSamples().containsKey(measure)) { continue; } ArrayList<ArrayList<Double>> measureSamples = evalResults.getSampleData().getSamples().get(measure); ArrayList<Double> averageMeasureSamples = evalResults.getSampleData().getSamplesAverage().get(measure); report.append("\\FloatBarrier\n"); report.append(String.format("\\subsection{%s}\n", measure)); ref = String.format("tbl:%s", measure.replaceAll("\\s", "")); report.append(String.format( "The %s samples drawn from the %s and the %d models are presented in Tbl. \\ref{%s}.\n", measure, pipelineDescription, nModels, ref)); // Plot Box-Whisker-Diagram of samples for the current measure and add the figure to the appendix // Use the min/max sample value as indicators for the box-plots limits String filename = String.format("boxPlot%s", measure.replaceAll("\\s", "")); String path = String.format("%s%s%s", outputFolderPath, File.separator, filename); String pathR = this.fixSlashes(path); String figRef = String.format("fig:boxPlot%s", measure.replaceAll("\\s", "")); String caption = String.format("Box-Whisker-Plot of %s samples. Red dots indicate means.", measure); double[][] samples = new double[nModels][]; double minSample = Double.MAX_VALUE; double maxSample = Double.MIN_VALUE; for (int k = 0; k < nModels; k++) { ArrayList<Double> s = measureSamples.get(k); samples[k] = new double[s.size()]; for (int j = 0; j < s.size(); j++) { samples[k][j] = s.get(j); if (minSample > s.get(j)) { minSample = s.get(j); } if (maxSample < s.get(j)) { maxSample = s.get(j); } } } double sampleRange = maxSample - minSample; int lowerLimit = (int) Math.floor(minSample - sampleRange * 0.1); int upperLimit = (int) Math.ceil(maxSample + sampleRange * 0.1); boolean successful = stats.plotBoxWhisker(samples, lowerLimit, upperLimit, pathR, measure); if (successful) { figures.add(new String[] { figRef, caption, filename }); report.append( String.format("See Fig. \\ref{%s} for a Box-Whisker plot of these samples. ", figRef)); } caption = String.format("Samples of the %s drawn from the %s and the %d models", measure, pipelineDescription, nModels); switch (pipelineType) { case CV: case MULTIPLE_CV: values = new String[nModels + 1][nSamples + 2]; for (int r = 0; r <= nModels; r++) { // First line of table = Fold indices if (r == 0) { values[r][0] = ""; values[r][nSamples + 1] = ""; for (int f = 1; f <= nSamples; f++) { values[r][f] = Integer.toString(f); } // Next lines with model indices, samples per fold and // average measure over all samples } else { values[r][0] = String.format("M%d", (r - 1)); //values[r][nSamples + 1] = String.format("%.2f", averageMeasureSamples.get(r - 1) * 100); values[r][nSamples + 1] = String.format("%.2f", averageMeasureSamples.get(r - 1)); ArrayList<Double> s = measureSamples.get(r - 1); for (int j = 0; j < s.size(); j++) { //values[r][j + 1] = String.format("%.2f", s.get(j) * 100); values[r][j + 1] = String.format("%.2f", s.get(j)); } } } if (values.length > 58) { table = createLatexLongTable(caption, ref, new String[] { "Classifier", String.format("\\multicolumn{%d}{|c|}{%s %s}", nSamples, measure, sampleOrigin), "Average" }, String.format("|%s", StringUtils.repeat("l|", nSamples + 2)), values); } else { table = createLatexTable(caption, ref, new String[] { "Classifier", String.format("\\multicolumn{%d}{|c|}{%s %s}", nSamples, measure, sampleOrigin), "Average" }, String.format("|%s", StringUtils.repeat("l|", nSamples + 2)), values); } break; case CV_DATASET_LVL: case MULTIPLE_CV_DATASET_LVL: case TRAIN_TEST_DATASET_LVL: values = new String[nSamples + 2][nModels + 1]; // double[][] valuesNumeric = new double[nSamples][nModels]; for (int r = 0; r <= nSamples + 1; r++) { // First line of table = Model indices if (r == 0) { values[r][0] = ""; for (int j = 0; j < nModels; j++) { values[r][j + 1] = String.format("M%d", (j)); } // Last line of table = average sums } else if (r == nSamples + 1) { values[r][0] = "Average"; for (int j = 0; j < nModels; j++) { //values[r][j + 1] = String.format("%.2f", averageMeasureSamples.get(j) * 100); values[r][j + 1] = String.format("%.2f", averageMeasureSamples.get(j)); } // Next lines with model indices, samples per fold and // average measure over all samples } else { // Only print both train- and test set if there is more // than one training set Pair<String, String> trainTest = evalResults.getSampleData().getDatasetNames().get(r - 1); if (pipelineType == ReportTypes.TRAIN_TEST_DATASET_LVL) { if (trainingDataSet.size() > 1) { values[r][0] = String.format("%s-%s", trainTest.getKey(), trainTest.getValue()); } else { values[r][0] = trainTest.getValue(); } } else { values[r][0] = trainTest.getKey(); } for (int j = 0; j < nModels; j++) { ArrayList<Double> s = measureSamples.get(j); //values[r][j + 1] = String.format("%.2f", s.get(r - 1) * 100); values[r][j + 1] = String.format("%.2f", s.get(r - 1)); } } } if (values.length > 58) { table = createLatexLongTable(caption, ref, new String[] { "Dataset", String.format("\\multicolumn{%d}{|c|}{%s %s}", nModels, measure, sampleOrigin) }, String.format("|%s", StringUtils.repeat("l|", nModels + 1)), values); } else { table = createLatexTable(caption, ref, new String[] { "Dataset", String.format("\\multicolumn{%d}{|c|}{%s %s}", nModels, measure, sampleOrigin) }, String.format("|%s", StringUtils.repeat("l|", nModels + 1)), values); } break; } report.append(table); // // Results - First parametric tests, then non-parametric (2 // iterations) // Print results for alls non-parametric tests except McNemar. // McNemar is not based on the same performance measures but on a // contingency matrix, which is // printed in a separate section. for (String testType : new String[] { "Parametric", "Non-Parametric" }) { report.append(String.format("\\subsubsection{%s Testing}", testType)); Pair<String, AbstractTestResult> result = null; if (testType.equals("Parametric")) { result = evalResults.getParametricTestResults().get(measure); } else { result = evalResults.getNonParametricTestResults().get(measure); } // Use pretty-print method descriptor if specified String method = result.getKey(); if (StatsConfigConstants.PRETTY_PRINT_METHODS.containsKey(method)) { method = StatsConfigConstants.PRETTY_PRINT_METHODS.get(method); } methodsSummary.put(testType, method); TestResult r = (TestResult) result.getValue(); report.append( String.format("The system compared the %d models using the \\emph{%s}. ", nModels, method)); if (r != null && !Double.isNaN(r.getpValue())) { // A priori test: assumptions boolean assumptionViolated = false; Iterator<String> it = r.getAssumptions().keySet().iterator(); while (it.hasNext()) { String assumption = it.next(); TestResult at = (TestResult) r.getAssumptions().get(assumption); if (at == null) { report.append(String.format("Testing for %s failed. ", assumption)); assumptionViolated = true; continue; } if (Double.isNaN(at.getpValue())) { report.append( String.format("Testing for %s using %s failed. ", assumption, at.getMethod())); assumptionViolated = true; continue; } double ap = at.getpValue(); if (ap <= this.significance_low) { assumptionViolated = true; } // Verbalize result according to p value Pair<String, Double> verbalizedP = verbalizeP(ap, true); String testResultRepresentation = getTestResultRepresentation(at, verbalizedP.getValue()); report.append(String.format("%s %s violation of %s (%s). ", at.getMethod(), verbalizedP.getKey(), assumption, testResultRepresentation)); } // Create QQ-Normal diagram to support the analysis of a // normality assumption if (result.getKey().equals("DependentT") && samples.length == 2) { filename = String.format("qqNormPlot%s", measure.replaceAll("\\s", "")); path = String.format("%s%s%s", outputFolderPath, File.separator, filename); pathR = this.fixSlashes(path); figRef = String.format("fig:qqNormPlot%s", measure.replaceAll("\\s", "")); caption = String.format("QQ-Normal plot of pairwise differences between %s samples.", measure); double[] differences = new double[samples[0].length]; for (int j = 0; j < samples[0].length; j++) { differences[j] = samples[0][j] - samples[1][j]; } successful = stats.plotQQNorm(differences, "M0-M1", measure, pathR); if (successful) { figures.add(new String[] { figRef, caption, filename }); report.append(String.format("See Fig. \\ref{%s} for a QQ-Normal plot of the samples. ", figRef)); } } if (assumptionViolated) { report.append( "Given that the assumptions are violated, the following test may be corrupted. "); } // A Priori test results // Verbalize result according to p value Pair<String, Double> verbalizedP = verbalizeP(r.getpValue(), false); String testResultRepresentation = getTestResultRepresentation(r, verbalizedP.getValue()); report.append(String.format( "The %s %s differences between the performances of the models (%s).\\\\ \n\n ", method, verbalizedP.getKey(), testResultRepresentation)); // Store result for summary if (testSummary.get(testType).containsKey(verbalizedP.getKey())) { testSummary.get(testType).get(verbalizedP.getKey()).add(measure); } else { ArrayList<String> list = new ArrayList<String>(); list.add(measure); testSummary.get(testType).put(verbalizedP.getKey(), list); } // Post-hoc test for >2 models (pairwise comparisons) if (evalResults.getSampleData().getModelMetadata().size() > 2) { Pair<String, AbstractTestResult> postHocResult = null; if (testType.equals("Parametric")) { postHocResult = evalResults.getParametricPostHocTestResults().get(measure); } else { postHocResult = evalResults.getNonParametricPostHocTestResults().get(measure); } method = postHocResult.getKey(); if (StatsConfigConstants.PRETTY_PRINT_METHODS.containsKey(method)) { method = StatsConfigConstants.PRETTY_PRINT_METHODS.get(method); } methodsSummary.put(String.format("%sPostHoc", testType), method); PairwiseTestResult rPostHoc = (PairwiseTestResult) postHocResult.getValue(); report.append(String.format("The system performed the \\emph{%s} post-hoc. ", method)); if (rPostHoc == null) { report.append("The test failed. "); continue; } // Assumptions boolean assumptionsViolated = false; it = rPostHoc.getAssumptions().keySet().iterator(); while (it.hasNext()) { String assumption = it.next(); PairwiseTestResult at = (PairwiseTestResult) rPostHoc.getAssumptions().get(assumption); if (at == null) { report.append(String.format("Testing for %s failed. ", assumption)); assumptionsViolated = true; continue; } // Create table with pairwise p-values for // assumption testing double[][] ap = at.getpValue(); Pair<String[], String[][]> tableData = getPValueStringArray(ap, isBaselineEvaluation); // first // element // is // header, // second // are // values caption = String.format("P-values from the %s for %s", at.getMethod(), measure); ref = String.format("tbl:%s%s", at.getMethod().replaceAll("\\s", ""), measure.replaceAll("\\s", "")); table = createLatexTable(caption, ref, tableData.getKey(), String.format("|%s", StringUtils.repeat("l|", nModels)), tableData.getValue()); double max = getMax(ap); double min = getMin(ap); verbalizedP = verbalizeP(min, true); if ((max > significance_low && min <= significance_low) || (max > significance_medium && min <= significance_medium) || (max > significance_high && min <= significance_high)) { // partly significant to degree as specified by // verbalized p-value report.append(String.format( "%s partly %s violation of %s ($\\alpha=%.2f$, Tbl. \\ref{%s}).\n", at.getMethod(), verbalizedP.getKey(), assumption, verbalizedP.getValue(), ref)); } else { report.append(String.format( "%s %s violation of %s ($\\alpha=%.2f$, Tbl. \\ref{%s}).\n", at.getMethod(), verbalizedP.getKey(), assumption, verbalizedP.getValue(), ref)); } report.append(table); if (min <= this.significance_low) { assumptionsViolated = true; } } if (assumptionViolated) { report.append( "Given that the assumptions are violated, the following test may be corrupted. "); } // Result double[][] ap = rPostHoc.getpValue(); Pair<String[], String[][]> tableData = getPValueStringArray(ap, isBaselineEvaluation); // first // element // is // header, // second // are // values caption = String.format("P-values from the %s for %s", method, measure); ref = String.format("tbl:%s%s", method.replaceAll("\\s", ""), measure.replaceAll("\\s", "")); String formatting = null; if (!isBaselineEvaluation) { formatting = String.format("|%s", StringUtils.repeat("l|", nModels)); } else { formatting = String.format("|l|l|"); } String tablePNonAdjusted = createLatexTable(caption, ref, tableData.getKey(), formatting, tableData.getValue()); // Already fetch pairwise adjustments here in order to // determine choice of words double max = getMax(ap); double min = getMin(ap); verbalizedP = verbalizeP(min, false); ArrayList<StatsConfigConstants.CORRECTION_VALUES> adjustments = new ArrayList<StatsConfigConstants.CORRECTION_VALUES>( rPostHoc.getpValueCorrections().keySet()); String adjustWord = ""; if (adjustments.size() > 0) { adjustWord = " for non-adjusted p-values"; } if ((max > significance_low && min <= significance_low) || (max > significance_medium && min <= significance_medium) || (max > significance_high && min <= significance_high)) { // partly significant to degree as specified by // verbalized p-value report.append(String.format( "The %s partly %s differences between the performances of the models%s ($\\alpha=%.2f$, Tbl. \\ref{%s}). ", method, verbalizedP.getKey(), adjustWord, verbalizedP.getValue(), ref)); } else { report.append(String.format( "The %s %s differences between the performances of the models%s ($\\alpha=%.2f$, Tbl. \\ref{%s}). ", method, verbalizedP.getKey(), adjustWord, verbalizedP.getValue(), ref)); } // Determine ordering of models HashMap<Integer, TreeSet<Integer>> postHocOrdering = null; int[][] orderingEdgeList = null; if (testType.equals("Parametric")) { postHocOrdering = evalResults.getParameticPostHocOrdering().get(measure); orderingEdgeList = evalResults.getParameticPostHocEdgelist().get(measure); } else { postHocOrdering = evalResults.getNonParameticPostHocOrdering().get(measure); orderingEdgeList = evalResults.getNonParameticPostHocEdgelist().get(measure); } String ordering = getModelOrderingRepresentation(postHocOrdering); report.append(ordering); // Print graphs of ordering for the current measure and // add the figure to the appendix filename = String.format("graphOrdering%s%s", measure.replaceAll("\\s", ""), testType); path = String.format("%s%s%s", outputFolderPath, File.separator, filename); pathR = this.fixSlashes(path); figRef = String.format("fig:graphOrdering%s%s", measure.replaceAll("\\s", ""), testType); caption = String.format( "Directed graph of significant differences for %s, as indicated by the %s post-hoc test.", measure, testType.toLowerCase()); // int nodes[] = new int[nModels]; // for(int j=0; j<nModels;j++){nodes[j]=j;}; successful = stats.plotGraph(orderingEdgeList, nModels, pathR); if (successful) { figures.add(new String[] { figRef, caption, filename }); report.append(String.format("The ordering is visualized in Fig. \\ref{%s}. ", figRef)); } // Pairwise adjustments String tablePAdjusted = null; if (adjustments.size() > 0) { String[] subcaption = new String[adjustments.size()]; String[] header = null; String[][][] overallValues = new String[adjustments.size()][][]; double[] minAdjustments = new double[adjustments.size()]; double[] maxAdjustments = new double[adjustments.size()]; for (int j = 0; j < adjustments.size(); j++) { StatsConfigConstants.CORRECTION_VALUES adjustmentMethod = adjustments.get(j); subcaption[j] = adjustmentMethod.name(); double[][] correctedP = rPostHoc.getpValueCorrections().get(adjustmentMethod); if (StatsConfigConstants.PRETTY_PRINT_METHODS.containsKey(adjustmentMethod)) { subcaption[j] = StatsConfigConstants.PRETTY_PRINT_METHODS.get(adjustmentMethod); } tableData = getPValueStringArray(correctedP, isBaselineEvaluation); header = tableData.getKey(); overallValues[j] = tableData.getValue(); minAdjustments[j] = getMin(correctedP); maxAdjustments[j] = getMax(correctedP); } caption = String.format("Adjusted p-values from the %s for %s", method, measure); ref = String.format("tbl:%s%sAdjusted", method.replaceAll("\\s", ""), measure.replaceAll("\\s", "")); formatting = null; if (!isBaselineEvaluation) { formatting = String.format("|%s", StringUtils.repeat("l|", nModels)); } else { formatting = String.format("|l|l|"); } tablePAdjusted = createLatexSubTable(caption, subcaption, ref, header, formatting, overallValues); min = getMin(minAdjustments); max = getMax(maxAdjustments); verbalizedP = verbalizeP(min, false); if ((max > significance_low && min <= significance_low) || (max > significance_medium && min <= significance_medium) || (max > significance_high && min <= significance_high)) { // partly significant to degree as specified by // verbalized p-value report.append(String.format( "It partly %s differences for adjusted p-values ($\\alpha=%.2f$, Tbl. \\ref{%s}).\n\n ", verbalizedP.getKey(), verbalizedP.getValue(), ref)); } else { report.append(String.format( "It %s differences for adjusted p-values ($\\alpha=%.2f$, Tbl. \\ref{%s}).\n\n ", verbalizedP.getKey(), verbalizedP.getValue(), ref)); } } report.append(tablePNonAdjusted); if (tablePAdjusted != null) { report.append(tablePAdjusted); } } } else { report.append(String.format("The %s failed.", method)); } } } // // Contingency table and McNemar results if this test was performed // if (evalResults.getNonParametricTest().equals("McNemar")) { String measure = "Contingency Table"; String testType = "Non-Parametric"; report.append("\\FloatBarrier\n"); report.append("\\subsection{Contingency Table}\n"); String caption = String .format("Contingency table with correctly and incorrectly classified folds for %s", measure); if (evalResults.getSampleData().getPipelineType() == ReportTypes.MULTIPLE_CV) { report.append(String.format( "The contingency table drawn from the %s and the %d models is listed in Tbl. \\ref{%s}. The correctly and incorrectly classified instances per fold were averaged over all repetitions. \n", pipelineDescription, nModels, ref)); caption = String.format( "Averaged contingency table with correctly and incorrectly classified folds for %s", measure); } else { report.append(String.format( "The contingency table drawn from the %s and the %d models is listed in Tbl. \\ref{%s}.\n", pipelineDescription, nModels, ref)); } int[][] contingencyMatrix = evalResults.getSampleData().getContingencyMatrix(); ref = "tbl:ContingencyMatrix"; values = new String[][] { { "Wrong", "", "" }, { "Correct", "", "" } }; values[0][1] = String.valueOf(contingencyMatrix[0][0]); values[0][2] = String.valueOf(contingencyMatrix[0][1]); values[1][1] = String.valueOf(contingencyMatrix[1][0]); values[1][2] = String.valueOf(contingencyMatrix[1][1]); table = createLatexTable(caption, ref, new String[] { "M0/M1", "Wrong", "Correct" }, "|l|l|l|", values); report.append(table); // Test results report.append(String.format("\\subsubsection{%s Testing}", testType)); report.append( String.format("The system compared the %d models using the \\emph{McNemar test}. ", nModels)); Pair<String, AbstractTestResult> result = evalResults.getNonParametricTestResults().get(measure); // Use pretty-print method descriptor if specified String method = result.getKey(); if (StatsConfigConstants.PRETTY_PRINT_METHODS.containsKey(method)) { method = StatsConfigConstants.PRETTY_PRINT_METHODS.get(method); } methodsSummary.put(testType, method); TestResult r = (TestResult) result.getValue(); if (r != null && !Double.isNaN(r.getpValue())) { StringBuilder parameters = new StringBuilder(); Iterator<String> it = r.getParameter().keySet().iterator(); while (it.hasNext()) { String parameter = it.next(); double value = r.getParameter().get(parameter); parameters.append(String.format("%s=%.3f, ", parameter, value)); } // Verbalize result according to p value Pair<String, Double> verbalizedP = verbalizeP(r.getpValue(), false); report.append(String.format( "The test %s differences between the performances of the models ($%sp=%.3f, \\alpha=%.2f$).\\\\ \n", verbalizedP.getKey(), parameters.toString(), r.getpValue(), verbalizedP.getValue())); // Store result for summary if (testSummary.get(testType).containsKey(verbalizedP.getKey())) { testSummary.get(testType).get(verbalizedP.getKey()).add(measure); } else { ArrayList<String> list = new ArrayList<String>(); list.add(measure); testSummary.get(testType).put(verbalizedP.getKey(), list); } } else { report.append("The test failed.\\\\ \n"); } } // // Summary of results // report.append("\\FloatBarrier\n"); report.append("\\section{Summary}\n"); for (String testType : new String[] { "Parametric", "Non-Parametric" }) { String prefix = ""; if (nModels == 2) { report.append( String.format("The system performed %s testing of the %d models using a %s. The test ", testType.toLowerCase(), nModels, methodsSummary.get(testType))); prefix = "It"; } else { String postHocTesting = String.format("%sPostHoc", testType); report.append(String.format( "The system performed %s testing of the %d models using a %s and a %s post-hoc. The tests ", testType.toLowerCase(), nModels, methodsSummary.get(testType), methodsSummary.get(postHocTesting))); prefix = "They"; } // If all tests failed, there're no results to summarize. HashMap<String, List<String>> summary = testSummary.get(testType); if (summary.keySet().size() == 0) { report.append("failed. "); continue; } Iterator<String> it = summary.keySet().iterator(); boolean usePrefix = false; while (it.hasNext()) { String pVerbalization = it.next(); List<String> affectedMeasures = summary.get(pVerbalization); if (!usePrefix) { report.append(String.format("%s differences in performance for the %s. ", pVerbalization, createEnumeration(affectedMeasures))); } else { report.append(String.format("%s %s differences in performance for the %s. ", prefix, pVerbalization, createEnumeration(affectedMeasures))); } usePrefix = true; } report.append("\\\\ \n\n"); } // // Appendix // // Add all figures report.append("\\FloatBarrier\n"); report.append("\\section{Appendix}\n"); for (int i = 0; i < figures.size(); i++) { ref = figures.get(i)[0]; String caption = figures.get(i)[1]; String filename = figures.get(i)[2]; report.append("\\begin{figure}\n"); report.append("\\centering\n"); report.append(String.format("\\includegraphics[width=1\\linewidth]{%s}\n", filename)); report.append(String.format("\\caption{%s}\n", caption)); report.append(String.format("\\label{%s}\n", ref)); report.append("\\end{figure}\n\n"); } // Close document report.append("\\end{document}"); return report.toString(); }
From source file:main.ScorePipeline.java
/** * This method calculates similarities bin-based between yeast_human spectra * on the first data set against all yeast spectra on the second data set * * @param min_mz//from www .j a v a2s . com * @param max_mz * @param topN * @param percentage * @param yeast_and_human_file * @param is_precursor_peak_removal * @param fragment_tolerance * @param noiseFiltering * @param transformation * @param intensities_sum_or_mean_or_median * @param yeast_spectra * @param bw * @param charge * @param charge_situation * @throws IllegalArgumentException * @throws ClassNotFoundException * @throws IOException * @throws MzMLUnmarshallerException * @throws NumberFormatException * @throws ExecutionException * @throws InterruptedException */ private static void calculate_BinBasedScores(ArrayList<BinMSnSpectrum> yeast_spectra, ArrayList<BinMSnSpectrum> yeast_human_spectra, BufferedWriter bw, int charge, double precursorTol, double fragTol, String scoreType) throws IllegalArgumentException, ClassNotFoundException, IOException, MzMLUnmarshallerException, NumberFormatException, InterruptedException { ExecutorService excService = Executors .newFixedThreadPool(ConfigHolder.getInstance().getInt("thread.numbers")); List<Future<SimilarityResult>> futureList = new ArrayList<>(); for (BinMSnSpectrum binYeastHumanSp : yeast_human_spectra) { int tmpMSCharge = binYeastHumanSp.getSpectrum().getPrecursor().getPossibleCharges().get(0).value; if (charge == 0 || tmpMSCharge == charge) { if (!binYeastHumanSp.getSpectrum().getPeakList().isEmpty() && !yeast_spectra.isEmpty()) { Calculate_Similarity similarity = new Calculate_Similarity(binYeastHumanSp, yeast_spectra, fragTol, precursorTol); Future future = excService.submit(similarity); futureList.add(future); } } } SimilarityMethods method = SimilarityMethods.NORMALIZED_DOT_PRODUCT_STANDARD; if (scoreType.equals("spearman")) { method = SimilarityMethods.SPEARMANS_CORRELATION; } else if (scoreType.equals("pearson")) { method = SimilarityMethods.PEARSONS_CORRELATION; } for (Future<SimilarityResult> future : futureList) { try { SimilarityResult get = future.get(); String tmp_charge = get.getSpectrumChargeAsString(), spectrum = get.getSpectrumName(); double tmpPrecMZ = get.getSpectrumPrecursorMZ(), score = get.getScores().get(method); if (score == 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" + "\t" + "NA" + "\t" + "NA" + "\t" + "NA"); } else { bw.write(spectrum + "\t" + tmp_charge + "\t" + tmpPrecMZ + "\t" + get.getSpectrumToCompare() + "\t" + score + "\n"); } } catch (InterruptedException | ExecutionException e) { LOGGER.error(e); } } }
From source file:uk.ac.leeds.ccg.andyt.generic.visualisation.charts.Generic_ScatterPlotAndLinearRegression.java
/** * * * @param data/* ww w . ja v a 2 s . co m*/ * @return */ public static double[][] getYEqualsXLineData(double[][] data) { double[][] lineChartData = new double[2][2]; // minx is the minimum x value in data[1] double minx = Double.MAX_VALUE; // maxx is the maximum x value in data[1] double maxx = Double.MIN_VALUE; // miny is the minimum y value in data[0] double miny = Double.MAX_VALUE; // maxy is the maximum y value in data[1] double maxy = Double.MIN_VALUE; for (int j = 0; j < data[0].length; j++) { miny = Math.min(miny, data[0][j]); maxy = Math.max(maxy, data[0][j]); minx = Math.min(minx, data[1][j]); maxx = Math.max(maxx, data[1][j]); } lineChartData[0][0] = miny; lineChartData[0][1] = maxy; lineChartData[1][0] = minx; lineChartData[1][1] = maxx; //System.out.println("miny " + miny); if (maxy == Double.MIN_VALUE) { maxy = miny; } //System.out.println("maxy " + maxy); //System.out.println("minx " + minx); if (maxx == Double.MIN_VALUE) { maxx = minx; } //System.out.println("maxx " + maxx); if (maxx < maxy) { lineChartData[0][1] = maxx; } else { lineChartData[1][1] = maxy; } if (minx > miny) { lineChartData[0][0] = minx; } else { lineChartData[1][0] = miny; } return lineChartData; }
From source file:oscar.form.study.HSFO.pageUtil.XMLTransferUtil.java
public void addVisitData(SitePatient patient, VisitData vsd) { String date = dformat2.format(vsd.getVisitDate_Id()); String signT = dformat1.format(vsd.getFormEdited()); String signT2 = dformat2.format(vsd.getFormEdited()); XmlCalendar when = new XmlCalendar(signT); XmlCalendar when2 = new XmlCalendar(signT2); String who = getProviderName(vsd.getProvider_Id()); SitePatientVisit spvs = patient.addNewSitePatientVisit(); spvs.setVisitDateKey(new XmlCalendar(date)); String co = vsd.getDrugcoverage(); if (co != null) { SelAdequateDrugCoverage sadc = spvs.addNewSelAdequateDrugCoverage(); if ("yes".equalsIgnoreCase(co)) sadc.setValue(StringYesNo.YES); else if ("no".equalsIgnoreCase(co)) sadc.setValue(StringYesNo.NO); else if ("null".equalsIgnoreCase(co)) sadc.setValue(StringYesNo.X); sadc.setSignedWhen(when);// w w w .j a v a2 s . co m sadc.setSignedWho(who); } String hdt = vsd.getHtnDxType(); if (hdt != null) { SelHtnDxType shdt = spvs.addNewSelHtnDxType(); if ("PrimaryHtn".equalsIgnoreCase(hdt)) shdt.setValue(StringHtnDxType.PRIMARY_HTN); else if ("ElevatedBpReadings".equalsIgnoreCase(hdt)) shdt.setValue(StringHtnDxType.ELEVATED_BP_READINGS); else if ("null".equalsIgnoreCase(hdt)) shdt.setValue(StringHtnDxType.X); shdt.setSignedWhen(when); shdt.setSignedWho(who); } BHxDyslipidemia bhd = spvs.addNewBHxDyslipidemia(); bhd.setValue(vsd.isDyslipid()); bhd.setSignedWhen(when); bhd.setSignedWho(who); BHxDM bhdm = spvs.addNewBHxDM(); bhdm.setValue(vsd.isDiabetes()); bhdm.setSignedWhen(when); bhdm.setSignedWho(who); BHxKidney bhk = spvs.addNewBHxKidney(); bhk.setValue(vsd.isKidneyDis()); bhk.setSignedWhen(when); bhk.setSignedWho(who); BHxObesity bho = spvs.addNewBHxObesity(); bho.setValue(vsd.isObesity()); bho.setSignedWhen(when); bho.setSignedWho(who); BHxCHD bhchd = spvs.addNewBHxCHD(); bhchd.setValue(vsd.isCHD()); bhchd.setSignedWhen(when); bhchd.setSignedWho(who); BHxStrokeTIA bhst = spvs.addNewBHxStrokeTIA(); bhst.setValue(vsd.isStroke_TIA()); bhst.setSignedWhen(when); bhst.setSignedWho(who); BFamHxHtn bfhh = spvs.addNewBFamHxHtn(); bfhh.setValue(vsd.isFamHx_Htn()); bfhh.setSignedWhen(when); bfhh.setSignedWho(who); BFamHxDyslipidemia bfhdp = spvs.addNewBFamHxDyslipidemia(); bfhdp.setValue(vsd.isFamHx_Dyslipid()); bfhdp.setSignedWhen(when); bfhdp.setSignedWho(who); BFamHxDM bfhdm = spvs.addNewBFamHxDM(); bfhdm.setValue(vsd.isFamHx_Diabetes()); bfhdm.setSignedWhen(when); bfhdm.setSignedWho(who); BFamHxKidney bfhk = spvs.addNewBFamHxKidney(); bfhk.setValue(vsd.isFamHx_KidneyDis()); bfhk.setSignedWhen(when); bfhk.setSignedWho(who); BFamHxObesity bfho = spvs.addNewBFamHxObesity(); bfho.setValue(vsd.isFamHx_Obesity()); bfho.setSignedWhen(when); bfho.setSignedWho(who); BFamHxCHD bfhchd = spvs.addNewBFamHxCHD(); bfhchd.setValue(vsd.isFamHx_CHD()); bfhchd.setSignedWhen(when); bfhchd.setSignedWho(who); BFamHxStrokeTIA bfhstia = spvs.addNewBFamHxStrokeTIA(); bfhstia.setValue(vsd.isFamHx_Stroke_TIA()); bfhstia.setSignedWhen(when); bfhstia.setSignedWho(who); int tempi = vsd.getSBP(); if (tempi != Integer.MIN_VALUE) { IntSBPMmHg isbgmh = spvs.addNewIntSBPMmHg(); if (tempi != 0) isbgmh.setValue(tempi); isbgmh.setSignedWhen(when); isbgmh.setSignedWho(who); } tempi = vsd.getDBP(); if (tempi != Integer.MIN_VALUE) { IntDBPMmHg idbgmh = spvs.addNewIntDBPMmHg(); idbgmh.setValue(vsd.getDBP()); idbgmh.setSignedWhen(when); idbgmh.setSignedWho(who); } String used = vsd.getBptru_used(); if (used != null) { SelBpTru sbt = spvs.addNewSelBpTru(); if ("yes".equalsIgnoreCase(used)) sbt.setValue(StringYesNo.YES); else if ("no".equalsIgnoreCase(used)) sbt.setValue(StringYesNo.NO); else if ("null".equalsIgnoreCase(used)) sbt.setValue(StringYesNo.X); sbt.setSignedWhen(when); sbt.setSignedWho(who); } tempi = vsd.getSBP_goal(); if (tempi != Integer.MIN_VALUE) { IntSbpGoalMmHg isgmh = spvs.addNewIntSbpGoalMmHg(); if (tempi != 0) isgmh.setValue(tempi); isgmh.setSignedWhen(when); isgmh.setSignedWho(who); } tempi = vsd.getDBP_goal(); if (tempi != Integer.MIN_VALUE) { IntDbpGoalMmHg idgmh = spvs.addNewIntDbpGoalMmHg(); idgmh.setValue(vsd.getDBP_goal()); idgmh.setSignedWhen(when); idgmh.setSignedWho(who); } double tempd = vsd.getWeight(); if (tempd != Double.MIN_VALUE) { DblWeight dw = spvs.addNewDblWeight(); if (vsd.getWeight() != 0) dw.setValue(vsd.getWeight()); dw.setSignedWhen(when); dw.setSignedWho(who); String wunit = vsd.getWeight_unit(); if (wunit != null) { SelWeightUnit swu = spvs.addNewSelWeightUnit(); if ("kg".equalsIgnoreCase(wunit)) swu.setValue(StringMassUnit.KG); else if ("lb".equalsIgnoreCase(wunit)) swu.setValue(StringMassUnit.LBS); else if ("null".equalsIgnoreCase(wunit)) swu.setValue(StringMassUnit.X); swu.setSignedWhen(when); swu.setSignedWho(who); } } tempd = vsd.getWaist(); if (tempd != Double.MIN_VALUE) { DblWaistCircumf dwc = spvs.addNewDblWaistCircumf(); if (vsd.getWaist() != 0) dwc.setValue(vsd.getWaist()); dwc.setSignedWhen(when); dwc.setSignedWho(who); String waistu = vsd.getWaist_unit(); if (waistu != null) { SelWaistCircumfUnit swcu = spvs.addNewSelWaistCircumfUnit(); if ("cm".equalsIgnoreCase(waistu)) swcu.setValue(StringLengthUnit.CM); else if ("inch".equalsIgnoreCase(waistu)) swcu.setValue(StringLengthUnit.INCHES); else if ("null".equalsIgnoreCase(waistu)) swcu.setValue(StringLengthUnit.X); swcu.setSignedWhen(when); swcu.setSignedWho(who); } } tempd = vsd.getTC_HDL(); if (tempd != Double.MIN_VALUE) { DblTCtoHDL dtchdl = spvs.addNewDblTCtoHDL(); if (vsd.getTC_HDL() != 0) dtchdl.setValue(vsd.getTC_HDL()); dtchdl.setSignedWhen(when); dtchdl.setSignedWho(who); Date hdldate = vsd.getTC_HDL_LabresultsDate(); if (hdldate == null) dtchdl.setValueDate(when2); else dtchdl.setValueDate(new XmlCalendar(dformat2.format(hdldate))); } tempd = vsd.getLDL(); if (tempd != Double.MIN_VALUE) { DblLDLMM dldlmm = spvs.addNewDblLDLMM(); if (vsd.getLDL() != 0) dldlmm.setValue(vsd.getLDL()); dldlmm.setSignedWhen(when); dldlmm.setSignedWho(who); Date ldldate = vsd.getLDL_LabresultsDate(); if (ldldate == null) dldlmm.setValueDate(when2); else dldlmm.setValueDate(new XmlCalendar(dformat2.format(ldldate))); } tempd = vsd.getHDL(); if (tempd != Double.MIN_VALUE) { DblHDLMM dhdlmm = spvs.addNewDblHDLMM(); if (vsd.getHDL() != 0) dhdlmm.setValue(vsd.getHDL()); dhdlmm.setSignedWhen(when); dhdlmm.setSignedWho(who); Date ldldate = vsd.getHDL_LabresultsDate(); if (ldldate == null) dhdlmm.setValueDate(when2); else dhdlmm.setValueDate(new XmlCalendar(dformat2.format(ldldate))); } tempd = vsd.getA1C(); if (tempd != Double.MIN_VALUE) { DblA1CPercent dacp = spvs.addNewDblA1CPercent(); if (vsd.getA1C() != 0) dacp.setValue(vsd.getA1C()); dacp.setSignedWhen(when); dacp.setSignedWho(who); Date ldldate = vsd.getA1C_LabresultsDate(); if (ldldate == null) dacp.setValueDate(when2); else dacp.setValueDate(new XmlCalendar(dformat2.format(ldldate))); } BRiskWeight brwt = spvs.addNewBRiskWeight(); brwt.setValue(vsd.isRisk_weight()); brwt.setSignedWhen(when); brwt.setSignedWho(who); BRiskPhysActivity brpa = spvs.addNewBRiskPhysActivity(); brpa.setValue(vsd.isRisk_activity()); brpa.setSignedWhen(when); brpa.setSignedWho(who); BRiskDiet brdt = spvs.addNewBRiskDiet(); brdt.setValue(vsd.isRisk_diet()); brdt.setSignedWhen(when); brdt.setSignedWho(who); BRiskSmoking brsk = spvs.addNewBRiskSmoking(); brsk.setValue(vsd.isRisk_smoking()); brsk.setSignedWhen(when); brsk.setSignedWho(who); BRiskAlcohol brah = spvs.addNewBRiskAlcohol(); brah.setValue(vsd.isRisk_alcohol()); brah.setSignedWhen(when); brah.setSignedWho(who); BRiskStress brst = spvs.addNewBRiskStress(); brst.setValue(vsd.isRisk_stress()); brst.setSignedWhen(when); brst.setSignedWho(who); String life = vsd.getLifeGoal(); boolean pa = false, dietdash = false, dietsalt = false, smoking = false, alcohol = false, stress = false; if ("Goal_activity".equalsIgnoreCase(life)) pa = true; else if ("Goal_dietDash".equalsIgnoreCase(life)) dietdash = true; else if ("Goal_dietSalt".equalsIgnoreCase(life)) dietsalt = true; else if ("Goal_smoking".equalsIgnoreCase(life)) smoking = true; else if ("Goal_alcohol".equalsIgnoreCase(life)) alcohol = true; else if ("Goal_stress".equals(life)) stress = true; BGoalPhysActivity bgpa = spvs.addNewBGoalPhysActivity(); bgpa.setValue(pa); bgpa.setSignedWhen(when); bgpa.setSignedWho(who); BGoalDASHDiet bgdash = spvs.addNewBGoalDASHDiet(); bgdash.setValue(dietdash); bgdash.setSignedWhen(when); bgdash.setSignedWho(who); BGoalSalt bgs = spvs.addNewBGoalSalt(); bgs.setValue(dietsalt); bgs.setSignedWhen(when); bgs.setSignedWho(who); BGoalSmoking bgsm = spvs.addNewBGoalSmoking(); bgsm.setValue(smoking); bgsm.setSignedWhen(when); bgsm.setSignedWho(who); BGoalAlcohol bga = spvs.addNewBGoalAlcohol(); bga.setValue(alcohol); bga.setSignedWhen(when); bga.setSignedWho(who); BGoalStress bgst = spvs.addNewBGoalStress(); bgst.setValue(stress); bgst.setSignedWhen(when); bgst.setSignedWho(who); String pView = vsd.getPtView(); if (pView != null) { SelPatientView spv = spvs.addNewSelPatientView(); if ("Uninterested".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.UNINTERESTED); else if ("Thinking".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.THINKING); else if ("Deciding".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.DECIDING); else if ("TakingAction".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.TAKING_ACTION); else if ("Maintaining".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.MAINTAINING); else if ("Relapsing".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.RELAPSING); else if ("null".equalsIgnoreCase(pView)) spv.setValue(StringPtChangeState.X); spv.setSignedWhen(when); spv.setSignedWho(who); } tempi = vsd.getChange_importance(); if (tempi != Integer.MIN_VALUE) { IntGoalImportance igi = spvs.addNewIntGoalImportance(); if (vsd.getChange_importance() != 0) igi.setValue(vsd.getChange_importance()); igi.setSignedWhen(when); igi.setSignedWho(who); } tempi = vsd.getChange_confidence(); if (tempi != Integer.MIN_VALUE) { IntGoalConfidence igc = spvs.addNewIntGoalConfidence(); if (vsd.getChange_confidence() != 0) igc.setValue(vsd.getChange_confidence()); igc.setSignedWhen(when); igc.setSignedWho(who); } tempi = vsd.getExercise_minPerWk(); if (tempi != Integer.MIN_VALUE) { IntExerciseMinPerWk ieampw = spvs.addNewIntExerciseMinPerWk(); ieampw.setValue(vsd.getExercise_minPerWk()); ieampw.setSignedWhen(when); ieampw.setSignedWho(who); } tempi = vsd.getSmoking_cigsPerDay(); if (tempi != Integer.MIN_VALUE) { IntSmokingCigsPerDay iscpd = spvs.addNewIntSmokingCigsPerDay(); iscpd.setValue(vsd.getSmoking_cigsPerDay()); iscpd.setSignedWhen(when); iscpd.setSignedWho(who); } tempi = vsd.getAlcohol_drinksPerWk(); if (tempi != Integer.MIN_VALUE) { IntAlcoholDrinksPerWk iadpwk = spvs.addNewIntAlcoholDrinksPerWk(); iadpwk.setValue(vsd.getAlcohol_drinksPerWk()); iadpwk.setSignedWhen(when); iadpwk.setSignedWho(who); } String ddiet = vsd.getSel_DashDiet(); if (ddiet != null) { SelDASHdiet sdash = spvs.addNewSelDASHdiet(); if ("Always".equalsIgnoreCase(ddiet)) sdash.setValue(StringFrequency.ALWAYS); else if ("Often".equalsIgnoreCase(ddiet)) sdash.setValue(StringFrequency.OFTEN); else if ("Sometimes".equalsIgnoreCase(ddiet)) sdash.setValue(StringFrequency.SOMETIMES); else if ("Never".equalsIgnoreCase(ddiet)) sdash.setValue(StringFrequency.NEVER); else sdash.setValue(StringFrequency.X); sdash.setSignedWhen(when); sdash.setSignedWho(who); } String ssalt = vsd.getSel_HighSaltFood(); if (ssalt != null) { SelHighSalt shs = spvs.addNewSelHighSalt(); if ("Always".equalsIgnoreCase(ssalt)) shs.setValue(StringFrequency.ALWAYS); else if ("Often".equalsIgnoreCase(ssalt)) shs.setValue(StringFrequency.OFTEN); else if ("Sometimes".equalsIgnoreCase(ssalt)) shs.setValue(StringFrequency.SOMETIMES); else if ("Never".equalsIgnoreCase(ssalt)) shs.setValue(StringFrequency.NEVER); else shs.setValue(StringFrequency.X); shs.setSignedWhen(when); shs.setSignedWho(who); } String sstress = vsd.getSel_Stressed(); if (sstress != null) { SelStressed ss = spvs.addNewSelStressed(); if ("Always".equalsIgnoreCase(sstress)) ss.setValue(StringFrequency.ALWAYS); else if ("Often".equalsIgnoreCase(sstress)) ss.setValue(StringFrequency.OFTEN); else if ("Sometimes".equalsIgnoreCase(sstress)) ss.setValue(StringFrequency.SOMETIMES); else if ("Never".equalsIgnoreCase(sstress)) ss.setValue(StringFrequency.NEVER); else ss.setValue(StringFrequency.X); ss.setSignedWhen(when); ss.setSignedWho(who); } BRxCurrentDiu brcd = spvs.addNewBRxCurrentDiu(); brcd.setValue(vsd.isDiuret_rx()); brcd.setSignedWhen(when); brcd.setSignedWho(who); BRxCurrentAce brca = spvs.addNewBRxCurrentAce(); brca.setValue(vsd.isAce_rx()); brca.setSignedWhen(when); brca.setSignedWho(who); BRxCurrentArb brcab = spvs.addNewBRxCurrentArb(); brcab.setValue(vsd.isArecept_rx()); brcab.setSignedWhen(when); brcab.setSignedWho(who); BRxCurrentBb brcbb = spvs.addNewBRxCurrentBb(); brcbb.setValue(vsd.isBeta_rx()); brcbb.setSignedWhen(when); brcbb.setSignedWho(who); BRxCurrentCcb brcc = spvs.addNewBRxCurrentCcb(); brcc.setValue(vsd.isCalc_rx()); brcc.setSignedWhen(when); brcc.setSignedWho(who); BRxCurrentOthhtn brcon = spvs.addNewBRxCurrentOthhtn(); brcon.setValue(vsd.isAnti_rx()); brcon.setSignedWhen(when); brcon.setSignedWho(who); BRxCurrentSta brcs = spvs.addNewBRxCurrentSta(); brcs.setValue(vsd.isStatin_rx()); brcs.setSignedWhen(when); brcs.setSignedWho(who); BRxCurrentOthlip brcop = spvs.addNewBRxCurrentOthlip(); brcop.setValue(vsd.isLipid_rx()); brcop.setSignedWhen(when); brcop.setSignedWho(who); BRxCurrentOha brcoa = spvs.addNewBRxCurrentOha(); brcoa.setValue(vsd.isHypo_rx()); brcoa.setSignedWhen(when); brcoa.setSignedWho(who); BRxCurrentIns brci = spvs.addNewBRxCurrentIns(); brci.setValue(vsd.isInsul_rx()); brci.setSignedWhen(when); brci.setSignedWho(who); BRxSideEffectsDiu brsed = spvs.addNewBRxSideEffectsDiu(); brsed.setValue(vsd.isDiuret_SideEffects()); brsed.setSignedWhen(when); brsed.setSignedWho(who); BRxSideEffectsAce brsea = spvs.addNewBRxSideEffectsAce(); brsea.setValue(vsd.isAce_SideEffects()); brsea.setSignedWhen(when); brsea.setSignedWho(who); BRxSideEffectsArb brseab = spvs.addNewBRxSideEffectsArb(); brseab.setValue(vsd.isArecept_SideEffects()); brseab.setSignedWhen(when); brseab.setSignedWho(who); BRxSideEffectsBb brseb = spvs.addNewBRxSideEffectsBb(); brseb.setValue(vsd.isBeta_SideEffects()); brseb.setSignedWhen(when); brseb.setSignedWho(who); BRxSideEffectsCcb brsec = spvs.addNewBRxSideEffectsCcb(); brsec.setValue(vsd.isCalc_SideEffects()); brsec.setSignedWhen(when); brsec.setSignedWho(who); BRxSideEffectsOthhtn brseon = spvs.addNewBRxSideEffectsOthhtn(); brseon.setValue(vsd.isAnti_SideEffects()); brseon.setSignedWhen(when); brseon.setSignedWho(who); BRxSideEffectsSta brses = spvs.addNewBRxSideEffectsSta(); brses.setValue(vsd.isStatin_SideEffects()); brses.setSignedWhen(when); brses.setSignedWho(who); BRxSideEffectsOthlip brseop = spvs.addNewBRxSideEffectsOthlip(); brseop.setValue(vsd.isLipid_SideEffects()); brseop.setSignedWhen(when); brseop.setSignedWho(who); BRxSideEffectsOha brseoa = spvs.addNewBRxSideEffectsOha(); brseoa.setValue(vsd.isHypo_SideEffects()); brseoa.setSignedWhen(when); brseoa.setSignedWho(who); BRxSideEffectsIns brsei = spvs.addNewBRxSideEffectsIns(); brsei.setValue(vsd.isInsul_SideEffects()); brsei.setSignedWhen(when); brsei.setSignedWho(who); String result = null; result = vsd.getDiuret_RxDecToday(); if (result != null) { SelRxTodayDiu srtd = spvs.addNewSelRxTodayDiu(); if ("Same".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srtd.setValue(StringRxToday.X); srtd.setSignedWhen(when); srtd.setSignedWho(who); } result = vsd.getAce_RxDecToday(); if (result != null) { SelRxTodayAce srta = spvs.addNewSelRxTodayAce(); if ("Same".equalsIgnoreCase(result)) srta.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srta.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srta.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srta.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srta.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srta.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srta.setValue(StringRxToday.X); srta.setSignedWhen(when); srta.setSignedWho(who); } result = vsd.getArecept_RxDecToday(); if (result != null) { SelRxTodayArb srtb = spvs.addNewSelRxTodayArb(); if ("Same".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srtb.setValue(StringRxToday.X); srtb.setSignedWhen(when); srtb.setSignedWho(who); } result = vsd.getBeta_RxDecToday(); if (result != null) { SelRxTodayBb srtbb = spvs.addNewSelRxTodayBb(); if ("Same".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srtbb.setValue(StringRxToday.X); srtbb.setSignedWhen(when); srtbb.setSignedWho(who); } result = vsd.getCalc_RxDecToday(); if (result != null) { SelRxTodayCcb srtc = spvs.addNewSelRxTodayCcb(); if ("Same".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srtc.setValue(StringRxToday.X); srtc.setSignedWhen(when); srtc.setSignedWho(who); } result = vsd.getAnti_RxDecToday(); if (result != null) { SelRxTodayOthhtn srton = spvs.addNewSelRxTodayOthhtn(); if ("Same".equalsIgnoreCase(result)) srton.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srton.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srton.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srton.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srton.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srton.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srton.setValue(StringRxToday.X); srton.setSignedWhen(when); srton.setSignedWho(who); } result = vsd.getStatin_RxDecToday(); if (result != null) { SelRxTodaySta srts = spvs.addNewSelRxTodaySta(); if ("Same".equalsIgnoreCase(result)) srts.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srts.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srts.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srts.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srts.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srts.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srts.setValue(StringRxToday.X); srts.setSignedWhen(when); srts.setSignedWho(who); } result = vsd.getLipid_RxDecToday(); if (result != null) { SelRxTodayOthlip srtop = spvs.addNewSelRxTodayOthlip(); if ("Same".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srtop.setValue(StringRxToday.X); srtop.setSignedWhen(when); srtop.setSignedWho(who); } result = vsd.getHypo_RxDecToday(); if (result != null) { SelRxTodayOha srtoa = spvs.addNewSelRxTodayOha(); if ("Same".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srtoa.setValue(StringRxToday.X); srtoa.setSignedWhen(when); srtoa.setSignedWho(who); } result = vsd.getInsul_RxDecToday(); if (result != null) { SelRxTodayIns srti = spvs.addNewSelRxTodayIns(); if ("Same".equalsIgnoreCase(result)) srti.setValue(StringRxToday.SAME); else if ("Increase".equalsIgnoreCase(result)) srti.setValue(StringRxToday.INCREASE); else if ("Decrease".equalsIgnoreCase(result)) srti.setValue(StringRxToday.DECREASE); else if ("Stop".equalsIgnoreCase(result)) srti.setValue(StringRxToday.STOP); else if ("Start".equalsIgnoreCase(result)) srti.setValue(StringRxToday.START); else if ("InClassSwitch".equalsIgnoreCase(result)) srti.setValue(StringRxToday.IN_CLASS_SWITCH); else if ("null".equalsIgnoreCase(result)) srti.setValue(StringRxToday.X); srti.setSignedWhen(when); srti.setSignedWho(who); } tempi = vsd.getOften_miss(); if (tempi != Integer.MIN_VALUE) { IntMissedMedsPerWk immp = spvs.addNewIntMissedMedsPerWk(); immp.setValue(vsd.getOften_miss()); immp.setSignedWhen(when); immp.setSignedWho(who); } result = vsd.getHerbal(); if (result != null) { SelHerbalMeds shmd = spvs.addNewSelHerbalMeds(); if ("yes".equalsIgnoreCase(result)) shmd.setValue(StringYesNo.YES); else if ("no".equalsIgnoreCase(result)) shmd.setValue(StringYesNo.NO); else if ("null".equalsIgnoreCase(result)) shmd.setValue(StringYesNo.X); shmd.setSignedWhen(when); shmd.setSignedWho(who); } result = vsd.getNextvisit(); if (result != null) { SelFollowUp sfu = spvs.addNewSelFollowUp(); if ("Under1Mo".equalsIgnoreCase(result)) sfu.setValue(StringFollowUpInterval.UNDER_1_MO); else if ("1to2Mo".equalsIgnoreCase(result)) sfu.setValue(StringFollowUpInterval.X_1_TO_2_MO); else if ("3to6Mo".equalsIgnoreCase(result)) sfu.setValue(StringFollowUpInterval.X_3_TO_6_MO); else if ("Over6Mo".equalsIgnoreCase(result)) sfu.setValue(StringFollowUpInterval.OVER_6_MO); else if ("null".equalsIgnoreCase(result)) sfu.setValue(StringFollowUpInterval.X); sfu.setSignedWhen(when); sfu.setSignedWho(who); } BBPAP bbpap = spvs.addNewBBPAP(); bbpap.setValue(vsd.isBpactionplan()); bbpap.setSignedWhen(when); bbpap.setSignedWho(who); BTPOff btpoff = spvs.addNewBTPOff(); btpoff.setValue(vsd.isPressureOff()); btpoff.setSignedWhen(when); btpoff.setSignedWho(who); BPPAgreement bppa = spvs.addNewBPPAgreement(); bppa.setValue(vsd.isPatientProvider()); bppa.setSignedWhen(when); bppa.setSignedWho(who); BABPM babpm = spvs.addNewBABPM(); babpm.setValue(vsd.isABPM()); babpm.setSignedWhen(when); babpm.setSignedWho(who); BHomeMon bhmn = spvs.addNewBHomeMon(); bhmn.setValue(vsd.isHome()); bhmn.setSignedWhen(when); bhmn.setSignedWho(who); BCommunRes bcr = spvs.addNewBCommunRes(); bcr.setValue(vsd.isCommunityRes()); bcr.setSignedWhen(when); bcr.setSignedWho(who); BReferHCP brhcp = spvs.addNewBReferHCP(); brhcp.setValue(vsd.isProRefer()); brhcp.setSignedWhen(when); brhcp.setSignedWho(who); }