Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/EvaluateResultXML.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/EvaluateResultXML.java	(revision 1007)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/EvaluateResultXML.java	(revision 1008)
@@ -5,11 +5,10 @@
 import org.openmodelica.modelicaml.simulation.xml.SimulationResult_XML_reader;
 
+/**
+ * Class to evaluate results of a given property to a condition
+ * @author parham.vasaiely
+ *
+ */
 public class EvaluateResultXML {
-	
-//	- [atLeastOneTimeTrue], 
-//	- [atLeastOneTimeFalse], 
-//	- [alwaysTrue], 
-//	- [alwaysFalse], 
-//	- [changedItsValue]
 	
 	/**
@@ -18,5 +17,5 @@
 	 * @param result xml file
 	 */
-	public static String checkAtLeastOneTimeTrue(String propertyName, File xml_file){
+	private static String checkAtLeastOneTimeTrue(String propertyName, File xml_file){
 		if(!xml_file.exists())
 			return "fileNotFound";
@@ -40,5 +39,5 @@
 	 * @param result xml file
 	 */
-	public static String checkAtLeastOneTimeFalse(String propertyName, File xml_file){
+	private static String checkAtLeastOneTimeFalse(String propertyName, File xml_file){
 		if(!xml_file.exists())
 			return "fileNotFound";
@@ -62,5 +61,5 @@
 	 * @param result xml file
 	 */
-	public static String checkAlwaysTrue(String propertyName, File xml_file){
+	private static String checkAlwaysTrue(String propertyName, File xml_file){
 		if(!xml_file.exists())
 			return "fileNotFound";
@@ -84,5 +83,5 @@
 	 * @param result xml file
 	 */
-	public static String checkAlwaysFalse(String propertyName, File xml_file){
+	private static String checkAlwaysFalse(String propertyName, File xml_file){
 		if(!xml_file.exists())
 			return "fileNotFound";
@@ -106,5 +105,5 @@
 	 * @param result xml file
 	 */
-	public static String checkChangedItsValue(String propertyName, File xml_file){
+	private static String checkChangedItsValue(String propertyName, File xml_file){
 		if(!xml_file.exists())
 			return "fileNotFound";
@@ -128,4 +127,34 @@
 		}
 			return "true";
+	}
+	
+	/**
+	 * Evaluates the results of a property using a given check mode
+	 * @param propertyName name of the property which is going to be evaluated
+	 * @param checkMode used to evaluate the results of a property, the following check modes are allowed: atLeastOneTimeTrue, atLeastOneTimeFalse, alwaysTrue, alwaysFalse, changedItsValue
+	 * @param result_xml_file absolut path to the results XML
+	 * @return result of the evaluation as a String, the result can be: true, false, resultsNotfound, fileNotFound, checkModeUnknow
+	 */
+	public static String evaluateProperty(String propertyName, String checkMode, String result_xml_file){
+		File xmlResultFile = new File(result_xml_file);
+		try{
+			if(!xmlResultFile.exists() || !xmlResultFile.canRead())
+				return "fileNotFound";
+		}catch (Exception e) {
+			// TODO: handle exception
+		}
+		
+		if(checkMode.equals("atLeastOneTimeTrue"))
+			return checkAtLeastOneTimeTrue(propertyName, xmlResultFile);		
+		if(checkMode.equals("atLeastOneTimeFalse"))
+			return checkAtLeastOneTimeFalse(propertyName, new File(result_xml_file));
+		if(checkMode.equals("alwaysTrue"))
+			return checkAlwaysTrue(propertyName, new File(result_xml_file));
+		if(checkMode.equals("alwaysFalse"))
+			return checkAlwaysFalse(propertyName, new File(result_xml_file));
+		if(checkMode.equals("changedItsValue"))
+			return checkChangedItsValue(propertyName, new File(result_xml_file));
+		else
+			return "checkModeUnknow";
 	}
 	
Index: trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/ParseJavaScript.java
===================================================================
--- trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/ParseJavaScript.java	(revision 1008)
+++ trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/evaluation/ParseJavaScript.java	(revision 1008)
@@ -0,0 +1,86 @@
+package org.openmodelica.modelicaml.simulation.evaluation;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.io.Writer;
+import java.util.Scanner;
+
+public class ParseJavaScript {
+	/** The raf. */
+	private static RandomAccessFile raf;
+	
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		String pathToJSFiles = "C:\\Projects\\ModelicaML\\runtime-New_configuration\\modelicaml.example.potableWaterSystem_v26\\test-gen\\test-session_20110924175101\\report-gen\\includes\\";
+		String result_xml_file = "C:\\Projects\\ModelicaML\\runtime-New_configuration\\modelicaml.example.potableWaterSystem_v26\\test-gen\\test-session_20110924175101\\tmp\\ModelicaMLModel.GenSimModels_for__SPWS_Environment_1.SiM_for__ts2__Fill_tank_res.xml";
+		
+		parseJSTemp_generateJSFile(result_xml_file, pathToJSFiles);		
+	}
+	
+	/**
+	 * Parses the JavaScript template file to generate a new JavaScript file including the evaluated results
+	 * @param result_xml_file result file including properties and results to be evaluated
+	 * @param pathToJSFiles path to the report-gen\includes folder
+	 */
+	public static void parseJSTemp_generateJSFile(String result_xml_file, String pathToJSFiles){
+		File initFile = new File(pathToJSFiles + "/report_data.js");
+		
+		Writer fw = null; 
+		
+		File f = new File(pathToJSFiles + "/report_data.js");
+		try {
+			fw = new FileWriter(initFile); 
+			f.createNewFile();
+			
+			
+			raf = new RandomAccessFile( pathToJSFiles + "/report_data.js_template", "r");
+			fw.write(raf.readLine());
+			fw.append( System.getProperty("line.separator") );
+			boolean hasDataSet = true;
+			while(hasDataSet){
+				String line = raf.readLine();
+//				System.out.println(line);
+				if(line != null){
+					if(line.contains("###")){
+						line = startEvaluation(line, result_xml_file);
+					}
+					fw.append(line);
+					fw.append( System.getProperty("line.separator") );
+//					System.out.println("Line: " + line);
+				} else
+					hasDataSet= false;
+					
+			}
+			raf.close();
+		} catch (FileNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		finally { 
+			  if ( fw != null ) 
+			    try { fw.close(); } catch ( IOException e ) { } 
+		}
+	}
+
+	private static String startEvaluation(String line, String result_xml_file) {
+		String evaluatedLine = "";
+		Scanner sc = new Scanner(line);
+		sc.useDelimiter("###");
+		evaluatedLine = sc.next();
+		Scanner sc2 = new Scanner(sc.next());
+		sc2.useDelimiter(":");
+		//_reqTestVerdict.testPassed:atLeastOneTimeTrue
+		String evaluateionResult = EvaluateResultXML.evaluateProperty(sc2.next(), sc2.next(), result_xml_file);
+		evaluatedLine = evaluatedLine + evaluateionResult + sc.next();
+		return evaluatedLine;
+	}
+
+}
