/** * @param userGroup * @return */ public String GetXmlLabConfiguration(String userGroup) { final String methodName = "GetXmlLabConfiguration"; Logfile.WriteCalled( logLevel, STR_ClassName, methodName, String.format(STRLOG_UserGroup_arg, userGroup)); String xmlLabConfiguration = null; try { /* * Load the lab configuration XML document from the file and convert to a string */ Document document = XmlUtilities.GetDocumentFromFile( null, this.labManagement.getLabConfiguration().getFilename()); xmlLabConfiguration = XmlUtilities.ToXmlString(document); } catch (Exception ex) { Logfile.WriteError(ex.toString()); } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); return xmlLabConfiguration; }
/** @param xmlExperimentResult */ public ExperimentResult(String xmlExperimentResult) throws Exception { super(xmlExperimentResult); final String methodName = "ExperimentResult"; Logfile.WriteCalled(logLevel, STR_ClassName, methodName); try { /* * Get specification information */ this.source = XmlUtilities.GetChildValue(this.nodeExperimentResult, Consts.STRXML_SourceName); this.duration = XmlUtilities.GetChildValueAsInt(this.nodeExperimentResult, Consts.STRXML_Duration); this.trials = XmlUtilities.GetChildValueAsInt(this.nodeExperimentResult, Consts.STRXML_Repeat); /* * Get the CSV list of absorbers into a string array */ String csvString = XmlUtilities.GetChildValue(this.nodeExperimentResult, Consts.STRXML_AbsorberName); this.absorberList = csvString.split(Consts.STR_CsvSplitter); /* * Get the CSV list of distances into an integer array */ csvString = XmlUtilities.GetChildValue(this.nodeExperimentResult, Consts.STRXML_Distance); String[] csvStringSplit = csvString.split(Consts.STR_CsvSplitter); this.distanceList = new int[csvStringSplit.length]; for (int i = 0; i < this.distanceList.length; i++) { try { this.distanceList[i] = Integer.parseInt(csvStringSplit[i]); } catch (Exception ex) { } } /* * Get result information */ this.dataType = XmlUtilities.GetChildValue(this.nodeExperimentResult, Consts.STRXML_DataType); /* * Get the radioactivity counts into a two dimensional array. Each data vector contains the trial counts for * a particular distance and is provided as a comma-seperated-value string. */ String csvStrings[] = XmlUtilities.GetChildValues(this.nodeExperimentResult, Consts.STRXML_DataVector, false); this.dataVectors = new int[csvStrings.length][]; for (int i = 0; i < this.dataVectors.length; i++) { csvStringSplit = csvStrings[i].split(Consts.STR_CsvSplitter); this.dataVectors[i] = new int[csvStringSplit.length]; for (int j = 0; j < this.dataVectors[i].length; j++) { try { this.dataVectors[i][j] = Integer.parseInt(csvStringSplit[j]); } catch (Exception ex) { } } } } catch (Exception ex) { Logfile.WriteError(ex.toString()); throw ex; } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); }