Changeset 1008
- Timestamp:
- 09/25/11 19:12:38 (13 years ago)
- Location:
- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/EvaluateResultXML.java
r1003 r1008 5 5 import org.openmodelica.modelicaml.simulation.xml.SimulationResult_XML_reader; 6 6 7 /** 8 * Class to evaluate results of a given property to a condition 9 * @author parham.vasaiely 10 * 11 */ 7 12 public class EvaluateResultXML { 8 9 // - [atLeastOneTimeTrue],10 // - [atLeastOneTimeFalse],11 // - [alwaysTrue],12 // - [alwaysFalse],13 // - [changedItsValue]14 13 15 14 /** … … 18 17 * @param result xml file 19 18 */ 20 p ublicstatic String checkAtLeastOneTimeTrue(String propertyName, File xml_file){19 private static String checkAtLeastOneTimeTrue(String propertyName, File xml_file){ 21 20 if(!xml_file.exists()) 22 21 return "fileNotFound"; … … 40 39 * @param result xml file 41 40 */ 42 p ublicstatic String checkAtLeastOneTimeFalse(String propertyName, File xml_file){41 private static String checkAtLeastOneTimeFalse(String propertyName, File xml_file){ 43 42 if(!xml_file.exists()) 44 43 return "fileNotFound"; … … 62 61 * @param result xml file 63 62 */ 64 p ublicstatic String checkAlwaysTrue(String propertyName, File xml_file){63 private static String checkAlwaysTrue(String propertyName, File xml_file){ 65 64 if(!xml_file.exists()) 66 65 return "fileNotFound"; … … 84 83 * @param result xml file 85 84 */ 86 p ublicstatic String checkAlwaysFalse(String propertyName, File xml_file){85 private static String checkAlwaysFalse(String propertyName, File xml_file){ 87 86 if(!xml_file.exists()) 88 87 return "fileNotFound"; … … 106 105 * @param result xml file 107 106 */ 108 p ublicstatic String checkChangedItsValue(String propertyName, File xml_file){107 private static String checkChangedItsValue(String propertyName, File xml_file){ 109 108 if(!xml_file.exists()) 110 109 return "fileNotFound"; … … 128 127 } 129 128 return "true"; 129 } 130 131 /** 132 * Evaluates the results of a property using a given check mode 133 * @param propertyName name of the property which is going to be evaluated 134 * @param checkMode used to evaluate the results of a property, the following check modes are allowed: atLeastOneTimeTrue, atLeastOneTimeFalse, alwaysTrue, alwaysFalse, changedItsValue 135 * @param result_xml_file absolut path to the results XML 136 * @return result of the evaluation as a String, the result can be: true, false, resultsNotfound, fileNotFound, checkModeUnknow 137 */ 138 public static String evaluateProperty(String propertyName, String checkMode, String result_xml_file){ 139 File xmlResultFile = new File(result_xml_file); 140 try{ 141 if(!xmlResultFile.exists() || !xmlResultFile.canRead()) 142 return "fileNotFound"; 143 }catch (Exception e) { 144 // TODO: handle exception 145 } 146 147 if(checkMode.equals("atLeastOneTimeTrue")) 148 return checkAtLeastOneTimeTrue(propertyName, xmlResultFile); 149 if(checkMode.equals("atLeastOneTimeFalse")) 150 return checkAtLeastOneTimeFalse(propertyName, new File(result_xml_file)); 151 if(checkMode.equals("alwaysTrue")) 152 return checkAlwaysTrue(propertyName, new File(result_xml_file)); 153 if(checkMode.equals("alwaysFalse")) 154 return checkAlwaysFalse(propertyName, new File(result_xml_file)); 155 if(checkMode.equals("changedItsValue")) 156 return checkChangedItsValue(propertyName, new File(result_xml_file)); 157 else 158 return "checkModeUnknow"; 130 159 } 131 160
Note: See TracChangeset
for help on using the changeset viewer.