1. New class for analyzing task-chains added & initialized (E2ELatency)

2. classes renamed (CpuRTA => CPURta / RuntimeUtilRTA => RTARuntimeUtil
/ RTApp_WATERS19 => APP4RTA)

3. classes are improved (more functionalities with comments added to
CPURta & RTARuntimeUtil Classes, more features added to the UI class)

*NOTE: CommonUtils class needs to be corrected. Some errors are found.


Change-Id: Iee0e492f49d9704e4003e8ef2dcc8bc28f2b6eea
Signed-off-by: Junhyung Ki <kijoonh91@gmail.com>
diff --git a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/CpuRTA.java b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/CPURta.java
similarity index 65%
rename from eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/CpuRTA.java
rename to eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/CPURta.java
index 4febdc0..2c0a1a7 100644
--- a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/CpuRTA.java
+++ b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/CPURta.java
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.stream.Collectors;
 
+import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.eclipse.app4mc.amalthea.model.Amalthea;
 import org.eclipse.app4mc.amalthea.model.CallSequenceItem;
@@ -48,16 +49,16 @@
 import org.eclipse.emf.common.util.EList; 
 
 /**
- * Date: June 21-2019 
+ * Date: August 21-2019 
  * @author Junhyung Ki
  * @version 1.0
- *				This class is to analyze Response Times of CPU(e.g., ARM, Denver cores) Tasks in a CPU-GPU Heterogeneous System
+ *				This class is to analyze response time of CPU(e.g., ARM, Denver cores) Tasks in CPU-GPU Heterogeneous Systems
  *				The entire class is designed for Generic Algorithm Mapping to find the most optimized task mapping solution.
  *				Therefore, setting the integer array variable, 'tpuMapping' (which is considered as a mapping solution) along with 
  *				others ( Amalthea Model, 'model' setting, Task Response Time HashMap, 'trt' setting (for GPU Tasks), Processing Unit List, 'pul' setting
- *				should be the first step before executing any response time method.
+ *				should be the first step before executing any response time method. (Which is done by the constructor)
  */
-public class CpuRTA {
+public class CPURta {
 	public final File inputFile = new File("model-input/WATERS19_release/ChallengeModel_release.amxmi");
 	
 	/**
@@ -69,21 +70,47 @@
 		return SharedConsts.defaultIAMapping;
 	}
 	
-	private Amalthea model;
+	private Amalthea model = null;
 
 	/**
-	 * Since this method is used by RTARuntimeUtil, the visibility should be 'protected'
-	 *
+	 * Constructor only for testing the class
+	 */
+	public CPURta() {
+		this.setModel(AmaltheaLoader.loadFromFile(this.inputFile));
+		this.setTRT(this.getDefaultTRT(this.getModel()));
+		this.setIA(this.getDefaultIAMapping());
+		this.setPUl(CommonUtils.getPUs(this.getModel()));
+	}
+	
+	/**
+	 * CPURta Constructor
+	 * @param model			the observed Amalthea Model
+	 * @param trt			the observed HashMap Task with Response Time (null works => the default testing trt will be assigned)
+	 * @param ia			the observed IntegerArray Mapping Model
+	 * @param pul			the observed List of ProcessingUnits
+	 */
+	public CPURta(final Amalthea model, final HashMap<Task, Time> trt, final int[] ia, final List<ProcessingUnit> pul) {
+		this.setModel(model);
+		if (trt == null) {
+			this.setTRT(this.getDefaultTRT(this.getModel()));
+		} else {
+			this.setTRT(trt);
+		}
+		this.setIA(ia);
+		this.setPUl(pul);
+	}
+	
+	/**
+	 * Since this method is used by RTARuntimeUtil, the visibility should be 'public'
 	 * @return
-	 * 			The Amalthea model object of the current CPURtaIA class
+	 * 			The Amalthea model object of the current CPURta class
 	 */
 	public Amalthea getModel() {
 		return this.model;
 	}
 	
 	/**
-	 * Set the Amalthea model object of the current CPURtaIA class as the given Amalthea model parameter.
-	 *
+	 * Set the Amalthea model object of the current CPURta class as the given Amalthea model parameter.
 	 * @param pAmalthea			the parameter Amalthea model which would reinitialize the Amalthea model
 	 */
 	public void setModel(final Amalthea pAmalthea) {
@@ -95,7 +122,6 @@
 	
 	/**
 	 * Since this method is used by GAMapping, the visibility should be 'public'
-	 *
 	 * @return
 	 * 			trt(task with response time) HashMap variable
 	 */
@@ -106,16 +132,14 @@
 	/**
 	 * Set the trt(task with response time) HashMap variable as the given trtp parameter variable.
 	 * Which would contains GPU tasks' response times from the beginning
-	 *
-	 * @param trtp				the HashMap variable parameter which would reinitialize the trt variable of the current CPURtaIA class.
+	 * @param trtp				the HashMap variable parameter which would reinitialize the trt variable of the current CPURta class.
 	 */
 	public void setTRT(final HashMap<Task, Time> trtp) {
 		this.trt = trtp;
 	}
 	
 	/**
-	 * Get the default trt(task with response time) value in case of running CPURtaIA class itself.
-	 *
+	 * Get the default trt(task with response time) value in case of running CPURta class itself.
 	 * @param model				the current class's Amalthea model which is used to get the trt value out of it
 	 * @return
 	 * 			the trt value which is derived out of the given parameter Amalthea model
@@ -127,8 +151,7 @@
 		for (final Task t : allTaskList) {
 			if (this.gpuTaskList.contains(t)) {
 				trt.put(t, FactoryUtil.createTime(BigInteger.valueOf(val), TimeUnit.PS));
-			}
-			else {
+			} else {
 				trt.put(t, FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS));
 			}
 		}
@@ -138,8 +161,7 @@
 	private int[] tpuMapping = null;
 
 	/**
-	 * Since this method is used by RTARuntimeUtil, the visibility should be 'protected'
-	 *
+	 * Since this method is used by RTARuntimeUtil, the visibility should be 'public'
 	 * @return
 	 * 			The tpuMapping integer array
 	 */
@@ -151,18 +173,15 @@
 	 * Set the tpuMapping integer array (which would be used to modify the current task mapping to different Processing Units)
 	 * as the given tpumap parameter variable.
 	 * (The integer array would be used to modify the current task mapping to different Processing Units)
-	 *
-	 * @param tpumap			the parameter integer array which would reinitialize the tpuMapping array of the current CPURtaIA class.
+	 * @param tpumap			the parameter integer array which would reinitialize the tpuMapping array of the current CPURta class.
 	 */
 	public void setIA(final int[] tpumap) {
-		final Logger log = Logger.getLogger(CpuRTA.class);
+		final Logger log = Logger.getLogger(CPURta.class);
 		if (tpumap == null) {
 			this.tpuMapping = null;
-		}
-		else if (tpumap.length == this.model.getSwModel().getTasks().size()) {
+		} else if (tpumap.length == this.model.getSwModel().getTasks().size()) {
 			this.tpuMapping = tpumap;
-		}
-		else {
+		} else {
 			log.error("integer array size MUST match the number of tasks");
 		}
 	}
@@ -171,7 +190,6 @@
 
 	/**
 	 * Get a list of ProcessingUnits
-	 * 
 	 * @return
 	 * 			this.pul
 	 */
@@ -182,20 +200,39 @@
 	/**
 	 * Set the pul, the list of Processing Units variable (which would be used to map tasks along with tpuMapping array)
 	 * as the given pul parameter variable.
-	 *
-	 * @param pul 				the parameter pul list which would reinitialize the pul list variable of the current CPURtaIA class
+	 * @param pul 				the parameter pul list which would reinitialize the pul list variable of the current CPURta class
 	 */
 	public void setPUl(final List<ProcessingUnit> pul) {
 		this.pul = pul;
 	}
 	
-	//TODO: Contention not considered
+	private Contention ct = null;
+	
+	/**
+	 * Get the contention instance
+	 *
+	 * @return
+	 * 			this.ct
+	 */
+	public Contention getCT() {
+		return this.ct;
+	}
+	
+	/**
+	 * Set the ct (Contention) variable which would be used to calculate memory contention of the given task that will be added up to the response time result
+	 * as the newly generated contention instance with the given integer array
+	 * and Amalthea model parameters.
+	 * @param ia				Integer Array which is referred to map tasks of the given model
+	 * @param model				Amalthea model
+	 */
+	public void setContention(final int[] ia, final Amalthea model) {
+		this.ct = new Contention(ia, model);
+	}
 	
 	private List<Task> gpuTaskList = new ArrayList<Task>();
 
 	/**
 	 * Since this method is used by RTARuntimeUtil, the visibility should be 'protected'
-	 *
 	 * @return
 	 * 			gpuTaskList which contains tasks (which are originally designed for GPU) of the Amalthea model
 	 */
@@ -206,7 +243,6 @@
 	private final List<Task> triggeringTaskList = new ArrayList<Task>();
 	/**
 	 * Since this method is used by RTARuntimeUtil, the visibility should be 'protected'
-	 *
 	 * @return
 	 * 			triggeringTaskList which contains tasks (which contain InterProcessTrigger) of the Amalthea model
 	 */
@@ -217,16 +253,15 @@
 	/* this runnable is used to calculate execution time in RTARuntimeUtil class */
 	protected Runnable offloadingAsyncRunnable = null;
 	
-	private final HashMap<Task, List<Label>[]> gpuToCpuLabels = new HashMap<Task, List<Label>[]>();
+	private final HashMap<Task, List<List<Label>>> gpuToCpuLabels = new HashMap<Task, List<List<Label>>>();
 	
 	/**
 	 * Since this method is used by RTARuntimeUtil, the visibility should be 'protected'
-	 *
 	 * @return
 	 * 			gpuToCpuLabels HashMap which contains required labels (of the corresponding task)
 	 * 			that need to be taken into account when GPU tasks are mapped to CPU
 	 */
-	protected HashMap<Task, List<Label>[]> getGTCL() {
+	protected HashMap<Task, List<List<Label>>> getGTCL() {
 		return this.gpuToCpuLabels;
 	}
 	
@@ -234,10 +269,8 @@
 	 * Not only set gpuToCpuLabels HashMap, this also set gpuTaskList (only contains GPU tasks),
 	 * triggeringTaskList (only contains tasks with InterProcessTrigger)
 	 * and offloadingAsyncRunnable (the Runnable that is taken into account for triggering tasks when the mode is asynchronous)
-	 *
 	 * @param model				the parameter Amalthea model which is used to derived required labels of the corresponding GPU task
 	 */
-	@SuppressWarnings("unchecked")
 	private void setGTCL(final Amalthea model) {
 		if (model != null) {
 			final EList<Task> allTaskList = model.getSwModel().getTasks();
@@ -248,7 +281,7 @@
 						(call -> call instanceof InterProcessTrigger));
 				if (triggerList.size() != 0) {
 					this.triggeringTaskList.add(t);
-					if (RuntimeUtilRTA.doesTaskHaveAsyncRunnable(t, this)) {
+					if (RTARuntimeUtil.doesTaskHaveAsyncRunnable(t, this)) {
 						final List<CallSequenceItem> cList = SoftwareUtil.collectCalls(t, null, (call -> call instanceof TaskRunnableCall || 
 								call instanceof InterProcessTrigger || call instanceof ClearEvent || call instanceof SetEvent || call instanceof WaitEvent));
 						final int waitIndex = cList.indexOf(cList.stream().filter(s -> s instanceof WaitEvent).iterator().next());
@@ -299,13 +332,12 @@
 						}
 					}
 				}
-				final List<Label>[] aryofLabelList = new ArrayList[2];
-				aryofLabelList[0] = readLabelList;
-				aryofLabelList[1] = writeLabelList;
-				this.gpuToCpuLabels.put(t, aryofLabelList);
+				final List<List<Label>> listOfLabelList = new ArrayList<List<Label>>();
+				listOfLabelList.add(readLabelList);
+				listOfLabelList.add(writeLabelList);
+				this.gpuToCpuLabels.put(t, listOfLabelList);
 			}
-		}
-		else {
+		} else {
 			this.gpuTaskList.clear();
 			this.triggeringTaskList.clear();
 			this.offloadingAsyncRunnable = null;
@@ -313,15 +345,46 @@
 		}
 	}
 	
-	// TODO: Consider Offloading Runnable
-	// TODO: Cumulative Latency Time
+	/* To calculate pure memory access latency cost (without contention & pure computation(Ticks)) */
+	protected Time cumuAcTime = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+	
+	/**
+	 * @return
+	 * 			cumuAcTime, the total time of latency (Read & Write memory access) from CPUs
+	 */
+	public Time getCumulatedMemAccCosts() {
+		return this.cumuAcTime;
+	}
+
+	/**
+	 * Initializing cumuAcTime to 0 ps
+	 */
+	public void initCumulatedMemAccCosts() {
+		this.cumuAcTime = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+	}
+	
+	/* To calculate pure latency cost (without memory access latency & pure computation(Ticks)) */
+	protected Time cumuConTime = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+	
+	/**
+	 * @return
+	 * 			cumulatedCon, the total time of latency (Contention of the task)
+	 */
+	public Time getCumulatedContention() {
+		return this.cumuConTime;
+	}
+	
+	/**
+	 * Initializing cumulatedCon to 0 ps
+	 */
+	public void initCumulatedContention() {
+		this.cumuConTime = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+	}
+	
 	public static void main(String[] args) {
 		org.apache.log4j.BasicConfigurator.configure();
-		final CpuRTA cpurta = new CpuRTA();
-		cpurta.setModel(AmaltheaLoader.loadFromFile(cpurta.inputFile));
-		cpurta.setTRT(cpurta.getDefaultTRT(cpurta.getModel()));
-		cpurta.setIA(SharedConsts.defaultIAMapping);
-		cpurta.setPUl(CommonUtils.getPUs(cpurta.getModel()));
+		Logger.getRootLogger().setLevel(Level.ERROR);
+		final CPURta cpurta = new CPURta();
 		cpurta.run();
 	}
 	
@@ -329,7 +392,7 @@
 	 * Executable method
 	 */
 	public void run() {
-		final Logger log = Logger.getLogger(CpuRTA.class);
+		final Logger log = Logger.getLogger(CPURta.class);
 		if (this.model == null) {
 			log.error("No model loaded!");
 			return;
@@ -340,30 +403,26 @@
 
 	/**
 	 * Calculate the total sum of response times of the tasks of the given Amalthea model with the mapping model (tpuMapping)
-	 *
 	 * @param executionCase		BCET, ACET, WCET
 	 * @return
 	 * 			total sum of all tasks' response times of the given mapped model (tpuMapping)
 	 */
 	public Time getCPUResponseTimeSum(final TimeType executionCase) {
-		final Logger log = Logger.getLogger(CpuRTA.class);
+		final Logger log = Logger.getLogger(CPURta.class);
 		if (this.model == null) {
 			log.error("No Model Loaded!");
 			return null;
-		}
-		else if (this.trt == null) {
+		} else if (this.trt == null) {
 			log.error("No HashMap Loaded!");
 			return null;
-		}
-		else if (this.tpuMapping == null) {
+		} else if (this.tpuMapping == null) {
 			log.error("No IntegerArray Loaded!");
 			return null;
-		}
-		else if (this.pul == null) {
+		} else if (this.pul == null) {
 			log.error("No PUList Loaded!");
 			return null;
 		}
-		// TODO: Contention
+		this.setContention(this.getIA(), this.getModel());
 		Time time = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
 		for (int i = 0; i < this.tpuMapping.length; i++) {
 			final Time rt = getTaskCPURT(this.model.getSwModel().getTasks().get(i), executionCase);
@@ -381,7 +440,6 @@
 	
 	/**
 	 * Calculate response time of the given task of the given Amalthea model with the mapping model (tpuMapping)
-	 *
 	 * @param task				the observed task
 	 * @param executionCase		BCET, ACET, WCET
 	 * @return
@@ -393,7 +451,7 @@
 		final int puindex = this.tpuMapping[tindex];
 		final ProcessingUnit pu = this.pul.get(puindex);
 		if (!pu.getDefinition().getPuType().equals(PuType.CPU)) {
-			Logger.getLogger(CpuRTA.class).debug(task.getName() + " is not mapped to a CPU");
+			Logger.getLogger(CPURta.class).debug(task.getName() + " is not mapped to a CPU");
 			return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
 		}
 		/* 2. get all tasks mapped to this CPU */
@@ -409,7 +467,6 @@
 	
 	/**
 	 * Sort out the given list of tasks (in order of shorter period first - Rate Monotonic Scheduling)
-	 *
 	 * @param taskList			list of tasks that is mapped to the same core
 	 * @return
 	 * 			the sorted list of tasks
@@ -438,7 +495,6 @@
 	/**
 	 * Visibility - public (This method is for the UI version code (ui package > RTApp.java))
 	 * Calculate response time of the observed task according to the periodic tasks response time analysis algorithm.
-	 *
 	 * @param task				the observed task
 	 * @param taskList			list of tasks that is mapped to the same core
 	 * @param executionCase		BCET, ACET, WCET
@@ -447,7 +503,7 @@
 	 * 			response time of the observed task
 	 */
 	public Time preciseTestCPURT(final Task task, final List<Task> taskList, final TimeType executionCase, final ProcessingUnit pu) {
-		final Logger log = Logger.getLogger(CpuRTA.class);
+		final Logger log = Logger.getLogger(CPURta.class);
 		Time thisRT = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
 		Time period = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
 		if (taskList.size() == 0) {
@@ -468,20 +524,23 @@
 			log.debug("!!! Nothing in the taskList matches the given Task !!! So I am returning 0s" + " --- thisTask: " + task.getName());
 			return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
 		}
-		final RuntimeUtilRTA rtaut = new RuntimeUtilRTA();
+		final RTARuntimeUtil rtaut = new RTARuntimeUtil();
 		for (int i = 0; i < index + 1; i++) {
 			period = CommonUtils.getStimInTime(taskList.get(i));
 			if (index == 0) {
 				thisRT = rtaut.getExecutionTimeforCPUTask(taskList.get(i), pu, executionCase, this);
 				if (thisRT.compareTo(period) <= 0) {
-					// TODO: cumulative if (thisRT.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) > 0)
+					/* To analyze the pure latency time */
+					if (thisRT.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) > 0) {
+						this.cumuAcTime = this.cumuAcTime.add(rtaut.getTaskMemoryAccessTime(task, pu, executionCase));
+						this.cumuConTime = this.cumuConTime.add(this.getCT().contentionForTask(task));
+					}
 					return thisRT;
 				}
 				log.debug("!!! This is non schedulable...!!! Because of the period " + period + " being less than the execution time of " + thisRT
 						+ " for task " + task.getName());
 				return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
-			}
-			else if (i == index) {
+			} else if (i == index) {
 				/* In the case of a COOPERATIVE Preemption typed Task */
 				if (taskList.get(i).getPreemption().equals(Preemption.COOPERATIVE)) {
 					// TODO: Blocking
@@ -489,8 +548,7 @@
 				final Time thisExeTime = rtaut.getExecutionTimeforCPUTask(taskList.get(i), pu, executionCase, this);
 				if (thisExeTime.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) == 0) {
 					return thisExeTime;
-				}
-				else if (thisExeTime.compareTo(period) > 0) {
+				} else if (thisExeTime.compareTo(period) > 0) {
 					log.debug("!!! This is non schedulable...!!! Because of the period " + period + " being less than the execution time of " + thisRT
 							+ " for task " + task.getName());
 					return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
@@ -516,12 +574,15 @@
 						if (culmulativeRT_x.compareTo(period) <= 0) {
 							if (culmulativeRT_x.compareTo(culmulativeRT) == 0) {
 								thisRT = culmulativeRT_x;
-								// TODO: cumulative if (thisRT.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) > 0)
+								/* To analyze the pure latency time */
+								if (thisRT.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) > 0) {
+									this.cumuAcTime = this.cumuAcTime.add(rtaut.getTaskMemoryAccessTime(task, pu, executionCase));
+									this.cumuConTime = this.cumuConTime.add(this.getCT().contentionForTask(task));
+								}
 								return thisRT;
 							}
 							culmulativeRT = culmulativeRT_x;
-						}
-						else {
+						} else {
 							log.debug("!!! This is non schedulable...!!! Because of the period " + period
 									+ " being less than the response time (culmulativeRT_x) of " + culmulativeRT_x + " for task " + task.getName());
 							if (SharedConsts.ignoreInfeasibility) {
@@ -539,7 +600,126 @@
 				return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
 			}
 		}
-		// TODO: cumulative if (thisRT.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) > 0)
+		/* To analyze the pure latency time */
+		if (thisRT.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) > 0) {
+			this.cumuAcTime = this.cumuAcTime.add(rtaut.getTaskMemoryAccessTime(task, pu, executionCase));
+			this.cumuConTime = this.cumuConTime.add(this.getCT().contentionForTask(task));
+		}
+		return thisRT;
+	}
+	
+	/**
+	 * Calculate response time of the observed task according to the implicit communication paradigm.
+	 * @param task				the observed task
+	 * @param taskList			list of tasks that is mapped to the same core
+	 * @param executionCase		BCET, ACET, WCET
+	 * @param pu				ProcessingUnit that would compute the given runnable (A57 or Denver)
+	 * @param cpurta			the instance of CPURta class that contains model & mapping IA info
+	 * @return
+	 * 				response time of the observed task (implicit communication paradigm)
+	 */
+	public Time implicitPreciseTest(final Task task, final List<Task> taskList, final TimeType executionCase, 
+			final ProcessingUnit pu, final CPURta cpurta) {
+		final Logger log = Logger.getLogger(CPURta.class);
+		Time thisRT = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+		Time period = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+		if (taskList.size() == 0) {
+			log.debug("!!! This taskList is empty so I am returning MAX !!!");
+			return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
+		}
+		/* to check if the given task is in the taskList */
+		int flag = 0;
+		int index = 0;
+		for (int i = 0; i < taskList.size(); i++) {
+			if (task.equals(taskList.get(i))) {
+				flag = 1;
+				index = i;
+				break;
+			}
+		}
+		if (flag == 0) {
+			log.debug("!!! Nothing in the taskList matches the given Task !!! So I am returning 0s" + " --- thisTask: " + task.getName());
+			return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
+		}
+		final RTARuntimeUtil rtaut = new RTARuntimeUtil();
+		for (int i = 0; i < index + 1; i++) {
+			period = CommonUtils.getStimInTime(taskList.get(i));
+			if (index == 0) {
+				thisRT = rtaut.getExecutionTimeforCPUTask(taskList.get(i), pu, executionCase, cpurta);
+				final Time[] ta = rtaut.getLocalCopyTimeArray(taskList.get(i), pu, executionCase, cpurta);
+				for (int j = 0; j < ta.length; j++) {
+					thisRT = thisRT.add(ta[j]);
+				}
+				if (thisRT.compareTo(period) <= 0) {
+					return thisRT;
+				}
+				log.debug("!!! This is non schedulable...!!! Because of the period " + period + " being less than the execution time of " + thisRT
+						+ " for task " + task.getName());
+				return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
+			} else if (i == index) {
+				/* In the case of a COOPERATIVE Preemption typed Task */
+				Time thisExeTime = rtaut.getExecutionTimeforCPUTask(taskList.get(i), pu, executionCase, cpurta);
+				final Time[] ta = rtaut.getLocalCopyTimeArray(taskList.get(i), pu, executionCase, cpurta);
+				for (int j = 0; j < ta.length; j++) {
+					thisExeTime = thisExeTime.add(ta[j]);
+				}
+				if (thisExeTime.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) == 0) {
+					return thisExeTime;
+				} else if (thisExeTime.compareTo(period) > 0) {
+					log.debug("!!! This is non schedulable...!!! Because of the period " + period + " being less than the execution time of " + thisRT
+							+ " for task " + task.getName());
+					return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
+				}
+				Time culmulativeRT = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+				/* 1. add all the execution time till the index */
+				for (int j = 0; j < i + 1; j++) {
+					Time thisTime = rtaut.getExecutionTimeforCPUTask(taskList.get(j), pu, executionCase, cpurta);
+					final Time[] ta_ = rtaut.getLocalCopyTimeArray(taskList.get(j), pu, executionCase, cpurta);
+					for (int k = 0; k < ta_.length; k++) {
+						thisTime = thisTime.add(ta[k]);
+					}
+					culmulativeRT = culmulativeRT.add(thisTime);
+				}
+				if (culmulativeRT.compareTo(period) <= 0) {
+					while (true) {
+						Time excepThisExeTime = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+						for (int j = 0; j < i; j++) {
+							Time localPeriod = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+							localPeriod = CommonUtils.getStimInTime(taskList.get(j));
+							Time preExeTime = rtaut.getExecutionTimeforCPUTask(taskList.get(j), pu, executionCase, cpurta);
+							final Time[] ta_ = rtaut.getLocalCopyTimeArray(taskList.get(j), pu, executionCase, cpurta);
+							for (int k = 0; k < ta_.length; k++) {
+								preExeTime = preExeTime.add(ta_[k]);
+							}
+							final double ri_period = Math.ceil(culmulativeRT.divide(localPeriod));
+							excepThisExeTime = excepThisExeTime.add(preExeTime.multiply(ri_period));
+						}
+						Time culmulativeRT_x = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);
+						culmulativeRT_x = thisExeTime.add(excepThisExeTime);
+						if (culmulativeRT_x.compareTo(period) <= 0) {
+							if (culmulativeRT_x.compareTo(culmulativeRT) == 0) {
+								thisRT = culmulativeRT_x;
+								return thisRT;
+							}
+							culmulativeRT = culmulativeRT_x;
+						} else {
+							log.debug("!!! This is non schedulable...!!! Because of the period " + period
+									+ " being less than the response time (culmulativeRT_x) of " + culmulativeRT_x + " for task " + task.getName());
+							if (SharedConsts.ignoreInfeasibility) {
+								return culmulativeRT_x;
+							}
+							return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
+						}
+					}
+				}
+				log.debug("!!! This is non schedulable...!!! Because of the period " + period + " being less than the response time of " + culmulativeRT
+						+ " for task " + task.getName());
+				if (SharedConsts.ignoreInfeasibility) {
+					return culmulativeRT;
+				}
+				return FactoryUtil.createTime(BigInteger.valueOf(Long.MAX_VALUE), TimeUnit.PS);
+			}
+		}
 		return thisRT;
 	}
 	
@@ -547,7 +727,6 @@
 	 * Visibility - public (This method is for the UI version code (ui package > RTApp.java))
 	 * It returns HashMap<Integer, List<Task>> Type reference that contains an Integer(number of Processing Unit index) and the corresponding List of Tasks
 	 * This is to visualize which task is mapped to which processing unit.
-	 * 
 	 * @return
 	 * 			HashMap<Integer, List<Task>> puListHashMap
 	 */
@@ -569,7 +748,7 @@
 }
 
 /**
- * @Date: June 21-2019 
+ * @Date: August 21-2019
  * @author Junhyung Ki
  * @version 1.0
  *			This inner class is used for the method "taskSorting" to help compare between two tasks' periods (which is longer)
diff --git a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/E2ELatency.java b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/E2ELatency.java
new file mode 100644
index 0000000..69fa8ca
--- /dev/null
+++ b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/E2ELatency.java
@@ -0,0 +1,679 @@
+/*******************************************************************************

+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts.

+ *

+ * This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License 2.0

+ * which accompanies this distribution, and is available at

+ * https://www.eclipse.org/legal/epl-2.0/

+ *

+ * SPDX-License-Identifier: EPL-2.0

+ *

+ * Contributors:

+ *     FH Dortmund - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.app4mc.gsoc_rta;

+

+import java.math.BigDecimal;

+import java.math.BigInteger;

+import java.util.ArrayList;

+import java.util.Collections;

+import java.util.Comparator;

+import java.util.List;

+import java.util.Set;

+

+import org.apache.log4j.Level;

+import org.apache.log4j.Logger;

+import org.eclipse.app4mc.amalthea.model.AmaltheaServices;

+import org.eclipse.app4mc.amalthea.model.Event;

+import org.eclipse.app4mc.amalthea.model.EventChain;

+import org.eclipse.app4mc.amalthea.model.EventChainContainer;

+import org.eclipse.app4mc.amalthea.model.EventChainItem;

+import org.eclipse.app4mc.amalthea.model.Label;

+import org.eclipse.app4mc.amalthea.model.ProcessEvent;

+import org.eclipse.app4mc.amalthea.model.ProcessingUnit;

+import org.eclipse.app4mc.amalthea.model.Task;

+import org.eclipse.app4mc.amalthea.model.Time;

+import org.eclipse.app4mc.amalthea.model.TimeUnit;

+import org.eclipse.app4mc.amalthea.model.io.AmaltheaLoader;

+import org.eclipse.app4mc.amalthea.model.util.FactoryUtil;

+import org.eclipse.app4mc.amalthea.model.util.RuntimeUtil.TimeType;

+import org.eclipse.app4mc.amalthea.model.util.SoftwareUtil;

+import org.eclipse.app4mc.gsoc_rta.SharedConsts.ComParadigm;

+import org.eclipse.emf.common.util.EList;

+

+/**

+ * Date: August 21-2019

+ * @author Junhyung Ki

+ * @version 1.0

+ * 				This class is to analyze End-to-End latency with the help of CPURta class.

+ */

+public class E2ELatency {

+	public CPURta cpurta = new CPURta();

+	public static final int[] defaultIAMapping = new int[] { 4, 1, 1, 3, 4, 0, 3, 3, 3, 0, 6, 2, 5, 6 };

+	public static void main(String[] args) {

+		org.apache.log4j.BasicConfigurator.configure();

+		Logger.getRootLogger().setLevel(Level.ERROR);

+		final E2ELatency ecl = new E2ELatency();

+		ecl.run();

+	}

+	

+	public void run() {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		this.setCPURta(this.cpurta);

+		final EList<EventChain> ecList = this.cpurta.getModel().getConstraintsModel().getEventChains();

+		for (int i = 0; i < ecList.size(); i++) {

+			log.debug(" ----- " + "Chain " + (i+1) + " ----- ");

+			log.debug("Best-case Task-Chain Reaction(Direct): " + this.getTCReactionBC(ecList.get(i), ComParadigm.DIRECT, this.cpurta));

+			log.debug("Worst-case Task-Chain Reaction(Direct): " + this.getTCReactionWC(ecList.get(i), ComParadigm.DIRECT, this.cpurta));

+			log.debug("Best-case Task-Chain Reaction(Implicit): " + this.getTCReactionBC(ecList.get(i), ComParadigm.IMPLICIT, this.cpurta));

+			log.debug("Worst-case Task-Chain Reaction(Implicit): " + this.getTCReactionWC(ecList.get(i), ComParadigm.IMPLICIT, this.cpurta));

+			log.debug("Best-case Task-Chain Reaction(LET): " + this.getLetReactionBC(ecList.get(i), this.cpurta));

+			log.debug("Worst-case Task-Chain Reaction(LET): " + this.getLetReactionWC(ecList.get(i), this.cpurta));

+			log.debug("Worst-case Task-Chain Age(Direct): " + this.getTaskChainAge(ecList.get(i), TimeType.WCET, ComParadigm.DIRECT, this.cpurta));

+			log.debug("Best-case Task-Chain Age(Direct): " + this.getTaskChainAge(ecList.get(i), TimeType.BCET, ComParadigm.DIRECT, this.cpurta));

+			log.debug("Worst-case Task-Chain Age(Implicit): " + this.getTaskChainAge(ecList.get(i), TimeType.WCET, ComParadigm.IMPLICIT, this.cpurta));

+			log.debug("Best-case Task-Chain Age(Implicit): " + this.getTaskChainAge(ecList.get(i), TimeType.BCET, ComParadigm.IMPLICIT, this.cpurta));

+			log.debug("Worst-case Early Reaction(Direct): " + this.getEarlyReaction(ecList.get(i), TimeType.WCET, ComParadigm.DIRECT, this.cpurta));

+			log.debug("Best-case Early Reaction(Direct): " + this.getEarlyReaction(ecList.get(i), TimeType.BCET, ComParadigm.DIRECT, this.cpurta));

+			log.debug("Worst-case Early Reaction(Implicit): " + this.getEarlyReaction(ecList.get(i), TimeType.WCET, ComParadigm.IMPLICIT, this.cpurta));

+			log.debug("Best-case Early Reaction(Implicit): " + this.getEarlyReaction(ecList.get(i), TimeType.BCET, ComParadigm.IMPLICIT, this.cpurta));

+			log.debug("\n");

+		}

+		log.debug("\n################################################################################################################\n");

+		for (int i = 0; i < ecList.size(); i++) {

+			log.debug(" ----- " + "Chain " + (i+1) + " ----- ");

+			for (int j = 0; j < this.cpurta.getModel().getSwModel().getLabels().size(); j++) {

+				final Label label = this.cpurta.getModel().getSwModel().getLabels().get(j);

+				log.debug("***** " + label.getName() + " *****");

+				log.debug("Worst-case Data Age(Direct): " + this.getDataAge(label, ecList.get(i), TimeType.WCET, ComParadigm.DIRECT, this.cpurta));

+				log.debug("Best-case Data Age(Direct): " + this.getDataAge(label, ecList.get(i), TimeType.BCET, ComParadigm.DIRECT, this.cpurta));

+				log.debug("Worst-case Data Age(Implicit): " + this.getDataAge(label, ecList.get(i), TimeType.WCET, ComParadigm.IMPLICIT, this.cpurta));

+				log.debug("Best-case Data Age(Implicit): " + this.getDataAge(label, ecList.get(i), TimeType.BCET, ComParadigm.IMPLICIT, this.cpurta) + "\n");

+			}

+			log.debug("\n");

+		}

+	}

+	

+	/**

+	 * Set CPURta class

+	 * @param cpurta		the instance of CPURta class

+	 */

+	public void setCPURta(final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		cpurta.setModel(AmaltheaLoader.loadFromFile(cpurta.inputFile));

+		if (cpurta.getModel() == null) {

+			log.debug("NOT GOOD!");

+		}

+		cpurta.setTRT(cpurta.getDefaultTRT(cpurta.getModel()));

+		cpurta.setIA(defaultIAMapping);

+		cpurta.setPUl(CommonUtils.getPUs(cpurta.getModel()));

+		cpurta.setContention(cpurta.getIA(), cpurta.getModel());

+	}

+	

+	/**

+	 * Check the readiness of the observed class instance

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				boolean value that indicates whether cpurta instance is ready

+	 */

+	private boolean isTheRTAClassReady(final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		if (cpurta.getModel() == null) {

+			log.debug("Model Setting needs to be done for cpurta!");

+			return false;

+		} else if (cpurta.getTRT() == null) {

+			log.debug("TRT Setting needs to be done for cpurta!");

+			return false;

+		} else if (cpurta.getIA() == null) {

+			log.debug("IA Setting needs to be done for cpurta!");

+			return false;

+		} else if (cpurta.getPUl().size() == 0) {

+			log.debug("PUl Setting needs to be done for cpurta!");

+			return false;

+		} else if (cpurta.getCT() == null) {

+			log.debug("CT Setting needs to be done for cpurta!");

+			return false;

+		}

+		return true;

+	}

+	

+	/**

+	 * Reaction: The time between one of the chain's first task instances to the earliest one of the chain's last task instances 

+	 * which are propagated from the initial one. (which we can also call the best-case task-chain age latency) 

+	 * the best-case E2E Chain Reaction(Direct or Implicit) = Sum of all entities' BCRT

+	 * @param ec			the observed event chain

+	 * @param paradigm		communication paradigm (DIRECT, IMPLICIT)

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				the best-case E2E Chain Reaction(Direct or Implicit)

+	 */

+	public Time getTCReactionBC(final EventChain ec, final ComParadigm paradigm, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		Time e2eRctImplicit = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			for (int i = 0; i < taskChain.size(); i++) {

+				final Task task = taskChain.get(i);

+				final ProcessingUnit pu = getPU(task, cpurta);

+				final List<Task> taskList = getSortedTaskList(task, pu, cpurta);

+				Time bcrt = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				if (isMappedToCPU(task, cpurta)) {

+					if (paradigm.equals(ComParadigm.DIRECT)) {

+						bcrt = cpurta.preciseTestCPURT(task, taskList, TimeType.BCET, pu);

+					} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+						bcrt = cpurta.implicitPreciseTest(task, taskList, TimeType.BCET, pu, cpurta);

+					} else {

+						log.error("'COM_PARADIGM == null' does not work.");

+						return null;

+					}

+				} else {

+					bcrt = cpurta.getTRT().get(task);

+				}

+				/* The task is not schedulable */

+				final BigInteger biPeriod = AmaltheaServices.convertToPicoSeconds(CommonUtils.getStimInTime(task));

+				if (AmaltheaServices.convertToPicoSeconds(bcrt).compareTo(biPeriod) > 0) {

+					return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				}

+				e2eRctImplicit = e2eRctImplicit.add(bcrt);

+			}

+			return e2eRctImplicit;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+

+	/**

+	 * The worst case task chain reaction latency for Direct or Implicit Communication

+	 * @param ec			the observed event chain

+	 * @param paradigm		communication paradigm (DIRECT, IMPLICIT)

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				the worst-case E2E Chain Reaction(Direct or Implicit)

+	 */

+	public Time getTCReactionWC(final EventChain ec, final ComParadigm paradigm, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		Time e2eRctWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			for (int i = 0; i < taskChain.size() - 1; i++) {

+				final Task task = taskChain.get(i);

+				final Time period = CommonUtils.getStimInTime(task);

+				e2eRctWC = e2eRctWC.add(period.multiply(2));

+			}

+			final Task task = taskChain.get(taskChain.size() - 1);

+			Time wcrt = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			if (isMappedToCPU(task, cpurta)) {

+				final ProcessingUnit pu = getPU(task, cpurta);

+				final List<Task> taskList = getSortedTaskList(task, pu, cpurta);

+				if (paradigm.equals(ComParadigm.DIRECT)) {

+					wcrt = cpurta.preciseTestCPURT(task, taskList, TimeType.WCET, pu);

+				} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+					wcrt = cpurta.implicitPreciseTest(task, taskList, TimeType.WCET, pu, cpurta);

+				} else {

+					log.error("'COM_PARADIGM == null' does not work.");

+					return null;

+				}

+			} else {

+				wcrt = cpurta.getTRT().get(task);

+			}

+			/* The task is not schedulable */

+			final BigInteger biPeriod = AmaltheaServices.convertToPicoSeconds(CommonUtils.getStimInTime(task));

+			if (AmaltheaServices.convertToPicoSeconds(wcrt).compareTo(biPeriod) > 0) {

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			e2eRctWC = e2eRctWC.add(wcrt);

+			return e2eRctWC;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+	

+	/**

+	 * Reaction: The time between one of the chain's first task instances to the earliest one of the chain's last task instances 

+	 * which are propagated from the initial one. (which we can also call the best-case task-chain age latency)

+	 * the best-case E2E Chain Reaction(LET) = Sum of all entities' periods

+	 * @param ec			the observed event chain

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				the best-case E2E Chain Reaction(LET)

+	 */

+	public Time getLetReactionBC(final EventChain ec, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		Time e2eRctLET = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			for (int i = 0; i < taskChain.size(); i++) {

+				final Task task = taskChain.get(i);

+				e2eRctLET = e2eRctLET.add(CommonUtils.getStimInTime(task));

+			}

+			return e2eRctLET;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+	

+	/**

+	 * The worst case task chain reaction latency for LET Communication

+	 * @param ec			the observed event chain

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				the worst-case E2E Chain Reaction(LET)

+	 */

+	public Time getLetReactionWC(final EventChain ec, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		Time e2eRctWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			final Task task0 = taskChain.get(0);

+			final Time period0 = CommonUtils.getStimInTime(task0);

+			e2eRctWC = e2eRctWC.add(period0);

+			for (int i = 1; i < taskChain.size(); i++) {

+				final Task task = taskChain.get(i);

+				final Time period = CommonUtils.getStimInTime(task);

+				e2eRctWC = e2eRctWC.add(period.multiply(2));

+			}

+			return e2eRctWC;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+	

+	/**

+	 * A task chain age latency equals the chain's last (response) task age latency

+	 * worst-case: period - bcrt + wcrt

+	 * best-case: period - wcrt + bcrt

+	 * @param ec				the observed event chain

+	 * @param executionCase		WCET / BCET

+	 * @param paradigm			communication paradigm (DIRECT, IMPLICIT)

+	 * @param cpurta			the instance of CPURta class

+	 * @return

+	 * 				the worst-case E2E Task-Chain Age

+	 */

+	public Time getTaskChainAge(final EventChain ec, final TimeType executionCase, final ComParadigm paradigm, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		Time e2eTCAgeWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			final Task task = taskChain.get(taskChain.size()-1);

+			if (isMappedToCPU(task, cpurta)) {

+				final Time period = CommonUtils.getStimInTime(task);

+				final ProcessingUnit pu = getPU(task, cpurta);

+				final List<Task> taskList = getSortedTaskList(task, pu, cpurta);

+				Time bcrt = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				Time wcrt = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				if (paradigm.equals(ComParadigm.DIRECT)) {

+					bcrt = cpurta.preciseTestCPURT(task, taskList, TimeType.BCET, pu);

+					wcrt = cpurta.preciseTestCPURT(task, taskList, TimeType.WCET, pu);

+				} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+					bcrt = cpurta.implicitPreciseTest(task, taskList, TimeType.BCET, pu, cpurta);

+					wcrt = cpurta.implicitPreciseTest(task, taskList, TimeType.WCET, pu, cpurta);

+				} else {

+					log.error("'COM_PARADIGM == null' does not work.");

+					return null;

+				}

+				/* The task is not schedulable */

+				final BigInteger biPeriod = AmaltheaServices.convertToPicoSeconds(CommonUtils.getStimInTime(task));

+				if (AmaltheaServices.convertToPicoSeconds(bcrt).compareTo(biPeriod) > 0) {

+					return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				} else if (AmaltheaServices.convertToPicoSeconds(wcrt).compareTo(biPeriod) > 0) {

+					return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				}

+				if (executionCase.equals(TimeType.WCET)) {

+					e2eTCAgeWC = period.subtract(bcrt).add(wcrt);

+				} else if (executionCase.equals(TimeType.BCET)) {

+					e2eTCAgeWC = period.subtract(wcrt).add(bcrt);

+				} else {

+					log.error("Only WCET or BCET is allowed!");

+					return null;

+				}

+			} else {

+				// TODO: if the observed task is mapped to GPU, then how should we calculate wcrt, bcrt?

+				log.debug("GPU Task, how should we calculate wcrt, bcrt?");

+			}

+			return e2eTCAgeWC;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+

+	/**

+	 * The method is to be used for calculating 'reaction update'.

+	 * @param ec				the observed event chain

+	 * @param executionCase		WCET / BCET

+	 * @param paradigm			communication paradigm (DIRECT, IMPLICIT)

+	 * @param cpurta			the instance of CPURta class

+	 * @return

+	 * 				the reaction latency value of the observed event chain

+	 */

+	public Time getEarlyReaction(final EventChain ec, final TimeType executionCase, final ComParadigm paradigm, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		Time e2eEarlyRct = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			final Task task0 = taskChain.get(0);

+			Time rt0 = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			if (isMappedToCPU(task0, cpurta)) {

+				final ProcessingUnit pu = getPU(task0, cpurta);

+				final List<Task> taskList = getSortedTaskList(task0, pu, cpurta);

+				if (paradigm.equals(ComParadigm.DIRECT)) {

+					rt0 = cpurta.preciseTestCPURT(task0, taskList, executionCase, pu);

+				} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+					rt0 = cpurta.implicitPreciseTest(task0, taskList, executionCase, pu, cpurta);

+				} else {

+					log.error("'COM_PARADIGM == null' does not work.");

+					return null;

+				}

+			} else {

+				rt0 = cpurta.getTRT().get(task0);

+			}

+			/* The task is not schedulable */

+			final BigInteger biPeriod0 = AmaltheaServices.convertToPicoSeconds(CommonUtils.getStimInTime(task0));

+			if (AmaltheaServices.convertToPicoSeconds(rt0).compareTo(biPeriod0) > 0) {

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			e2eEarlyRct = e2eEarlyRct.add(rt0);

+			Time epsilon = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			for (int i = 0; i < taskChain.size() - 1; i++) {

+				final Time nextPeriod = CommonUtils.getStimInTime(taskChain.get(i + 1));

+				/* SUM (Sigma Starts) */

+				final Time period = CommonUtils.getStimInTime(taskChain.get(i));

+				final Task currentTask = taskChain.get(i);

+				Time rtA = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				if (isMappedToCPU(currentTask, cpurta)) {

+					final ProcessingUnit puA = getPU(currentTask, cpurta);

+					final List<Task> taskListA = getSortedTaskList(currentTask, puA, cpurta);

+					/* NOTE: Sometimes rtA, rtB are BigInteger.valueOf(Long.MAX_VALUE) if it is executed with the implicit communication paradigm */

+					/* In that case, the task is not schedulable, so the method should return 0 ps, otherwise the result is not correct and

+					 * would likely be negative (subtract the max BigIntegerValue would be obviously negative in most cases) */

+					if (paradigm.equals(ComParadigm.DIRECT)) {

+						rtA = cpurta.preciseTestCPURT(currentTask, taskListA, executionCase, puA);

+					} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+						rtA = cpurta.implicitPreciseTest(currentTask, taskListA, executionCase, puA, cpurta);

+					}

+				} else {

+					rtA = cpurta.getTRT().get(currentTask);

+				}

+				/* The task is not schedulable */

+				final BigInteger biPeriod = AmaltheaServices.convertToPicoSeconds(period);

+				if (AmaltheaServices.convertToPicoSeconds(rtA).compareTo(biPeriod) > 0) {

+					return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				}

+				final Time currentEpsilon = (((period.multiply(2)).subtract(rtA)).subtract(nextPeriod)).subtract(epsilon);

+				epsilon = currentEpsilon;

+				final Task nextTask = taskChain.get(i + 1);

+				Time rtB = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				if (isMappedToCPU(nextTask, cpurta)) {

+					final ProcessingUnit puB = getPU(nextTask, cpurta);

+					final List<Task> taskListB = getSortedTaskList(nextTask, puB, cpurta);

+					if (paradigm.equals(ComParadigm.DIRECT)) {

+						rtB = cpurta.preciseTestCPURT(nextTask, taskListB, executionCase, puB);

+					} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+						rtB = cpurta.implicitPreciseTest(nextTask, taskListB, executionCase, puB, cpurta);

+					}

+				} else {

+					rtB = cpurta.getTRT().get(nextTask);

+				}

+				/* The task is not schedulable */

+				final BigInteger biPeriodB = AmaltheaServices.convertToPicoSeconds(CommonUtils.getStimInTime(nextTask));

+				if (AmaltheaServices.convertToPicoSeconds(rtB).compareTo(biPeriodB) > 0) {

+					return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				}

+				if (nextPeriod.compareTo(currentEpsilon.add(rtB)) < 0) {

+					e2eEarlyRct = e2eEarlyRct.add(nextPeriod.multiply(2));

+				} else {

+					e2eEarlyRct = e2eEarlyRct.add(nextPeriod.add(currentEpsilon.add(rtB)));

+				}

+				if (e2eEarlyRct.compareTo(FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS)) < 0) {

+					return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				}

+			}

+			return e2eEarlyRct;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+	

+	/**

+	 * the longest time some data version persists in memory.

+	 * worst-case: min (worst-case age latencies of the tasks that contain the observed label)

+	 * best-case: min (best-case age latencies of the tasks that contain the observed label)

+	 * @param label				the observed label (data)

+	 * @param ec				the observed event-chain

+	 * @param executionCase		WCET / BCET

+	 * @param paradigm			communication paradigm (DIRECT, IMPLICIT)

+	 * @param cpurta			the instance of CPURta class

+	 * @return

+	 * 				the data age latency (wc or bc) of the given label

+	 * 				If any of tasks in the chain does not contain the observed label, the method shall return null.

+	 */

+	public Time getDataAge(final Label label, final EventChain ec, final TimeType executionCase, final ComParadigm paradigm, final CPURta cpurta) {

+		final Logger log = Logger.getLogger(E2ELatency.class);

+		if (isTheRTAClassReady(cpurta)) {

+			final List<Time> dataAgeList = new ArrayList<Time>();

+			final List<Task> taskChain = getECTaskList(ec);

+			if (taskChain.size() == 0) {

+				log.error("This task chain is empty.");

+				return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+			}

+			for (int i = 0; i < taskChain.size(); i++) {

+				if (isMappedToCPU(taskChain.get(i), cpurta)) {

+					final Task task = taskChain.get(i);

+					final Set<Label> labelSet = SoftwareUtil.getAccessedLabelSet(task, null);

+					if(labelSet.contains(label)) {

+						Time dataAge = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+						final ProcessingUnit pu = getPU(task, cpurta);

+						final List<Task> taskList = getSortedTaskList(task, pu, cpurta);

+						final Time period = CommonUtils.getStimInTime(task);

+						Time bcrt = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+						Time wcrt = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+						if (paradigm.equals(ComParadigm.DIRECT)) {

+							bcrt = cpurta.preciseTestCPURT(task, taskList, TimeType.BCET, pu);

+							wcrt = cpurta.preciseTestCPURT(task, taskList, TimeType.WCET, pu);

+						} else if (paradigm.equals(ComParadigm.IMPLICIT)) {

+							bcrt = cpurta.implicitPreciseTest(task, taskList, TimeType.BCET, pu, cpurta);

+							wcrt = cpurta.implicitPreciseTest(task, taskList, TimeType.WCET, pu, cpurta);

+						} else {

+							log.error("'COM_PARADIGM == null' does not work.");

+							return null;

+						}

+						/* The task is not schedulable */

+						final BigInteger biPeriod = AmaltheaServices.convertToPicoSeconds(CommonUtils.getStimInTime(task));

+						if (AmaltheaServices.convertToPicoSeconds(bcrt).compareTo(biPeriod) > 0) {

+							return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+						} else if (AmaltheaServices.convertToPicoSeconds(wcrt).compareTo(biPeriod) > 0) {

+							return FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+						}

+						if (executionCase.equals(TimeType.WCET)) {

+							dataAge = period.subtract(bcrt).add(wcrt);

+						} else if (executionCase.equals(TimeType.BCET)) {

+							dataAge = period.subtract(wcrt).add(bcrt);

+						} else {

+							log.error("Only WCET or BCET is allowed!");

+						}

+						dataAgeList.add(dataAge);

+					}

+				}

+			}

+			if (dataAgeList.size() != 0) {

+				Collections.sort(dataAgeList, new TimeComp());

+				return dataAgeList.get(0);

+			}

+			return null;

+		}

+		log.error("cpurta instance is not ready!");

+		return null;

+	}

+	

+	/**

+	 * Get an Event-Chain Entity List (Task-based)

+	 * @param ec			the observed event chain

+	 * @return			

+	 * 				the corresponding EC task list

+	 */

+	public List<Task> getECTaskList(final EventChain ec) {

+		final List<Task> chain = new ArrayList<Task>();

+		for (int i = 0; i < ec.getSegments().size(); i++) {

+			final EventChainItem eci = ec.getSegments().get(i);

+			if (eci instanceof EventChainContainer) {

+				final EventChainContainer ecc = (EventChainContainer) eci;

+				final Event stiEvent = ecc.getEventChain().getStimulus();

+				if (stiEvent instanceof ProcessEvent) {

+					final Task stiTask = (Task)((ProcessEvent) stiEvent).getEntity();

+					chain.add(stiTask);

+				}

+				if (i == ec.getSegments().size() - 1) {

+					final Event resEvent = ecc.getEventChain().getResponse();

+					if (resEvent instanceof ProcessEvent) {

+						final Task resTask = (Task)((ProcessEvent) resEvent).getEntity();

+						chain.add(resTask);

+					}

+					break;

+				}

+			}

+		}

+		return chain;

+	}

+	

+	/**

+	 * get the processing unit that the observed task is mapped to

+	 * @param task			the observed task

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				pu

+	 */

+	private ProcessingUnit getPU(final Task task, final CPURta cpurta) {

+		final int tindex = cpurta.getModel().getSwModel().getTasks().indexOf(task);

+		final int puindex = cpurta.getIA()[tindex];

+		final ProcessingUnit pu = cpurta.getPUl().get(puindex);

+		return pu;

+	}

+	

+	/**

+	 * get the sorted task listed based on the given integer array mapping

+	 * @param task			the observed task

+	 * @param pu			ProcessingUnit that would compute the given method

+	 * @param cpurta		the instance of CPURta class

+	 * @return

+	 * 				sortedTaskList

+	 */

+	private List<Task> getSortedTaskList(final Task task, final ProcessingUnit pu, final CPURta cpurta) {

+		final int puIndex = cpurta.getPUl().indexOf(pu);

+		/* 2. get all tasks mapped to this CPU */

+		final List<Task> puTaskList = new ArrayList<Task>();

+		for (int i = 0; i < cpurta.getIA().length; i++) {

+			if (cpurta.getIA()[i] == puIndex) {

+				puTaskList.add(cpurta.getModel().getSwModel().getTasks().get(i));

+			}

+		}

+		final List<Task> sortedTaskList = taskSorting(puTaskList);

+		return sortedTaskList;

+	}

+	

+	/**

+	 * Sort out the given list of tasks (in order of shorter period first - Rate Monotonic Scheduling)

+	 * @param taskList		list of tasks that is mapped to the same core	

+	 * @return

+	 * 				the sorted list of tasks

+	 */

+	private List<Task> taskSorting(final List<Task> taskList) {

+		/* Getting stimuliList out of the given taskList (because it is RMS) */

+		final List<Time> stimuliList = new ArrayList<>();

+		for (final Task t : taskList) {

+			stimuliList.add(CommonUtils.getStimInTime(t));

+		}

+		/* Sorting (Shortest Period(Time) first) */

+		Collections.sort(stimuliList, new TimeComp());

+		/* Sort tasks to the newTaskList in order of Period length (shortest first

+		 * longest last)-(according to the stimuliList) */

+		final List<Task> newTaskList = new ArrayList<>();

+		for (int i = 0; i < stimuliList.size(); i++) {

+			for (final Task t : taskList) {

+				if ((!newTaskList.contains(t)) && (stimuliList.get(i).compareTo(CommonUtils.getStimInTime(t)) == 0)) {

+					newTaskList.add(t);

+				}

+			}

+		}

+		return newTaskList;

+	}

+	

+	/**

+	 * To check whether or not the observed task is mapped to CPU (according to the integer array)

+	 * @param task				the observed task

+	 * @param cpurta			the instance of CPURta class that contains model & mapping IA info

+	 * @return

+	 * 				boolean value that says whether or not it is mapped to CPU

+	 */

+	private static boolean isMappedToCPU (final Task task, final CPURta cpurta) {

+		/* The observed task is a GPU task */

+		if (cpurta.getGpuTaskList().contains(task)) {

+			final int index = cpurta.getModel().getSwModel().getTasks().indexOf(task);

+			final int cpuThreshold = CommonUtils.getNumberofCPUs(cpurta.getModel()) - 1;

+			final int[] ia = cpurta.getIA();

+			/* when the observed GPU task is mapped to GPU */

+			if (ia[index] > cpuThreshold) {

+				return false;

+			}

+		}

+		/* when the observed task(CPU or GPU) is mapped to CPU */

+		return true;

+	}

+}

+

+/**

+ * @Date: August 21-2019

+ * @version 1.0

+ *			This inner class is used for sorting a Time type list.

+ *			If the Time of a is smaller than that of b, it returns -1.

+ *			If the Time of a is bigger than that of b, it returns 1.

+ */

+class TimeComp implements Comparator<Time> {

+	@Override

+	public int compare(final Time a, final Time b) {

+		if (a.compareTo(b) < 0) {

+			return -1;

+		}

+		return 1;

+	}

+}

+

+/**

+ * @Date: August 21-2019

+ * @version 1.0

+ *			This inner class is used for the method "letCom" to help compare between different values of propagation, age, reaction

+ *			in basicPaths (which is bigger)

+ *			If the BigDecimal of a is smaller than that of b, it returns -1.

+ *			If the BigDecimal of a is bigger than that of b, it returns 1.

+ */

+class BigDecimalComp implements Comparator<BigDecimal> {

+	@Override

+	public int compare(final BigDecimal a, final BigDecimal b) {

+		if (a.compareTo(b) < 0) {

+			return -1;

+		}

+		return 1;

+	}

+}
\ No newline at end of file
diff --git a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/RuntimeUtilRTA.java b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/RTARuntimeUtil.java
similarity index 70%
rename from eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/RuntimeUtilRTA.java
rename to eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/RTARuntimeUtil.java
index 4713894..da619aa 100644
--- a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/RuntimeUtilRTA.java
+++ b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/RTARuntimeUtil.java
@@ -14,6 +14,7 @@
 package org.eclipse.app4mc.gsoc_rta;

 

 import java.math.BigInteger;

+import java.util.ArrayList;

 import java.util.HashMap;

 import java.util.List;

 import java.util.stream.Collectors;

@@ -37,41 +38,37 @@
 import org.eclipse.app4mc.amalthea.model.TimeUnit;

 import org.eclipse.app4mc.amalthea.model.WaitEvent;

 import org.eclipse.app4mc.amalthea.model.util.FactoryUtil;

-import org.eclipse.app4mc.amalthea.model.util.RuntimeUtil;

 import org.eclipse.app4mc.amalthea.model.util.RuntimeUtil.TimeType;

 import org.eclipse.app4mc.amalthea.model.util.SoftwareUtil;

 import org.eclipse.emf.common.util.EList;

 

 /**

- * Date: June 21-2019 

+ * Date: August 21-2019

  * @author Junhyung Ki

  * @version 1.0

- *					This class is to support CpuRTA class. Response Time Analysis contains low level calculation 

+ *					This class is to support CPURta class. Response Time Analysis contains low level calculation 

  *					such as deriving execution time of a Task or Runnable. Execution time calculation varies depending on the analyzed model. 

  *					Therefore, it is necessary to separate from Response Time calculation to increase adaptability.

- *					Only 'getExecutionTimeforCPUTask' method is accessible for CpuRTA and the rest are sub-methods of it.

+ *					Only 'getExecutionTimeforCPUTask' method is accessible for CPURta and the rest are sub-methods of it.

  */

-public class RuntimeUtilRTA {

+public class RTARuntimeUtil {

 	/**

-	 * Calculate execution time of the given task under one of the several configurations.

-	 * Since this method is used by CPURtaIA, the visibility should be 'protected'

+	 * Calculate execution time of the given task under one of the four cases with some configurations.

+	 * Since this method is used by CPURta, the visibility should be 'public'

 	 * 1. triggering task in the synchronous mode

 	 * 2. triggering task in the asynchronous mode

 	 * 3. GPU task on CPU

 	 * 4. task with only Ticks

-	 * 

 	 * @param task				the observed task

 	 * @param pu				ProcessingUnit that would compute the given task (A57 or Denver)

 	 * @param executionCase		BCET, ACET, WCET

-	 * @param trt				HashMap that would contain the corresponding GPU task's response time

-	 * @param cpurta			the instance of CPURtaIA class that calls this method

+	 * @param cpurta			the instance of CPURta class that calls this method

 	 * 							(to access to the cumuAcTime Time variable that accumulate access latency)

 	 * @return

 	 * 			execution time of the observed task

 	 */

-	protected Time getExecutionTimeforCPUTask(final Task task, final ProcessingUnit pu, final TimeType executionCase, final CpuRTA cpurta) {

-		Logger.getLogger(RuntimeUtilRTA.class);

-		// TODO: Contention Parameter

+	public Time getExecutionTimeforCPUTask(final Task task, final ProcessingUnit pu, final TimeType executionCase, final CPURta cpurta) {

+		Logger.getLogger(RTARuntimeUtil.class);

 		/* set the default result time variable as 0s */

 		Time result = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

 		/* check if the current task is a triggering task.

@@ -80,7 +77,8 @@
 		if (doesThisTaskTriggerCPUTask(task, cpurta)) {

 			return result;

 		}

-		// TODO: Contention

+		/* contention time */

+		final Time contention = cpurta.getCT().contentionForTask(task);

 		/* The list of runnables of the given task */

 		final List<Runnable> runnableList = SoftwareUtil.getRunnableList(task, null);

 		/* To identify the index of the triggerEvent */

@@ -118,18 +116,16 @@
 				/* GPU Origin task that is newly mapped to CPU */

 				if (cpurta.getGpuTaskList().contains(task)) {

 					result = result.add(getExecutionTimeForGPUTaskOnCPU(task, runnableList, pu, executionCase, cpurta));

-					// TODO: result = result.add(contention);

+					result = result.add(contention);

 					return result;

 				}

 				/* No Triggering Behavior (No InterProcessTrigger) */

 				for (final Runnable r : runnableList) {

 					result = result.add(getExecutionTimeForRTARunnable(r, pu, executionCase));

 				}

-				// TODO: result = result.add(contention);

-				return result;

 			}

 		}

-		// TODO: result = result.add(contention);

+		result = result.add(contention);

 		return result;

 	}

 

@@ -137,15 +133,14 @@
 	 * Find out whether the given triggering task(that has an InterProcessTrigger) triggers a GPU task which is newly mapped to CPU.

 	 * If the ProcessingUnit index of the triggered task is bigger than the biggest CPU index, that means the triggered task is mapped to GPU

 	 * which would return false.

-	 * 

 	 * @param task			the observed task

-	 * @param cpurta		the instance of CPURtaIA class that calls this method

+	 * @param cpurta		the instance of CPURta class that calls this method

 	 * 						(to get the task List & the integer array to identify the ProcessingUnit index of the triggered task)

 	 * @return

 	 * 			boolean value (true: the observed task triggers a task that is mapped to CPU / 

 	 * 						   false: the observed task triggers a task that is mapped to GPU)

 	 */

-	private boolean doesThisTaskTriggerCPUTask(final Task task, final CpuRTA cpurta) {

+	private boolean doesThisTaskTriggerCPUTask(final Task task, final CPURta cpurta) {

 		if (cpurta.getTriggeringTaskList().contains(task)) {

 			final List<CallSequenceItem> callList = SoftwareUtil.collectCalls(task, null, 

 					(call -> call instanceof TaskRunnableCall || call instanceof InterProcessTrigger || call instanceof ClearEvent

@@ -161,13 +156,13 @@
 					if (theTask.getStimuli().get(0) instanceof InterProcessStimulus) {

 						final InterProcessStimulus thisIPS = (InterProcessStimulus) theTask.getStimuli().get(0);

 						if (ips.equals(thisIPS)) {

-							Logger.getLogger(RuntimeUtilRTA.class).debug("Confirmation: The triggered task mapped to (GPU)");

+							Logger.getLogger(RTARuntimeUtil.class).debug("Confirmation: The triggered task mapped to (GPU)");

 							return false;

 						}

 					}

 				}

 			}

-			Logger.getLogger(RuntimeUtilRTA.class).debug("Confirmation: The triggered task mapped to (CPU)");

+			Logger.getLogger(RTARuntimeUtil.class).debug("Confirmation: The triggered task mapped to (CPU)");

 			return true;

 		}

 		return false;

@@ -176,22 +171,20 @@
 	/**

 	 * Calculate execution time of the given runnableList in a synchronous manner.

 	 * (execution time of pre-processing) + GPU task response time + (execution time of post-processing)

-	 * 

 	 * @param indexforTrigger	Integer variable that is used to get InterProcessTrigger to identify the triggered GPU task

 	 * @param callSequenceList	callSequenceList List variable that is used to get InterProcessTrigger to identify the triggered GPU task

 	 * @param runnableList		the observed runnable List to calculate execution time in the synchronous mode

-	 * @param trt				HashMap that would contain the corresponding GPU task's response time

 	 * @param pu				ProcessingUnit that would compute the given runnable (A57 or Denver)

 	 * @param executionCase		BCET, ACET, WCET

-	 * @param cpurta			the instance of CPURtaIA class that calls this method

+	 * @param cpurta			the instance of CPURta class that calls this method

 	 * 							(to get the identified triggered GPU task in the model)

 	 * 							(to access to the cumuAcTime Time variable that accumulate access latency)

 	 * @return

 	 * 			synchronous execution time of the observed set

 	 */

 	private Time syncTypeOperation(final int indexforTrigger, final List<CallSequenceItem> callSequenceList, final List<Runnable> runnableList,

-			final ProcessingUnit pu, final TimeType executionCase, final CpuRTA cpurta) {

-		Logger.getLogger(RuntimeUtilRTA.class).debug("TYPE: SYNC");

+			final ProcessingUnit pu, final TimeType executionCase, final CPURta cpurta) {

+		Logger.getLogger(RTARuntimeUtil.class).debug("TYPE: SYNC");

 		/* set the default result time variable as 0s */

 		Time result = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

 		/* Sum all the runnable ExecutionTime of the CPU Task */

@@ -208,7 +201,6 @@
 	/**

 	 * Calculate execution time of the given runnableList in an asynchronous manner.

 	 * (execution time of pre-processing) + (execution time of post-processing) 

-	 * 

 	 * @param runnableList		the observed runnable List to calculate execution time in the asynchronous mode

 	 * @param pu				ProcessingUnit that would compute the given runnable (A57 or Denver)

 	 * @param executionCase		BCET, ACET, WCET

@@ -216,7 +208,7 @@
 	 * 			asynchronous execution time of the observed runnable List

 	 */

 	private Time asyncTypeOperation(final List<Runnable> runnableList, final ProcessingUnit pu, final TimeType executionCase) {

-		Logger.getLogger(RuntimeUtilRTA.class).debug("TYPE: ASYNC");

+		Logger.getLogger(RTARuntimeUtil.class).debug("TYPE: ASYNC");

 		/**

 		 * <Asynchronous Task> et_t=sum_{runnable calls before GPU trigger

 		 * event}et_r + et_{runnable calls after GPU trigger event};

@@ -234,28 +226,29 @@
 	/**

 	 * Identify whether or not the given task has the OffloadingAsyncCosts Runnable (that takes costs into account in the Asynchronous mode)

 	 * which some triggering tasks do not have.

-	 * Since this method is used by CPURtaIA, the visibility should be 'protected'

-	 * 

+	 * Since this method is used by CPURta, the visibility should be 'protected'

 	 * @param task			the observed task

-	 * @param cpurta		the instance of CPURtaIA class that calls this method

+	 * @param cpurta		the instance of CPURta class that calls this method

 	 * 						(to access to the triggeringTaskList List<Task> variable that contains tasks with an InterProcessTrigger)

 	 * @return

 	 * 			boolean value of the result

 	 */

-	protected static boolean doesTaskHaveAsyncRunnable (final Task task, final CpuRTA cpurta) {

+	protected static boolean doesTaskHaveAsyncRunnable (final Task task, final CPURta cpurta) {

 		boolean result = false;

 		if (cpurta.getTriggeringTaskList().contains(task)) {

 			final List<CallSequenceItem> callList = SoftwareUtil.collectCalls(task, null, 

 					(call -> call instanceof TaskRunnableCall || call instanceof InterProcessTrigger || call instanceof ClearEvent

 							|| call instanceof SetEvent || call instanceof WaitEvent));

 			final int waitIndex = callList.indexOf(callList.stream().filter(s -> s instanceof WaitEvent).iterator().next());

-			final int clearIndex = callList.indexOf(callList.stream().filter(s -> s instanceof ClearEvent).iterator().next());

-			if ((clearIndex - waitIndex) > 1) {

-				result = true;

+			List<CallSequenceItem> clearEvent = callList.stream().filter(s -> s instanceof ClearEvent).collect(Collectors.toList());

+			if (clearEvent.size() != 0) {

+				final int clearIndex = callList.indexOf(callList.stream().filter(s -> s instanceof ClearEvent).iterator().next());

+				if ((clearIndex - waitIndex) > 1) {

+					result = true;

+				}

 			}

-		}

-		else {

-			Logger.getLogger(RuntimeUtilRTA.class).debug("ERROR: This task is not a triggering task!!");

+		} else {

+			Logger.getLogger(RTARuntimeUtil.class).debug("ERROR: This task is not a triggering task!!");

 		}

 		return result;

 	}

@@ -265,19 +258,18 @@
 	 * It should ignore offloading runnables and take the required labels(read from pre-processing, write from post-processing) into account.

 	 * The method follows Read / Compute(Ticks) / Write semantic.

 	 * Read(Write)_Access_Time = Round_UP(Size_of_Read_Labels / 64.0 Bytes) * (Read_Latency / Frequency)

-	 * 

 	 * @param task				the observed task

 	 * @param runnableList		runnable list of the given task

 	 * @param pu				ProcessingUnit that would compute the given runnable (A57 or Denver)

 	 * @param executionCase		BCET, ACET, WCET

-	 * @param cpurta			the instance of CPURtaIA class that calls this method

+	 * @param cpurta			the instance of CPURta class that calls this method

 	 * 							(to access to the gpuToCpuLabels HashMap variable that contains List<Label> of required read & write labels)

 	 * @return

 	 * 			execution time of the observed task

 	 */

 	private Time getExecutionTimeForGPUTaskOnCPU(final Task task, final List<Runnable> runnableList, final ProcessingUnit pu, 

-			final TimeType executionCase, final CpuRTA cpurta) {

-		Logger.getLogger(RuntimeUtilRTA.class).debug("TYPE: GPUTaskOnCPU // " + "Task: " + task.getName());

+			final TimeType executionCase, final CPURta cpurta) {

+		Logger.getLogger(RTARuntimeUtil.class).debug("TYPE: GPUTaskOnCPU // " + "Task: " + task.getName());

 		Time result = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

 		Runnable funcRunnable = null;

 		for (final Runnable r : runnableList) {

@@ -289,15 +281,15 @@
 		}

 		final Time parameter = FactoryUtil.createTime(BigInteger.ONE, TimeUnit.S);

 		final double freq = AmaltheaServices.convertToHertz(pu.getFrequencyDomain().getDefaultValue()).longValue();

-		final HashMap<Task, List<Label>[]> gtcl = cpurta.getGTCL();

-		final List<Label>[] thisLabelList = gtcl.get(task);

-		final List<Label> readLabelList = thisLabelList[0];

-		final List<Label> writeLabelList = thisLabelList[1];

+		final HashMap<Task, List<List<Label>>> gtcl = cpurta.getGTCL();

+		final List<List<Label>> thisLabelList = gtcl.get(task);

+		final List<Label> readLabelList = thisLabelList.get(0);

+		final List<Label> writeLabelList = thisLabelList.get(1);

 		for (final Label l : readLabelList) {

-			Logger.getLogger(RuntimeUtilRTA.class).debug("Label(Read): " + l.getName() + " // (" + task.getName() + ")");

+			Logger.getLogger(RTARuntimeUtil.class).debug("Label(Read): " + l.getName() + " // (" + task.getName() + ")");

 		}

 		for (final Label l : writeLabelList) {

-			Logger.getLogger(RuntimeUtilRTA.class).debug("Label(Write): " + l.getName() + " // (" + task.getName() + ")");

+			Logger.getLogger(RTARuntimeUtil.class).debug("Label(Write): " + l.getName() + " // (" + task.getName() + ")");

 		}

 		double readLatency = 0;

 		double writeLatency = 0;

@@ -325,7 +317,9 @@
 		/* Execution (Ticks): */

 		final List<Ticks> ticksList = SoftwareUtil.getTicks(funcRunnable, null);

 		for (final Ticks t : ticksList) {

-			final Time tickExecution = RuntimeUtil.getExecutionTimeForTicks(t, pu, executionCase);

+			// TODO: This line Should be replaced into below in the version 0.9.5 */

+			final Time tickExecution = CommonUtils.getExecutionTimeForTicks(t, pu, executionCase); // 0.9.4

+			// final Time tickExecution = RuntimeUtil.getExecutionTimeForTicks(t, pu, executionCase); // 0.9.5

 			result = result.add(tickExecution); // Execution(Ticks) added

 		}

 		/* Write (LabelAccess): */

@@ -343,15 +337,14 @@
 	/**

 	 * Calculate execution time of the given runnable.

 	 * The method consider Read / Compute(Ticks) / Write semantic.

-	 * 

 	 * @param runnable			the observed runnable

 	 * @param pu				ProcessingUnit that would compute the given runnable (A57 or Denver)

 	 * @param executionCase		BCET, ACET, WCET

 	 * @return

 	 * 			execution time of the observed runnable

 	 */

-	protected Time getExecutionTimeForRTARunnable(final Runnable runnable, final ProcessingUnit pu, final TimeType executionCase) {

-		Logger.getLogger(RuntimeUtilRTA.class).debug(executionCase.toString());

+	private Time getExecutionTimeForRTARunnable(final Runnable runnable, final ProcessingUnit pu, final TimeType executionCase) {

+		Logger.getLogger(RTARuntimeUtil.class).debug(executionCase.toString());

 		Time result = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

 		final double freq = AmaltheaServices.convertToHertz(pu.getFrequencyDomain().getDefaultValue()).longValue();

 		double readLatency = 0;

@@ -374,7 +367,9 @@
 		/* Execution (Ticks): */

 		final List<Ticks> ticksList = SoftwareUtil.getTicks(runnable, null);

 		for (final Ticks t : ticksList) {

-			final Time tickExecution = RuntimeUtil.getExecutionTimeForTicks(t, pu, executionCase);

+			// TODO: This line Should be replaced into below in the version 0.9.5 */

+			final Time tickExecution = CommonUtils.getExecutionTimeForTicks(t, pu, executionCase); // 0.9.4

+			// final Time tickExecution = RuntimeUtil.getExecutionTimeForTicks(t, pu, executionCase); // 0.9.5

 			result = result.add(tickExecution); // Execution(Ticks) added

 		}

 		return result;

@@ -382,15 +377,14 @@
 

 	/**

 	 * Calculate memory access time of the observed task.

-	 * Since this method is used by CPURtaIA, the visibility should be 'protected'

-	 * 

+	 * Since this method is used by CPURta, the visibility should be 'public'

 	 * @param task				the observed task

 	 * @param pu				ProcessingUnit that would compute the given runnable (A57 or Denver)

 	 * @param executionCase		BCET, ACET, WCET

 	 * @return

 	 * 			memory access time of the observed task

 	 */

-	protected Time getTaskMemoryAccessTime (final Task task, final ProcessingUnit pu, final TimeType executionCase) {

+	public Time getTaskMemoryAccessTime (final Task task, final ProcessingUnit pu, final TimeType executionCase) {

 		Time result = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

 		final double freq = AmaltheaServices.convertToHertz(pu.getFrequencyDomain().getDefaultValue()).longValue();

 		final List<Runnable> runnableList = SoftwareUtil.getRunnableList(task, null);

@@ -418,7 +412,6 @@
 	 * Calculate memory access time of the observed runnable.

 	 * The method follows Read / Compute(Ticks) / Write semantic.

 	 * Read(Write)_Access_Time = Round_UP(Size_of_Read_Labels / 64.0 Bytes) * (Read_Latency / Frequency)

-	 * 

 	 * @param runnable			the observed runnable

 	 * @param frequency			frequency value of the Processing Unit

 	 * @param readLatency		readLatency value of the Processing Unit

@@ -457,12 +450,11 @@
 

 	/**

 	 * Identify whether the given task has an InterProcessTrigger or not.

-	 * 

 	 * @param task			the observed task

 	 * @return

 	 * 			boolean value of the result

 	 */

-	protected static boolean isTriggeringTask(final Task task) {

+	private static boolean isTriggeringTask(final Task task) {

 		/* true: Triggering Task, false: Non-Triggering Task */

 		boolean result = false;

 		final List<CallSequenceItem> callList = SoftwareUtil.collectCalls(task, null, 

@@ -474,4 +466,106 @@
 		}

 		return result;

 	}

+	

+	/******************************************* Implicit Communication Paradigm *************************************************/

+	

+	/**

+	 * For the implicit communication paradigm

+	 * Time[0] = copy-in time for the observed task, Time[1] = copy-out time for the observed task

+	 * if a GPU task mapped to CPU is passed here, we also need to consider its required labels from Pre-Pro processing runnables

+	 * @param task				the observed task

+	 * @param pu				the processing unit that the observed task is mapped to

+	 * @param executionCase		WCET, BCET, ACET

+	 * @return

+	 * 				Time array that contains copy-in, copy-out time of the observed task

+	 */

+	public Time[] getLocalCopyTimeArray(final Task task, final ProcessingUnit pu, final TimeType executionCase, final CPURta cpurta) {

+		Time[] ta = new Time[2];

+		Time readCopy = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		Time writeCopy = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		/* The observed task is a GPU task */

+		if (cpurta.getGpuTaskList().contains(task)) {

+			final HashMap<Task, List<List<Label>>> gtcl = cpurta.getGTCL();

+			final List<List<Label>> thisLabelList = gtcl.get(task);

+			final List<Label> readLabels = thisLabelList.get(0);

+			final List<Label> writeLabels = thisLabelList.get(1);

+			for (final Label rl : readLabels) {

+				readCopy = readCopy.add(getCopyEngineTime(rl, pu, executionCase, true));

+			}

+			ta[0] = readCopy;

+			for (final Label wl : writeLabels) {

+				writeCopy = writeCopy.add(getCopyEngineTime(wl, pu, executionCase, false));

+			}

+			ta[1] = writeCopy;

+			return ta;	

+		}

+		/* The observed task is a CPU task */

+		final List<Runnable> runnableList = SoftwareUtil.getRunnableList(task, null);

+		final List<Label> readList = new ArrayList<Label>();

+		final List<Label> writeList = new ArrayList<Label>();

+		for (int i = 0; i < runnableList.size(); i++) {

+			final Runnable runnable = runnableList.get(i);

+			final List<LabelAccess> laList = SoftwareUtil.getLabelAccessList(runnable, null);

+			final List<Label> rList = laList.stream().filter(s -> (s.getAccess()).equals(LabelAccessEnum.READ))

+					.map(s->s.getData()).collect(Collectors.toList());

+			rList.stream().forEach(s -> readList.add(s));

+			final List<Label> wList = laList.stream().filter(s -> (s.getAccess()).equals(LabelAccessEnum.WRITE))

+					.map(s->s.getData()).collect(Collectors.toList());

+			wList.stream().forEach(s -> writeList.add(s));

+		}

+		final List<Label> readLabels = readList.stream().distinct().collect(Collectors.toList());

+		final List<Label> writeLabels = writeList.stream().distinct().collect(Collectors.toList());

+		for (final Label rl : readLabels) {

+			readCopy = readCopy.add(getCopyEngineTime(rl, pu, executionCase, true));

+		}

+		ta[0] = readCopy;

+		for (final Label wl : writeLabels) {

+			writeCopy = writeCopy.add(getCopyEngineTime(wl, pu, executionCase, false));

+		}

+		ta[1] = writeCopy;

+		return ta;

+	}

+	

+	/**

+	 * The method is used to calculate CopyEngine time for single label.

+	 * @param label				the observed label

+	 * @param pu				ProcessingUnit that would process the given label

+	 * @param executionCase		BCET, ACET, WCET

+	 * @param readOrWrite		when the given runnable is 'runnable_0'(the first callSquence of the task), it is read(true),

+	 * 							when the given runnable is 'runnable_Last'(the last callSquence of the task), it is write(false).

+	 * @return

+	 * 				the given label copy engine time

+	 */

+	private Time getCopyEngineTime(final Label label, final ProcessingUnit pu, final TimeType executionCase, final boolean readOrWrite) {

+		Time result = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+		final Time parameter = FactoryUtil.createTime(BigInteger.ONE, TimeUnit.S);

+		final double freq = AmaltheaServices.convertToHertz(pu.getFrequencyDomain().getDefaultValue()).longValue();

+		double latency = 0;

+		/* Read */

+		if(readOrWrite) {

+			if (executionCase.equals(TimeType.BCET)) {

+				latency = pu.getAccessElements().get(0).getReadLatency().getLowerBound();

+			} else if (executionCase.equals(TimeType.ACET)) {

+				latency = pu.getAccessElements().get(0).getReadLatency().getAverage();

+			} else if (executionCase.equals(TimeType.WCET)) {

+				latency = pu.getAccessElements().get(0).getReadLatency().getUpperBound();

+			}

+		}

+		/* Write */

+		else {

+			if (executionCase.equals(TimeType.BCET)) {

+				latency = pu.getAccessElements().get(0).getWriteLatency().getLowerBound();

+			} else if (executionCase.equals(TimeType.ACET)) {

+				latency = pu.getAccessElements().get(0).getWriteLatency().getAverage();

+			} else if (executionCase.equals(TimeType.WCET)) {

+				latency = pu.getAccessElements().get(0).getWriteLatency().getUpperBound();

+			}

+		}

+		double labelAccessParameter = 0;

+		final double labelSize = label.getSize().getNumberBytes();

+		labelAccessParameter = (Math.ceil(labelSize / 64.0) * (latency / freq));

+		final Time labelAccess = parameter.multiply(labelAccessParameter);

+		result = result.add(labelAccess); // LabelAccess(Read) added

+		return result;

+	}

 }
\ No newline at end of file
diff --git a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/SharedConsts.java b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/SharedConsts.java
index 2ab3f29..8e8a72e 100644
--- a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/SharedConsts.java
+++ b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/SharedConsts.java
@@ -27,11 +27,10 @@
 	public static final boolean levelIBusyPeriod = false;
 	public static TS_DERIV tsDeriv = TS_DERIV.TSxPrio;
 	public static OPT_TYPE optimize = OPT_TYPE.RESPONSETIMESUM;
-	public static int comParadigm = 0;
 	/*-----------End Measur. Configuration--------------–*/
 
 	/* Arbitrary Integer Array (GA scenario) */
-	public static final int[] defaultIAMapping = new int[] { 4, 1, 1, 3, 4, 0, 1, 3, 3, 0, 6, 2, 5, 6 };
+	public static final int[] defaultIAMapping = new int[] { 4, 1, 1, 3, 4, 0, 3, 3, 3, 0, 6, 2, 5, 6 };
 
 	public enum OPT_TYPE {
 		TASKCHAINS, RESPONSETIMESUM, LOADBALANCING
@@ -44,4 +43,8 @@
 	public enum MAPPINGS {
 		EV, RTS, TCS, LB, RND
 	}
+	
+	public enum ComParadigm {
+		DIRECT, IMPLICIT
+	}
 }
\ No newline at end of file
diff --git a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/ui/APP4RTA.java b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/ui/APP4RTA.java
new file mode 100644
index 0000000..b4881f8
--- /dev/null
+++ b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/ui/APP4RTA.java
@@ -0,0 +1,1029 @@
+/*******************************************************************************

+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts.

+ *

+ * This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License 2.0

+ * which accompanies this distribution, and is available at

+ * https://www.eclipse.org/legal/epl-2.0/

+ *

+ * SPDX-License-Identifier: EPL-2.0

+ *

+ * Contributors: Junhyung Ki - initial API and implementation

+ * 

+ *******************************************************************************/

+package org.eclipse.app4mc.gsoc_rta.ui;

+

+import java.awt.Color;

+import java.awt.EventQueue;

+import java.awt.Font;

+import java.awt.List;

+import java.awt.event.ActionEvent;

+import java.awt.event.ActionListener;

+import java.io.File;

+import java.math.BigInteger;

+import java.util.HashMap;

+import java.util.stream.Collectors;

+

+import javax.swing.ButtonGroup;

+import javax.swing.JButton;

+import javax.swing.JComboBox;

+import javax.swing.JFrame;

+import javax.swing.JFileChooser;

+import javax.swing.JLabel;

+import javax.swing.JOptionPane;

+import javax.swing.JRadioButton;

+import javax.swing.JTextField;

+

+import org.apache.log4j.Level;

+import org.apache.log4j.Logger;

+import org.eclipse.app4mc.amalthea.model.Amalthea;

+import org.eclipse.app4mc.amalthea.model.AmaltheaServices;

+import org.eclipse.app4mc.amalthea.model.EventChain;

+import org.eclipse.app4mc.amalthea.model.Label;

+import org.eclipse.app4mc.amalthea.model.ProcessingUnit;

+import org.eclipse.app4mc.amalthea.model.PuType;

+import org.eclipse.app4mc.amalthea.model.Task;

+import org.eclipse.app4mc.amalthea.model.Time;

+import org.eclipse.app4mc.amalthea.model.TimeUnit;

+import org.eclipse.app4mc.amalthea.model.io.AmaltheaLoader;

+import org.eclipse.app4mc.amalthea.model.util.FactoryUtil;

+import org.eclipse.app4mc.amalthea.model.util.RuntimeUtil.TimeType;

+import org.eclipse.app4mc.gsoc_rta.*;

+import org.eclipse.app4mc.gsoc_rta.SharedConsts.ComParadigm;

+import org.eclipse.emf.common.util.EList;

+import javax.swing.SwingConstants;

+import javax.swing.filechooser.FileNameExtensionFilter;

+

+/**

+ * Date: August 21-2019 

+ * @author Junhyung Ki

+ * @version 1.0

+ *					The purpose of this class is to provide users a better visual and increase usability of Response Time Analysis.

+ */

+@SuppressWarnings("serial")

+public class APP4RTA extends JFrame {

+	private static JComboBox<String> ecComboBox = new JComboBox<String>();

+	

+	private CPURta cpurta = new CPURta();

+	private E2ELatency e2e = new E2ELatency();

+	private Amalthea currentModel = null;

+	private java.util.List<ProcessingUnit> currentPUList = null;

+	private int[] currentIA = null;

+	private EList<Task> allTaskList = null;

+	private EList<EventChain> currentECList = null;

+	private EventChain currentEC = null;

+	private java.util.List<Task> currentTaskChain = null;

+	private File currentFile = null;

+	

+	private HashMap<Integer, java.util.List<Task>> puTaskListHM;

+	private JFrame frame;

+	private int selectedECIndex = -1;

+	private boolean schedulability_flag = false;

+	private ComParadigm currentParadigm = null;

+	JFileChooser fileChooser;

+	JTextField selectedModelLbl;

+	

+	private JLabel jl0, jl1, jl2, jl3, jl4, jl5, jl6, jl7, jl8, jl9, jl10, 

+		jl11, jl12, jl13, jl14, jl15, jl16, jl17, jl18, jl19;

+	private JTextField tf0, tf1, tf2, tf3, tf4, tf5, tf6, tf7, tf8, tf9, 

+		tf10, tf11, tf12, tf13, tf14, tf15, tf16, tf17, tf18, tf19;

+	private JLabel[] jLabelArray = {

+			jl0, jl1, jl2, jl3, jl4, jl5, jl6, jl7, jl8, jl9, jl10, 

+			jl11, jl12, jl13, jl14, jl15, jl16, jl17, jl18, jl19

+	};

+	private JTextField[] jTextFieldArray= {

+			tf0, tf1, tf2, tf3, tf4, tf5, tf6, tf7, tf8, tf9, 

+			tf10, tf11, tf12, tf13, tf14, tf15, tf16, tf17, tf18, tf19

+	};

+	

+	private JLabel jl_0, jl_1, jl_2, jl_3, jl_4, jl_5, jl_6, jl_7;

+	private JLabel jl_a, jl_b, jl_c, jl_d, jl_e, jl_f, jl_g, jl_h;

+	private List l0, l1, l2, l3, l4, l5, l6, l7;

+	private List rtL0, rtL1, rtL2, rtL3, rtL4, rtL5, rtL6, rtL7;

+	private JLabel[] puLabelArray = {

+			jl_0, jl_1, jl_2, jl_3, jl_4, jl_5, jl_6, jl_7

+	};

+	private JLabel[] rtListLabelArray = {

+			jl_a, jl_b, jl_c, jl_d, jl_e, jl_f, jl_g, jl_h

+	};

+	private List[] puListArray = {

+			l0, l1, l2, l3, l4, l5, l6, l7

+	};

+	private List[] rtListArray = {

+			rtL0, rtL1, rtL2, rtL3, rtL4, rtL5, rtL6, rtL7

+	};

+	

+	private JLabel ecL0, ecL1, ecL2, ecL3, ecL4, ecL5, ecL6, 

+		ecL7, ecL8, ecL9, ecL10, ecL11, ecL12, ecL13;

+	private JTextField jtf0, jtf1, jtf2, jtf3, jtf4, jtf5, jtf6,

+		jtf7, jtf8, jtf9, jtf10, jtf11, jtf12, jtf13;

+	private JLabel[] ecLabelArray = {

+			ecL0, ecL1, ecL2, ecL3, ecL4, ecL5, ecL6,

+			ecL7, ecL8, ecL9, ecL10, ecL11, ecL12, ecL13

+	};

+	private JTextField[] ecJTPArray = {

+			jtf0, jtf1, jtf2, jtf3, jtf4, jtf5, jtf6,

+			jtf7, jtf8, jtf9, jtf10, jtf11, jtf12, jtf13

+	};

+	

+	private List list, list_1, list_2;

+

+	public static void main(String[] args) {

+		EventQueue.invokeLater(new Runnable() {

+			public void run() {

+				org.apache.log4j.BasicConfigurator.configure();

+				Logger.getRootLogger().setLevel(Level.ERROR);

+				final APP4RTA window = new APP4RTA();

+				window.frame.setVisible(true);

+				window.frame.setTitle("APP4RTA");

+			}

+		});

+	}

+

+	public APP4RTA() {

+		initialize();

+	}

+	

+	private void initialize() {

+		frame = new JFrame();

+		frame.getContentPane().setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		frame.setBounds(0, 31, 1200, 1027);

+		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

+		frame.getContentPane().setLayout(null);

+		

+		JLabel lblSelectTheModel = new JLabel("Amalthea Model");

+		lblSelectTheModel.setFont(new Font("Stencil BT", Font.PLAIN, 13));

+		lblSelectTheModel.setBounds(10, 13, 120, 22);

+		frame.getContentPane().add(lblSelectTheModel);

+		

+		JLabel lblTaskName = new JLabel("Task Name");

+		lblTaskName.setForeground(new Color(139, 0, 0));

+		lblTaskName.setFont(new Font("Sitka Heading", Font.BOLD, 12));

+		lblTaskName.setHorizontalAlignment(SwingConstants.CENTER);

+		lblTaskName.setBounds(15, 43, 70, 16);

+		frame.getContentPane().add(lblTaskName);

+		

+		JLabel lblPuNum = new JLabel("PU Num");

+		lblPuNum.setForeground(new Color(0, 0, 255));

+		lblPuNum.setHorizontalAlignment(SwingConstants.CENTER);

+		lblPuNum.setFont(new Font("Sitka Heading", Font.BOLD, 12));

+		lblPuNum.setBounds(92, 43, 70, 16);

+		frame.getContentPane().add(lblPuNum);

+		

+		JButton btnDefualtIa = new JButton("Defualt IA");

+		btnDefualtIa.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent arg0) {

+				if (cpurta.getModel() == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: A model is not loaded.");

+					return ;

+				} else if (cpurta.getTRT() == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: TRT HashMap is not loaded.");

+					return ;

+				} else if (cpurta.getPUl().size() == 0) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Processing Unit List is not loaded.");

+					return ;

+				}

+				final int[] defaultIA = SharedConsts.defaultIAMapping;

+				if (cpurta.getModel().getSwModel().getTasks().size() == defaultIA.length) {

+					for (int i = 0; i < defaultIA.length; i++) {

+						jTextFieldArray[i].setText("" + defaultIA[i]);

+					}

+					return ;

+				}

+				JOptionPane.showMessageDialog(frame, "ERROR: The length of the default integer array does not match with\n"

+						+ "the number of tasks in the target model.");

+			}

+		});

+		

+		JButton btnEnterIA = new JButton("Enter IA");

+		btnEnterIA.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent e) {

+				currentIA = new int[cpurta.getModel().getSwModel().getTasks().size()];

+				for (int i = 0; i < allTaskList.size(); i++) {

+					if (jTextFieldArray[i].getText().length() == 0) {

+						JOptionPane.showMessageDialog(frame, "ERROR: Fill the rest of the array!");

+						return ;

+					} else if (jTextFieldArray[i].getText().charAt(0) < 48 || jTextFieldArray[i].getText().charAt(0) > 54) {

+						JOptionPane.showMessageDialog(frame, "ERROR: Wrong array value!");

+						return ;

+					} else if (i >= 0 && i <= 9 && Integer.parseInt(jTextFieldArray[i].getText()) == 6) {

+						JOptionPane.showMessageDialog(frame, "ERROR: CPU Tasks should not be mapped to GPU! \n\n"

+								+ "Please assign different IA value for " + "(" + allTaskList.get(i).getName() + ")");

+						return ;

+					} else if (i == jTextFieldArray.length-1 && Integer.parseInt(jTextFieldArray[i].getText()) != 6) {

+						JOptionPane.showMessageDialog(frame, "ERROR: 'Detection' task can not be mapped to CPU!");

+						return ;

+					}

+					currentIA[i] = Integer.parseInt(jTextFieldArray[i].getText());

+				}

+				cpurta.setIA(currentIA);

+				cpurta.setContention(currentIA, currentModel);

+				puTaskListHM = cpurta.be_getPUTaskListHashMap(currentModel);

+				for (int i = 0; i < puTaskListHM.size(); i++) {

+					if (puListArray[i].getItemCount() == 0) {

+						for (int j = 0; j < puTaskListHM.get(i).size(); j++) {	

+							puListArray[i].add((puTaskListHM.get(i).get(j)).getName());

+						}

+					}

+				}

+			}

+		});

+		

+		JRadioButton rdbtnSynchronous = new JRadioButton("Synchronous");

+		rdbtnSynchronous.setForeground(new Color(139, 0, 0));

+		rdbtnSynchronous.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		

+		JRadioButton rdbtnAsynchronous = new JRadioButton("Asynchronous");

+		rdbtnAsynchronous.setForeground(new Color(0, 0, 255));

+		rdbtnAsynchronous.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		

+		ButtonGroup offloadingMode = new ButtonGroup();

+		offloadingMode.add(rdbtnSynchronous);

+		offloadingMode.add(rdbtnAsynchronous);

+		

+		JRadioButton rdbtnWorstCase = new JRadioButton("Worst-Case");

+		rdbtnWorstCase.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		rdbtnWorstCase.setForeground(Color.DARK_GRAY);

+		

+		JRadioButton rdbtnAverageCase = new JRadioButton("Average-Case");

+		rdbtnAverageCase.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		rdbtnAverageCase.setForeground(Color.DARK_GRAY);

+		

+		JRadioButton rdbtnBestCase = new JRadioButton("Best-Case");

+		rdbtnBestCase.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		rdbtnBestCase.setForeground(Color.DARK_GRAY);

+

+		ButtonGroup executionMode = new ButtonGroup();

+		executionMode.add(rdbtnWorstCase);

+		executionMode.add(rdbtnAverageCase);

+		executionMode.add(rdbtnBestCase);

+		

+		JLabel lblSchedulability = new JLabel("Schedulability");

+		JTextField schedulability = new JTextField();

+		schedulability.setHorizontalAlignment(SwingConstants.RIGHT);

+		schedulability.setEditable(false);

+		

+		JLabel lblMemAccCost = new JLabel("Cumulated Memory-Access Cost");

+		JTextField memAccCost = new JTextField();

+		memAccCost.setHorizontalAlignment(SwingConstants.RIGHT);

+		memAccCost.setEditable(false);

+		

+		JLabel lblCumulContention = new JLabel("Cumulated Contention");

+		JTextField cumulContention = new JTextField();

+		cumulContention.setHorizontalAlignment(SwingConstants.RIGHT);

+		cumulContention.setEditable(false);

+		

+		JLabel lblComputation = new JLabel("Computation");

+		JTextField computation = new JTextField();

+		computation.setHorizontalAlignment(SwingConstants.RIGHT);

+		computation.setEditable(false);

+		

+		JLabel lblResponseTimeSum = new JLabel("Response Time Sum");

+		JTextField rtSum = new JTextField();

+		rtSum.setHorizontalAlignment(SwingConstants.RIGHT);

+		rtSum.setEditable(false);

+		

+		JButton btnCalculate = new JButton("Calculate");

+		btnCalculate.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent arg0) {

+				for (int i = 0; i < allTaskList.size(); i++) {

+					if (jTextFieldArray[i].getText().length() == 0) {

+						JOptionPane.showMessageDialog(frame, "ERROR: Fill the array first!");

+						return ;

+					}

+				}				

+				if (rdbtnSynchronous.isSelected()) {

+					SharedConsts.synchronousOffloading = true;

+				} else if (rdbtnAsynchronous.isSelected()) {

+					SharedConsts.synchronousOffloading = false;

+				} else {

+					JOptionPane.showMessageDialog(frame, "ERROR: You should choose an offloading mode! (Sync / Async)");

+					return ;

+				}

+				if (rdbtnWorstCase.isSelected()) {

+					SharedConsts.timeType = TimeType.WCET;

+				} else if (rdbtnAverageCase.isSelected()) {

+					SharedConsts.timeType = TimeType.ACET;

+				} else if (rdbtnBestCase.isSelected()) {

+					SharedConsts.timeType = TimeType.BCET;

+				} else {

+					JOptionPane.showMessageDialog(frame, "ERROR: You should choose an execution case! (Worst Case / Average Case / Best Case)");

+					return ;

+				}

+				if (currentIA == null || puTaskListHM.size() == 0) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Click the 'Enter IA' button.");

+					return ;

+				}

+				schedulability_flag = true;

+				Time pRtSum = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				for (int i = 0; i < puTaskListHM.size(); i++) {

+					final ProcessingUnit pu = cpurta.getPUl().get(i);

+					final java.util.List<Task> thisPUTaskList = puTaskListHM.get(i);

+					Time thisRT = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+					if (rtListArray[i].getItemCount() == 0) {

+						if (pu.getDefinition().getPuType().equals(PuType.CPU)) {

+							for (Task t : thisPUTaskList) {

+								thisRT = cpurta.preciseTestCPURT(t, thisPUTaskList, SharedConsts.timeType, pu);

+								final Time thisPeriod = CommonUtils.getStimInTime(t);

+								final BigInteger period = AmaltheaServices.convertToPicoSeconds(thisPeriod);

+								if (AmaltheaServices.convertToPicoSeconds(thisRT).compareTo(period) > 0) {

+									rtListArray[i].add("Non Scheduleable! => MAX Value");

+									schedulability_flag = false;

+								} else if (AmaltheaServices.convertToPicoSeconds(thisRT).equals(BigInteger.ZERO)) {

+									rtListArray[i].add("0 ps (GPU Task on CPU)");

+								} else {

+									rtListArray[i].add(thisRT.toString());

+								}

+								pRtSum = pRtSum.add(thisRT);

+							}

+						} else {

+							for (Task t : thisPUTaskList) {

+								thisRT = cpurta.getTRT().get(t);

+								rtListArray[i].add(thisRT.toString());

+								pRtSum = pRtSum.add(thisRT);

+							}

+						}

+					}

+				}

+				if (schedulability_flag) {

+					schedulability.setText("Scheduleable! :)");

+					memAccCost.setText("" + cpurta.getCumulatedMemAccCosts());

+					cumulContention.setText("" + cpurta.getCumulatedContention());

+					computation.setText("" + (pRtSum.subtract(cpurta.getCumulatedMemAccCosts())).subtract(cpurta.getCumulatedContention()));

+					rtSum.setText(pRtSum.toString());

+				} else {

+					schedulability.setText("Non Scheduleable! :(");

+					memAccCost.setText("Not Available.");

+					cumulContention.setText("Not Available.");

+					computation.setText("Not Available.");

+					rtSum.setText("Not Available.");

+				}

+			}

+		});

+		

+		JButton btnReset = new JButton("Reset");

+		btnReset.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent e) {

+				currentIA = null;

+				cpurta.setIA(currentIA);

+				cpurta.setContention(currentIA, currentModel);

+				/* latency time initializing */

+				cpurta.initCumulatedMemAccCosts();

+				cpurta.initCumulatedContention();

+				for (int i = 0; i < allTaskList.size(); i++) {

+					jTextFieldArray[i].setText("");

+				}

+				for (int i = 0; i < currentPUList.size(); i++) {

+					puListArray[i].removeAll();

+				}

+				for (int i = 0; i < currentPUList.size(); i++) {

+					rtListArray[i].removeAll();

+				}

+				offloadingMode.setSelected(null, false);

+				executionMode.setSelected(null, false);

+				schedulability.setText(null);

+				memAccCost.setText(null);

+				cumulContention.setText(null);

+				computation.setText(null);

+				rtSum.setText(null);

+				currentIA = null;

+				puTaskListHM = null;

+				frame.revalidate();

+				frame.repaint();

+			}

+		});

+

+		selectedModelLbl = new JTextField();

+		selectedModelLbl.setEditable(false);

+		selectedModelLbl.setBounds(142, 13, 206, 22);

+		frame.getContentPane().add(selectedModelLbl);

+		selectedModelLbl.setColumns(10);

+		

+		JButton amaltheaSchBtn = new JButton("Search Amalthea");

+		amaltheaSchBtn.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent e) {

+				final String userDirLocation = System.getProperty("user.dir");

+				File userDir = new File(userDirLocation);

+				fileChooser = new JFileChooser(userDir);

+				fileChooser.setAcceptAllFileFilterUsed(false);

+		        FileNameExtensionFilter filter = new FileNameExtensionFilter("Amalthea models", "amxmi");

+		        fileChooser.addChoosableFileFilter(filter);

+		        fileChooser.setDialogTitle("Open File");

+		        int result = fileChooser.showOpenDialog(null);

+		        if (result == JFileChooser.APPROVE_OPTION) {

+		        	final Amalthea loadedModel = AmaltheaLoader.loadFromFile(fileChooser.getSelectedFile());

+		        	if (loadedModel.getVersion().compareTo("0.9.4") != 0) {

+		        		JOptionPane.showMessageDialog(frame, "Error: This model should be migrated to the version 0.9.4");

+		        		return ;

+		        	}

+		        	/* Something was selected before */

+		        	if (currentFile != null) {

+		        		/* The selected file is equal to the previous file => Do nothing */

+		        		if (fileChooser.getSelectedFile().equals(currentFile)) {

+		        			JOptionPane.showMessageDialog(frame, "Same Model");

+		        			return ;

+		        		}

+		        		/* If the selected file is different to the previous one => Remove and Do Normal. */

+		        		else {

+		        			schedulability.setText(null);

+		    				memAccCost.setText(null);

+		    				cumulContention.setText(null);

+		    				computation.setText(null);

+		    				rtSum.setText(null);

+		        			for (int i = 0; i < allTaskList.size(); i++) {

+								frame.remove(jLabelArray[i]);

+								frame.remove(jTextFieldArray[i]);

+							}

+							frame.remove(btnDefualtIa);

+							frame.remove(btnEnterIA);

+							frame.remove(rdbtnSynchronous);

+							frame.remove(rdbtnAsynchronous);

+							frame.remove(rdbtnWorstCase);

+							frame.remove(rdbtnAverageCase);

+							frame.remove(rdbtnBestCase);

+							frame.remove(btnCalculate);

+							frame.remove(btnReset);

+							frame.remove(lblSchedulability);

+							frame.remove(schedulability);

+							frame.remove(lblMemAccCost);

+							frame.remove(memAccCost);

+							frame.remove(lblCumulContention);

+							frame.remove(cumulContention);

+							frame.remove(lblComputation);

+							frame.remove(computation);

+							frame.remove(lblResponseTimeSum);

+							frame.remove(rtSum);

+							for (int i = 0; i < currentPUList.size(); i++) {

+								frame.remove(puLabelArray[i]);

+								frame.remove(rtListLabelArray[i]);

+								frame.remove(puListArray[i]);

+								frame.remove(rtListArray[i]);

+							}

+							frame.remove(ecComboBox);

+		        		}

+		        	}

+		        	/* Something was not selected before => Do normal */

+		        	currentFile = fileChooser.getSelectedFile();

+		        	selectedModelLbl.setText(currentFile.getName());

+		        	currentModel = loadedModel;

+					currentPUList = CommonUtils.getPUs(currentModel);

+					cpurta.setModel(currentModel);

+					cpurta.setTRT(cpurta.getDefaultTRT(currentModel));

+					cpurta.setPUl(currentPUList);

+					allTaskList = currentModel.getSwModel().getTasks();

+					if (allTaskList.size() > 20) {

+						JOptionPane.showMessageDialog(frame, "ERROR: The selected model has " + allTaskList.size() + " Tasks. (Limit: 20)\n" 

+								+ "Please choose a different model.");

+						return ;

+					} else if (currentPUList.size() > 8) {

+						JOptionPane.showMessageDialog(frame, "ERROR: The selected model has " + currentPUList.size() + " Processing Units. (Limit: 8)\n"

+								+ "Please choose a different model.");

+						return ;

+					}

+					/* Task Indices */

+					for (int i = 0; i < allTaskList.size(); i++) {

+						jLabelArray[i] = new JLabel(allTaskList.get(i).getName());

+						jLabelArray[i].setBounds(12, (60+(i*24)), 97, 16);

+						frame.getContentPane().add(jLabelArray[i]);

+						jTextFieldArray[i] = new JTextField();

+						jTextFieldArray[i].setColumns(10);

+						jTextFieldArray[i].setBounds(118, (60+(i*24)), 22, 22);

+						frame.getContentPane().add(jTextFieldArray[i]);

+					}

+					/* DefaultIA Button */

+					btnDefualtIa.setBounds(155, 60, 97, 25);

+					frame.getContentPane().add(btnDefualtIa);

+					/* EnterIA Button */

+					btnEnterIA.setBounds(155, 90, 97, 25);

+					frame.getContentPane().add(btnEnterIA);

+					/* Sync Radio Button */

+					rdbtnSynchronous.setBounds(152, 125, 126, 25);

+					frame.getContentPane().add(rdbtnSynchronous);

+					/* Async Radio Button */

+					rdbtnAsynchronous.setBounds(152, 145, 126, 25);

+					frame.getContentPane().add(rdbtnAsynchronous);

+					/* WorstCase Radio Button */

+					rdbtnWorstCase.setBounds(152, 175, 107, 25);

+					frame.getContentPane().add(rdbtnWorstCase);

+					/* AverageCase Radio Button */

+					rdbtnAverageCase.setBounds(152, 195, 107, 25);

+					frame.getContentPane().add(rdbtnAverageCase);

+					/* BestCase Radio Button */

+					rdbtnBestCase.setBounds(152, 215, 107, 25);

+					frame.getContentPane().add(rdbtnBestCase);

+					/* Calculate Button */

+					btnCalculate.setBounds(155, 252, 97, 25);

+					frame.getContentPane().add(btnCalculate);

+					/* Reset Button */

+					btnReset.setBounds(155, 282, 97, 25);

+					frame.getContentPane().add(btnReset);

+					/* Schedulability Label & TextField */

+					lblSchedulability.setBounds(157, 323, 200, 16);

+					frame.getContentPane().add(lblSchedulability);

+					schedulability.setBounds(155, 343, 200, 22);

+					frame.getContentPane().add(schedulability);

+					/* MemAccCost Label & TextField */

+					lblMemAccCost.setBounds(157, 368, 200, 16);

+					frame.getContentPane().add(lblMemAccCost);

+					memAccCost.setBounds(155, 388, 200, 22);

+					frame.getContentPane().add(memAccCost);

+					/* CumulContention Label & TextField */

+					lblCumulContention.setBounds(157, 413, 200, 16);

+					frame.getContentPane().add(lblCumulContention);

+					cumulContention.setBounds(155, 433, 200, 22);

+					frame.getContentPane().add(cumulContention);

+					/* Computation */

+					lblComputation.setBounds(157, 458, 200, 16);

+					frame.getContentPane().add(lblComputation);

+					computation.setBounds(155, 478, 200, 22);

+					frame.getContentPane().add(computation);

+					/* ResponseTime Sum Label & TextField */

+					lblResponseTimeSum.setBounds(157, 503, 200, 16);

+					frame.getContentPane().add(lblResponseTimeSum);

+					rtSum.setBounds(155, 523, 200, 22);

+					frame.getContentPane().add(rtSum);

+					/* PU & RT Lists */

+					for (int i = 0; i < currentPUList.size(); i++) {

+						puLabelArray[i] = new JLabel(i +": " + currentPUList.get(i).getDefinition().getName());

+						rtListLabelArray[i] = new JLabel("Response Time");

+						puListArray[i] = new List();

+						rtListArray[i] = new List();

+						if (i >= 0 && i < 4) {

+							puLabelArray[i].setBounds((387+(i*200)), 50, 87, 22);

+							rtListLabelArray[i].setBounds((474+(i*200)), 50, 88, 22);

+							puListArray[i].setBounds((385+(i*200)), 75, 87, 145);

+							rtListArray[i].setBounds((475+(i*200)), 75, 87, 145);

+						} else if (i >= 4) {

+							puLabelArray[i].setBounds((387+((i-4)*200)), 225, 87, 22);

+							rtListLabelArray[i].setBounds((474+((i-4)*200)), 225, 88, 22);

+							puListArray[i].setBounds((385+((i-4)*200)), 250, 87, 145);

+							rtListArray[i].setBounds((475+((i-4)*200)), 250, 87, 145);

+						}

+						frame.getContentPane().add(puLabelArray[i]);

+						frame.getContentPane().add(rtListLabelArray[i]);

+						frame.getContentPane().add(puListArray[i]);

+						frame.getContentPane().add(rtListArray[i]);

+					}

+					/* E2ELatency Part */

+					currentECList = currentModel.getConstraintsModel().getEventChains();

+					if (currentECList.size() != 0) {

+						final String[] ecComboArray = new String[currentECList.size()];

+						for (int i = 0; i < currentECList.size(); i++) {

+							ecComboArray[i] = currentECList.get(i).getName();

+						}

+						ecComboBox = new JComboBox<String>(ecComboArray);

+						ecComboBox.setBounds(150, 570, 206, 22);

+						frame.getContentPane().add(ecComboBox);

+						ecComboBox.setSelectedItem(null);

+					} else {

+						JOptionPane.showMessageDialog(frame, "WARNING: The selected model has no Event-Chain.\n"

+								+ "End to End EventChain Latency Calculation is impossible with this model.");

+						// TODO: Something needs to be done here to prevent E2ELatency calculation.

+					}

+					frame.revalidate();

+					frame.repaint();

+		        }

+			}

+		});

+		amaltheaSchBtn.setBounds(348, 12, 133, 24);

+		frame.getContentPane().add(amaltheaSchBtn);

+

+		JLabel lblEventChainModel = new JLabel("EVENT CHAIN MODEL");

+		lblEventChainModel.setFont(new Font("Stencil BT", Font.PLAIN, 13));

+		lblEventChainModel.setBounds(10, 570, 136, 22);

+		frame.getContentPane().add(lblEventChainModel);

+		

+		JRadioButton rdbtnDirect = new JRadioButton("Direct");

+		rdbtnDirect.setForeground(new Color(139, 0, 0));

+		rdbtnDirect.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		rdbtnDirect.setBounds(530, 569, 70, 25);

+		frame.getContentPane().add(rdbtnDirect);

+		

+		JRadioButton rdbtnImplicit = new JRadioButton("Implicit");

+		rdbtnImplicit.setForeground(new Color(0, 0, 255));

+		rdbtnImplicit.setFont(new Font("Sitka Heading", Font.BOLD, 13));

+		rdbtnImplicit.setBounds(596, 569, 79, 25);

+		frame.getContentPane().add(rdbtnImplicit);

+		

+		ButtonGroup paradigmMode = new ButtonGroup();

+		paradigmMode.add(rdbtnDirect);

+		paradigmMode.add(rdbtnImplicit);

+		

+		JLabel lblNewLabel = new JLabel("Direct & Implicit Communication Paradigm");

+		lblNewLabel.setFont(new Font("Sitka Text", Font.BOLD | Font.ITALIC, 13));

+		lblNewLabel.setBounds(10, 605, 293, 16);

+		frame.getContentPane().add(lblNewLabel);

+		

+		JLabel lblWorstcaseReaction = new JLabel("WC Reaction");

+		lblWorstcaseReaction.setHorizontalAlignment(SwingConstants.CENTER);

+		lblWorstcaseReaction.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblWorstcaseReaction.setBounds(10, 627, 90, 16);

+		frame.getContentPane().add(lblWorstcaseReaction);

+		

+		JTextField txtField0 = new JTextField();

+		txtField0.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField0.setBounds(103, 625, 200, 22);

+		txtField0.setEditable(false);

+		frame.getContentPane().add(txtField0);

+		

+		JLabel lblBestcaseReaction = new JLabel("BC Reaction");

+		lblBestcaseReaction.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblBestcaseReaction.setHorizontalAlignment(SwingConstants.CENTER);

+		lblBestcaseReaction.setBounds(10, 656, 90, 16);

+		frame.getContentPane().add(lblBestcaseReaction);

+		

+		JTextField txtField1 = new JTextField();

+		txtField1.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField1.setBounds(103, 654, 200, 22);

+		txtField1.setEditable(false);

+		frame.getContentPane().add(txtField1);

+		

+		JLabel lblLetCommunicationParadigm = new JLabel("LET Communication Paradigm");

+		lblLetCommunicationParadigm.setFont(new Font("Sitka Text", Font.BOLD | Font.ITALIC, 13));

+		lblLetCommunicationParadigm.setBounds(10, 688, 193, 16);

+		frame.getContentPane().add(lblLetCommunicationParadigm);

+		

+		JLabel lblWcReaction = new JLabel("WC Reaction");

+		lblWcReaction.setHorizontalAlignment(SwingConstants.CENTER);

+		lblWcReaction.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblWcReaction.setBounds(10, 710, 90, 16);

+		frame.getContentPane().add(lblWcReaction);

+		

+		JTextField txtField2 = new JTextField();

+		txtField2.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField2.setBounds(103, 708, 200, 22);

+		txtField2.setEditable(false);

+		frame.getContentPane().add(txtField2);

+		

+		JLabel lblBcReaction = new JLabel("BC Reaction");

+		lblBcReaction.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblBcReaction.setHorizontalAlignment(SwingConstants.CENTER);

+		lblBcReaction.setBounds(10, 739, 90, 16);

+		frame.getContentPane().add(lblBcReaction);

+		

+		JTextField txtField3 = new JTextField();

+		txtField3.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField3.setBounds(103, 737, 200, 22);

+		txtField3.setEditable(false);

+		frame.getContentPane().add(txtField3);

+		

+		JLabel lblTaskChain = new JLabel("Task Chain Age (Direct & Implicit)");

+		lblTaskChain.setFont(new Font("Sitka Text", Font.BOLD | Font.ITALIC, 13));

+		lblTaskChain.setBounds(338, 605, 222, 16);

+		frame.getContentPane().add(lblTaskChain);

+		

+		JLabel lblWcAge = new JLabel("WC Age");

+		lblWcAge.setHorizontalAlignment(SwingConstants.CENTER);

+		lblWcAge.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblWcAge.setBounds(350, 627, 58, 16);

+		frame.getContentPane().add(lblWcAge);

+		

+		JTextField txtField4 = new JTextField();

+		txtField4.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField4.setBounds(413, 625, 200, 22);

+		txtField4.setEditable(false);

+		frame.getContentPane().add(txtField4);

+		

+		JLabel lblBcAge = new JLabel("BC Age");

+		lblBcAge.setHorizontalAlignment(SwingConstants.CENTER);

+		lblBcAge.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblBcAge.setBounds(350, 656, 58, 16);

+		frame.getContentPane().add(lblBcAge);

+		

+		JTextField txtField5 = new JTextField();

+		txtField5.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField5.setBounds(413, 654, 200, 22);

+		txtField5.setEditable(false);

+		frame.getContentPane().add(txtField5);

+		

+		JLabel lblEarlyReaction = new JLabel("Early Reaction (Direct & Implicit)");

+		lblEarlyReaction.setFont(new Font("Sitka Text", Font.BOLD | Font.ITALIC, 13));

+		lblEarlyReaction.setBounds(338, 688, 232, 16);

+		frame.getContentPane().add(lblEarlyReaction);

+		

+		JLabel lblWcErct = new JLabel("WC E-Rct");

+		lblWcErct.setHorizontalAlignment(SwingConstants.CENTER);

+		lblWcErct.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblWcErct.setBounds(338, 710, 70, 16);

+		frame.getContentPane().add(lblWcErct);

+		

+		JTextField txtField6 = new JTextField();

+		txtField6.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField6.setBounds(413, 708, 200, 22);

+		txtField6.setEditable(false);

+		frame.getContentPane().add(txtField6);

+		

+		JLabel lblBcErct = new JLabel("BC E-Rct");

+		lblBcErct.setHorizontalAlignment(SwingConstants.CENTER);

+		lblBcErct.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblBcErct.setBounds(338, 739, 70, 16);

+		frame.getContentPane().add(lblBcErct);

+		

+		JTextField txtField7 = new JTextField();

+		txtField7.setHorizontalAlignment(SwingConstants.RIGHT);

+		txtField7.setBounds(413, 737, 200, 22);

+		txtField7.setEditable(false);

+		frame.getContentPane().add(txtField7);

+		

+		JLabel lblDataAge = new JLabel("Data Age");

+		lblDataAge.setFont(new Font("Sitka Text", Font.BOLD | Font.ITALIC, 13));

+		lblDataAge.setBounds(10, 771, 58, 16);

+		frame.getContentPane().add(lblDataAge);

+		

+		JLabel lblContainedLabels = new JLabel("Contained Labels");

+		lblContainedLabels.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblContainedLabels.setBounds(10, 791, 136, 16);

+		frame.getContentPane().add(lblContainedLabels);

+		

+		list = new List();

+		list.setBounds(10, 810, 155, 160);

+		frame.getContentPane().add(list);

+		

+		JLabel lblWorstcaseAge = new JLabel("Worst-case Age");

+		lblWorstcaseAge.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblWorstcaseAge.setBounds(177, 791, 136, 16);

+		frame.getContentPane().add(lblWorstcaseAge);

+		

+		list_1 = new List();

+		list_1.setBounds(177, 810, 155, 160);

+		frame.getContentPane().add(list_1);

+		

+		JLabel lblBestcaseAge = new JLabel("Best-case Age");

+		lblBestcaseAge.setFont(new Font("Sitka Small", Font.PLAIN, 13));

+		lblBestcaseAge.setBounds(344, 791, 136, 16);

+		frame.getContentPane().add(lblBestcaseAge);

+		

+		list_2 = new List();

+		list_2.setBounds(344, 810, 155, 160);

+		frame.getContentPane().add(list_2);

+		

+		JButton ecSelect = new JButton("Calculate");

+		ecSelect.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent e) {

+				if (currentModel == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Select an AMALTHEA model first.");

+					return ;

+				} else if (currentECList == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Event-Chain List is empty somehow.");

+					return ;

+				} else if (ecComboBox.getSelectedItem() == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Select an Event-Chain.");

+					return ;

+				} else if (puTaskListHM == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: IA(Integer Array) has not been assigned.");

+					return ;

+				} else if (offloadingMode.getSelection() == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Choose an offloading mode. (Sync / Async)");

+					return ;

+				} else if (schedulability_flag == false) {

+					String offMode = null;

+					if (SharedConsts.synchronousOffloading == true) {

+						offMode = "Sync";

+					} else if (SharedConsts.synchronousOffloading == false) {

+						offMode = "Aync";

+					}

+					String tType = null;

+					if (SharedConsts.timeType.equals(TimeType.WCET)) {

+						tType = "WC";

+					} else if (SharedConsts.timeType.equals(TimeType.ACET)) {

+						tType = "AC";

+					} else if (SharedConsts.timeType.equals(TimeType.BCET)) {

+						tType = "BC";

+					}

+					String iaFeedback = "";

+					for (int i = 0; i < currentIA.length; i++) {

+						if (i == currentIA.length - 1) {

+							iaFeedback = iaFeedback + currentIA[i];

+						} else {

+							iaFeedback = iaFeedback + currentIA[i] + ", ";

+						}

+					}

+					JOptionPane.showMessageDialog(frame, "ERROR: The entered IA value is not schedulable with the current configuration.\n\n"

+							+ "Current Integer Arrary: { " + iaFeedback + " }\n\n"

+							+ "Current Configuration: Offloading Mode(" + offMode + "), ExecutionCase(" + tType + ")");

+					return ;

+				} else if (paradigmMode.getSelection() == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Choose a communication paradigm. (Direct / Implicit)");

+					return ;

+				}

+				final int thisIndex = ecComboBox.getSelectedIndex();

+				/* Something was selected before */

+				if (selectedECIndex != -1) {

+					/* If the selected Event-Chain is the same as before => Do Nothing */

+					if (selectedECIndex == thisIndex) {

+						if (currentParadigm != null) {

+							ComParadigm changedParadigm = null;

+							if (rdbtnDirect.isSelected()) {

+								changedParadigm = ComParadigm.DIRECT;

+							} else if (rdbtnImplicit.isSelected()) {

+								changedParadigm = ComParadigm.IMPLICIT;

+							}

+							if (currentParadigm.equals(changedParadigm)) {

+								JOptionPane.showMessageDialog(frame, "Same Paradigm & Same Event-Chain.");

+								return ;

+							}

+							for (int i = 0; i < currentTaskChain.size(); i++) {

+								frame.remove(ecLabelArray[i]);

+								frame.remove(ecJTPArray[i]);

+							}

+						}

+					} 

+					/* If the selected Event-Chain is different to the previous one => Remove and Do Normal. */

+					else if (selectedECIndex != thisIndex) {

+						for (int i = 0; i < currentTaskChain.size(); i++) {

+							frame.remove(ecLabelArray[i]);

+							frame.remove(ecJTPArray[i]);

+						}

+						selectedECIndex = thisIndex;

+					}

+				}

+				selectedECIndex = thisIndex;

+				currentEC = currentECList.get(thisIndex);

+				currentTaskChain = e2e.getECTaskList(currentEC);

+				if (currentTaskChain.size() == 0 ) {

+					JOptionPane.showMessageDialog(frame, "ERROR: The selected Event-Chain has no chain-element.");

+					txtField0.setText("Not Available.");

+					txtField1.setText("Not Available.");

+					txtField2.setText("Not Available.");

+					txtField3.setText("Not Available.");

+					txtField4.setText("Not Available.");

+					txtField5.setText("Not Available.");

+					txtField6.setText("Not Available.");

+					txtField7.setText("Not Available.");

+					list.removeAll();

+					list.add("Not Available.");

+					list_1.removeAll();

+					list_1.add("Not Available.");

+					list_2.removeAll();

+					list_2.add("Not Available.");

+					return ;

+				}

+				else if (currentTaskChain.size() > 14) {

+					JOptionPane.showMessageDialog(frame, "ERROR: The selected Event-Chain has more than " + currentTaskChain.size() + " elements. (Limit: 14)\n");

+					txtField0.setText("Not Available.");

+					txtField1.setText("Not Available.");

+					txtField2.setText("Not Available.");

+					txtField3.setText("Not Available.");

+					txtField4.setText("Not Available.");

+					txtField5.setText("Not Available.");

+					txtField6.setText("Not Available.");

+					txtField7.setText("Not Available.");

+					list.removeAll();

+					list.add("Not Available.");

+					list_1.removeAll();

+					list_1.add("Not Available.");

+					list_2.removeAll();

+					list_2.add("Not Available.");

+					return ;

+				}

+				for (int i = 0; i < currentTaskChain.size(); i++) {

+					final Task task = currentTaskChain.get(i);

+					for (int j = 0; j < puTaskListHM.size(); j++) {

+						java.util.List<Task> puTaskList = puTaskListHM.get(j);

+						if (puTaskList.stream().filter(s -> s.equals(task)).collect(Collectors.toList()).size() != 0) {

+							final ProcessingUnit pu = currentPUList.get(j);

+							ecLabelArray[i] = new JLabel((i+1) + ": " + pu.getName() + " (" + pu.getDefinition().getName() + ")");

+							ecJTPArray[i] = new JTextField();

+							ecJTPArray[i].setText(task.getName());

+							ecJTPArray[i].setEditable(false);

+							if (i < 7) {

+								ecLabelArray[i].setBounds(750, (604+(50*i)), 187, 16);

+								ecJTPArray[i].setBounds(750, (624+(50*i)), 187, 22);

+							} else {

+								ecLabelArray[i].setBounds(950, (604+(50*(i-7))), 187, 16);

+								ecJTPArray[i].setBounds(950, (624+(50*(i-7))), 187, 22);

+							}

+							frame.getContentPane().add(ecLabelArray[i]);

+							frame.getContentPane().add(ecJTPArray[i]);

+							break;

+						}

+					}

+				}

+				

+				/* Calculation Part */

+				if (currentModel == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Select an AMALTHEA model first.");

+					return ;

+				} else if (ecComboBox.getSelectedItem() == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: Select an Event-Chain.");

+					return ;

+				} else if (currentIA == null) {

+					JOptionPane.showMessageDialog(frame, "ERROR: IA(Integer Array) has not been entered.");

+					return ;

+				}

+				if (list.getItemCount() > 0) {

+					list.removeAll();

+					list_1.removeAll();

+					list_2.removeAll();

+				}

+				/* Sometimes the same task can not be schedulable in the implicit communication due to the LocalCopy cost time */

+				Time rctWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				Time rctBC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				Time ageWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				Time ageBC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				Time eRctWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				Time eRctBC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+				

+				/* PARADIGM */

+				if (rdbtnDirect.isSelected()) {

+					currentParadigm = ComParadigm.DIRECT;

+					rctWC = e2e.getTCReactionWC(currentEC, currentParadigm, cpurta);

+					rctBC = e2e.getTCReactionBC(currentEC, currentParadigm, cpurta);

+					ageWC = e2e.getTaskChainAge(currentEC, TimeType.WCET, currentParadigm, cpurta);

+					ageBC = e2e.getTaskChainAge(currentEC, TimeType.BCET, currentParadigm, cpurta);

+					eRctWC = e2e.getEarlyReaction(currentEC, TimeType.WCET, currentParadigm, cpurta);

+					eRctBC = e2e.getEarlyReaction(currentEC, TimeType.BCET, currentParadigm, cpurta);

+				} else if (rdbtnImplicit.isSelected()) {

+					currentParadigm = ComParadigm.IMPLICIT;

+					rctWC = e2e.getTCReactionWC(currentEC, currentParadigm, cpurta);

+					rctBC = e2e.getTCReactionBC(currentEC, currentParadigm, cpurta);

+					ageWC = e2e.getTaskChainAge(currentEC, TimeType.WCET, currentParadigm, cpurta);

+					ageBC = e2e.getTaskChainAge(currentEC, TimeType.BCET, currentParadigm, cpurta);

+					eRctWC = e2e.getEarlyReaction(currentEC, TimeType.WCET, currentParadigm, cpurta);

+					eRctBC = e2e.getEarlyReaction(currentEC, TimeType.BCET, currentParadigm, cpurta);

+				}

+				if (rctWC.getValue().equals(BigInteger.ZERO)) {

+					txtField0.setText("Not Schedulable (LocalCopy Cost)");

+				} else {

+					txtField0.setText("" + rctWC);

+				}

+				if (rctBC.getValue().equals(BigInteger.ZERO)) {

+					txtField1.setText("Not Schedulable (LocalCopy Cost)");

+				} else {

+					txtField1.setText("" + rctBC);

+				}

+				txtField2.setText("" + e2e.getLetReactionWC(currentEC, cpurta));

+				txtField3.setText("" + e2e.getLetReactionBC(currentEC, cpurta));

+				txtField4.setText("" + ageWC);

+				txtField5.setText("" + ageBC);

+				if (eRctWC.getValue().equals(BigInteger.ZERO)) {

+					txtField6.setText("Not Schedulable (LocalCopy Cost)");

+				} else {

+					txtField6.setText("" + eRctWC);

+				}

+				if (eRctBC.getValue().equals(BigInteger.ZERO)) {

+					txtField7.setText("Not Schedulable (LocalCopy Cost)");

+				} else {

+					txtField7.setText("" + eRctBC);

+				}

+				final EList<Label> labelList = currentModel.getSwModel().getLabels();

+				for (int i = 0; i < labelList.size(); i++) {

+					Time datAgeLatWC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+					Time datAgeLatBC = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

+					datAgeLatWC = e2e.getDataAge(labelList.get(i), currentEC, TimeType.WCET, currentParadigm, cpurta);

+					datAgeLatBC = e2e.getDataAge(labelList.get(i), currentEC, TimeType.BCET, currentParadigm, cpurta);

+					if (datAgeLatWC != null && datAgeLatBC != null) {

+						list.add(labelList.get(i).getName());

+						list_1.add(datAgeLatWC + "");

+						list_2.add(datAgeLatBC + "");

+					}

+				}

+				frame.revalidate();

+				frame.repaint();

+			}

+		});

+		ecSelect.setBounds(356, 569, 90, 25);

+		frame.getContentPane().add(ecSelect);

+		

+		JButton btnNewButton_1 = new JButton("Reset");

+		btnNewButton_1.addActionListener(new ActionListener() {

+			public void actionPerformed(ActionEvent e) {

+				for (int i = 0; i < currentTaskChain.size(); i++) {

+					ecLabelArray[i].setText(null);

+					frame.remove(ecLabelArray[i]);

+					ecJTPArray[i].setText(null);

+					frame.remove(ecJTPArray[i]);

+				}

+				selectedECIndex = -1;

+				currentParadigm = null;

+				txtField0.setText("");

+				txtField1.setText("");

+				txtField2.setText("");

+				txtField3.setText("");

+				txtField4.setText("");

+				txtField5.setText("");

+				txtField6.setText("");

+				txtField7.setText("");

+				paradigmMode.setSelected(null, false);

+				list.removeAll();

+				list_1.removeAll();

+				list_2.removeAll();

+				frame.revalidate();

+				frame.repaint();

+			}

+		});

+		btnNewButton_1.setBounds(445, 569, 70, 25);

+		frame.getContentPane().add(btnNewButton_1);

+		

+		JLabel lblTaskChain_1 = new JLabel("Task Chain >");

+		lblTaskChain_1.setFont(new Font("Segoe UI Emoji", Font.BOLD, 13));

+		lblTaskChain_1.setBounds(646, 605, 90, 16);

+		frame.getContentPane().add(lblTaskChain_1);

+		

+		JLabel lblApprta = new JLabel("APP4RTA");

+		lblApprta.setForeground(Color.DARK_GRAY);

+		lblApprta.setFont(new Font("Snap ITC", Font.ITALIC, 20));

+		lblApprta.setBounds(1050, 1, 120, 34);

+		frame.getContentPane().add(lblApprta);

+	}

+}
\ No newline at end of file
diff --git a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/ui/RTApp_WATERS19.java b/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/ui/RTApp_WATERS19.java
deleted file mode 100644
index 4df858e..0000000
--- a/eclipse-tools/responseTime-analyzer/plugins/org.eclipse.app4mc.gsoc_rta/src/org/eclipse/app4mc/gsoc_rta/ui/RTApp_WATERS19.java
+++ /dev/null
@@ -1,561 +0,0 @@
-/*******************************************************************************

- * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts.

- *

- * This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License 2.0

- * which accompanies this distribution, and is available at

- * https://www.eclipse.org/legal/epl-2.0/

- *

- * SPDX-License-Identifier: EPL-2.0

- *

- * Contributors: Junhyung Ki - initial API and implementation

- * 

- *******************************************************************************/

-package org.eclipse.app4mc.gsoc_rta.ui;

-

-import java.awt.Color;

-import java.awt.EventQueue;

-import java.awt.Font;

-import java.awt.List;

-import java.awt.TextArea;

-import java.awt.event.ActionEvent;

-import java.awt.event.ActionListener;

-import java.math.BigInteger;

-import java.util.ArrayList;

-import java.util.HashMap;

-import javax.swing.ButtonGroup;

-import javax.swing.JButton;

-import javax.swing.JFrame;

-import javax.swing.JLabel;

-import javax.swing.JOptionPane;

-import javax.swing.JRadioButton;

-import javax.swing.JTextField;

-

-import org.eclipse.app4mc.amalthea.model.ProcessingUnit;

-import org.eclipse.app4mc.amalthea.model.PuType;

-import org.eclipse.app4mc.amalthea.model.Task;

-import org.eclipse.app4mc.amalthea.model.Time;

-import org.eclipse.app4mc.amalthea.model.TimeUnit;

-import org.eclipse.app4mc.amalthea.model.io.AmaltheaLoader;

-import org.eclipse.app4mc.amalthea.model.util.FactoryUtil;

-import org.eclipse.app4mc.amalthea.model.util.RuntimeUtil.TimeType;

-import org.eclipse.app4mc.gsoc_rta.*;

-

-/**

- * Date: Jun 20-2019 

- * @author Junhyung Ki

- * @version 1.0

- *					The purpose of this class is to provide users a better visual and increase usability of Response Time Analysis.

- */

-@SuppressWarnings("serial")

-public class RTApp_WATERS19 extends JFrame {

-	private HashMap<Integer, java.util.List<Task>> puTaskListHM;

-	private JFrame frame;

-	private boolean iaEntered = false;

-	

-	/**

-	 * Launch the application.

-	 */

-	public static void main(String[] args) {

-		EventQueue.invokeLater(new Runnable() {

-			public void run() {

-				org.apache.log4j.BasicConfigurator.configure();

-				final RTApp_WATERS19 window = new RTApp_WATERS19();

-				window.frame.setVisible(true);

-				window.frame.setTitle("APP4RTA");

-			}

-		});

-	}

-

-	/**

-	 * Create the frame.

-	 */

-	public RTApp_WATERS19() {

-		initialize();

-	}

-	

-	private void initialize() {

-		final CpuRTA cpurta = new CpuRTA();

-		final ArrayList<JTextField> jTextFieldList = new ArrayList<JTextField>();

-		final ArrayList<List> tListList = new ArrayList<List>();

-		final ArrayList<List> rtListList = new ArrayList<List>();

-		

-		frame = new JFrame();

-		frame.setBounds(100, 100, 864, 690);

-		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

-		frame.getContentPane().setLayout(null);

-		

-		JLabel lblEnterIa = new JLabel("Enter IA");

-		lblEnterIa.setBounds(32, 13, 56, 16);

-		frame.getContentPane().add(lblEnterIa);

-		

-		JButton btnDefualtIa = new JButton("Defualt IA");

-		btnDefualtIa.addActionListener(new ActionListener() {

-			public void actionPerformed(ActionEvent arg0) {

-				cpurta.setModel(AmaltheaLoader.loadFromFile(cpurta.inputFile));

-				cpurta.setTRT(cpurta.getDefaultTRT(cpurta.getModel()));

-				cpurta.setIA(cpurta.getDefaultIAMapping());

-				cpurta.setPUl(CommonUtils.getPUs(cpurta.getModel()));

-				final int[] defaultIA = cpurta.getIA();

-				for (int i = 0; i < defaultIA.length; i++) {

-					jTextFieldList.get(i).setText(""+defaultIA[i]);

-				}

-			}

-		});

-		btnDefualtIa.setBounds(12, 28, 97, 25);

-		frame.getContentPane().add(btnDefualtIa);

-		

-		JRadioButton rdbtnSynchronous = new JRadioButton("Synchronous");

-		rdbtnSynchronous.setBounds(157, 58, 107, 25);

-		frame.getContentPane().add(rdbtnSynchronous);

-		

-		JRadioButton rdbtnAsynchronous = new JRadioButton("Asynchronous");

-		rdbtnAsynchronous.setBounds(157, 79, 107, 25);

-		frame.getContentPane().add(rdbtnAsynchronous);

-		

-		ButtonGroup group_0 = new ButtonGroup();

-		group_0.add(rdbtnSynchronous);

-		group_0.add(rdbtnAsynchronous);

-		

-		JRadioButton rdbtnWorstCase = new JRadioButton("Worst Case");

-		rdbtnWorstCase.setBounds(268, 58, 107, 25);

-		frame.getContentPane().add(rdbtnWorstCase);

-		

-		JRadioButton rdbtnAverageCase = new JRadioButton("Average Case");

-		rdbtnAverageCase.setBounds(268, 79, 107, 25);

-		frame.getContentPane().add(rdbtnAverageCase);

-		

-		JRadioButton rdbtnBestCase = new JRadioButton("Best Case");

-		rdbtnBestCase.setBounds(268, 100, 107, 25);

-		frame.getContentPane().add(rdbtnBestCase);

-		

-		ButtonGroup group_1 = new ButtonGroup();

-		group_1.add(rdbtnWorstCase);

-		group_1.add(rdbtnAverageCase);

-		group_1.add(rdbtnBestCase);

-		

-		JButton btnEnterIA = new JButton("Enter IA");

-		btnEnterIA.addActionListener(new ActionListener() {

-			public void actionPerformed(ActionEvent e) {

-				cpurta.setModel(AmaltheaLoader.loadFromFile(cpurta.inputFile));

-				cpurta.setTRT(cpurta.getDefaultTRT(cpurta.getModel()));

-				int[] tpumap = new int[cpurta.getModel().getSwModel().getTasks().size()];

-				for (int i = 0; i < jTextFieldList.size(); i++) {

-					if ((jTextFieldList.get(i)).getText().length() == 0) {

-						JOptionPane.showMessageDialog(frame, "ERROR: Fill the rest of the array!");

-						return ;

-					}

-					else if ((jTextFieldList.get(i)).getText().charAt(0) < 48 || (jTextFieldList.get(i)).getText().charAt(0) > 54) {

-						JOptionPane.showMessageDialog(frame, "ERROR: Wrong array value!");

-						return ;

-					}

-					// TODO: should be more generic

-					else if (i >= 0 && i <= 9 && Integer.parseInt(((jTextFieldList.get(i)).getText())) == 6) {

-						JOptionPane.showMessageDialog(frame, "ERROR: CPU Tasks should not be mapped to GPU!");

-						return ;

-					}

-					// TODO: should be more generic

-					else if (i == jTextFieldList.size()-1 && Integer.parseInt(((jTextFieldList.get(i)).getText())) != 6) {

-						JOptionPane.showMessageDialog(frame, "ERROR: 'Detection' task can not be mapped to CPU!");

-						return ;

-					}

-					tpumap[i] = Integer.parseInt(((jTextFieldList.get(i)).getText()));

-				}

-				cpurta.setIA(tpumap);

-				cpurta.setPUl(CommonUtils.getPUs(cpurta.getModel()));

-				puTaskListHM = cpurta.be_getPUTaskListHashMap(cpurta.getModel());

-				for (int i = 0; i < puTaskListHM.size(); i++) {

-					if (tListList.get(i).getItemCount() == 0) {

-						for (int j = 0; j < puTaskListHM.get(i).size(); j++) {	

-							tListList.get(i).add((puTaskListHM.get(i).get(j)).getName());

-						}

-					}

-				}

-				iaEntered = true;

-			}

-		});

-		btnEnterIA.setBounds(616, 28, 97, 25);

-		frame.getContentPane().add(btnEnterIA);

-		

-		JLabel lblResponseTimeSum = new JLabel("Response Time Sum");

-		lblResponseTimeSum.setBounds(616, 359, 145, 16);

-		frame.getContentPane().add(lblResponseTimeSum);

-		

-		TextArea rtSum = new TextArea();

-		rtSum.setBounds(616, 381, 218, 50);

-		frame.getContentPane().add(rtSum);

-		

-		JButton btnCalculate = new JButton("Calculate");

-		btnCalculate.addActionListener(new ActionListener() {

-			public void actionPerformed(ActionEvent arg0) {

-				for (int i = 0; i < jTextFieldList.size(); i++) {

-					if ((jTextFieldList.get(i)).getText().length() == 0) {

-						JOptionPane.showMessageDialog(frame, "ERROR: Fill the array first!");

-						return ;

-					}

-				}				

-				if (rdbtnSynchronous.isSelected()) {

-					SharedConsts.synchronousOffloading = true;

-				}

-				else if (rdbtnAsynchronous.isSelected()) {

-					SharedConsts.synchronousOffloading = false;

-				}

-				else {

-					JOptionPane.showMessageDialog(frame, "ERROR: You should choose an offloading mode! (Sync / Async)");

-					return ;

-				}

-				if (rdbtnWorstCase.isSelected()) {

-					SharedConsts.timeType = TimeType.WCET;

-				}

-				else if (rdbtnAverageCase.isSelected()) {

-					SharedConsts.timeType = TimeType.ACET;

-				}

-				else if (rdbtnBestCase.isSelected()) {

-					SharedConsts.timeType = TimeType.BCET;

-				}

-				else {

-					JOptionPane.showMessageDialog(frame, "ERROR: You should choose an execution case! (Worst Case / Average Case / Best Case)");

-					return ;

-				}

-				if (iaEntered == false) {

-					JOptionPane.showMessageDialog(frame, "ERROR: Click the 'Enter IA' button!");

-					return ;

-				}				

-				boolean flag = false;

-				Time pRtSum = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

-				for (int i = 0; i < puTaskListHM.size(); i++) {

-					final ProcessingUnit pu = cpurta.getPUl().get(i);

-					final java.util.List<Task> thisPUTaskList = puTaskListHM.get(i);

-					Time thisRT = FactoryUtil.createTime(BigInteger.ZERO, TimeUnit.PS);

-					if (rtListList.get(i).getItemCount() == 0) {

-						if (pu.getDefinition().getPuType().equals(PuType.CPU)) {

-							for (Task t : thisPUTaskList) {

-								thisRT = cpurta.preciseTestCPURT(t, thisPUTaskList, SharedConsts.timeType, pu);

-								if (thisRT.getValue().equals(BigInteger.valueOf(Long.MAX_VALUE))) {

-									rtListList.get(i).add("Non Scheduleable! => MAX Value");

-									flag = true;

-								}

-								else {

-									rtListList.get(i).add(thisRT.toString());

-								}

-								pRtSum = pRtSum.add(thisRT);

-							}

-						}

-						else {

-							// TODO: TRT 0s!

-							for (Task t : thisPUTaskList) {

-								thisRT = cpurta.getTRT().get(t);

-								rtListList.get(i).add(thisRT.toString());

-								pRtSum = pRtSum.add(thisRT);

-							}

-						}

-					}

-				}

-				if (flag) {

-					rtSum.setText("Non Scheduleable!: " + pRtSum.toString());

-				}

-				else {

-					rtSum.setText(pRtSum.toString());

-				}

-			}

-		});

-		btnCalculate.setBounds(616, 58, 97, 25);

-		frame.getContentPane().add(btnCalculate);

-		

-		JButton btnReset = new JButton("Reset");

-		btnReset.addActionListener(new ActionListener() {

-			public void actionPerformed(ActionEvent e) {

-				cpurta.setModel(null);

-				cpurta.setTRT(null);

-				cpurta.setIA(null);

-				cpurta.setPUl(null);

-				puTaskListHM = null;

-				for (int i = 0; i < jTextFieldList.size(); i++) {

-					jTextFieldList.get(i).setText("");

-				}

-				for (List tList : tListList) {

-					tList.removeAll();

-				}

-				for (List rtList : rtListList) {

-					rtList.removeAll();

-				}

-				rtSum.setText(null);

-				iaEntered = false;

-			}

-		});

-		btnReset.setBounds(616, 86, 97, 25);

-		frame.getContentPane().add(btnReset);

-		

-		JLabel lblT0 = new JLabel("T0");

-		lblT0.setBounds(124, 13, 15, 16);

-		frame.getContentPane().add(lblT0);

-		

-		JTextField txtInput0 = new JTextField();

-		txtInput0.setBounds(124, 29, 23, 22);

-		txtInput0.setColumns(10);

-		frame.getContentPane().add(txtInput0);

-		jTextFieldList.add(txtInput0);

-		

-		JLabel lblT1 = new JLabel("T1");

-		lblT1.setBounds(159, 13, 15, 16);

-		frame.getContentPane().add(lblT1);

-		

-		JTextField txtInput1 = new JTextField();

-		txtInput1.setColumns(10);

-		txtInput1.setBounds(159, 29, 23, 22);

-		frame.getContentPane().add(txtInput1);

-		jTextFieldList.add(txtInput1);

-		

-		JLabel lblT2 = new JLabel("T2");

-		lblT2.setBounds(194, 13, 15, 16);

-		frame.getContentPane().add(lblT2);

-		

-		JTextField txtInput2 = new JTextField();

-		txtInput2.setColumns(10);

-		txtInput2.setBounds(194, 29, 23, 22);

-		frame.getContentPane().add(txtInput2);

-		jTextFieldList.add(txtInput2);

-		

-		JLabel lblT3 = new JLabel("T3");

-		lblT3.setBounds(229, 13, 15, 16);

-		frame.getContentPane().add(lblT3);

-		

-		JTextField txtInput3 = new JTextField();

-		txtInput3.setColumns(10);

-		txtInput3.setBounds(229, 29, 23, 22);

-		frame.getContentPane().add(txtInput3);

-		jTextFieldList.add(txtInput3);

-		

-		JLabel lblT4 = new JLabel("T4");

-		lblT4.setBounds(264, 13, 15, 16);

-		frame.getContentPane().add(lblT4);

-		

-		JTextField txtInput4 = new JTextField();

-		txtInput4.setColumns(10);

-		txtInput4.setBounds(264, 29, 23, 22);

-		frame.getContentPane().add(txtInput4);

-		jTextFieldList.add(txtInput4);

-		

-		JLabel lblT5 = new JLabel("T5");

-		lblT5.setBounds(299, 13, 15, 16);

-		frame.getContentPane().add(lblT5);

-		

-		JTextField txtInput5 = new JTextField();

-		txtInput5.setColumns(10);

-		txtInput5.setBounds(299, 29, 23, 22);

-		frame.getContentPane().add(txtInput5);

-		jTextFieldList.add(txtInput5);

-		

-		JLabel lblT6 = new JLabel("T6");

-		lblT6.setBounds(334, 13, 15, 16);

-		frame.getContentPane().add(lblT6);

-		

-		JTextField txtInput6 = new JTextField();

-		txtInput6.setColumns(10);

-		txtInput6.setBounds(334, 29, 23, 22);

-		frame.getContentPane().add(txtInput6);

-		jTextFieldList.add(txtInput6);

-		

-		JLabel lblT7 = new JLabel("T7");

-		lblT7.setBounds(369, 13, 15, 16);

-		frame.getContentPane().add(lblT7);

-		

-		JTextField txtInput7 = new JTextField();

-		txtInput7.setColumns(10);

-		txtInput7.setBounds(369, 29, 23, 22);

-		frame.getContentPane().add(txtInput7);

-		jTextFieldList.add(txtInput7);

-		

-		JLabel lblT8 = new JLabel("T8");

-		lblT8.setBounds(404, 13, 15, 16);

-		frame.getContentPane().add(lblT8);

-		

-		JTextField txtInput8 = new JTextField();

-		txtInput8.setColumns(10);

-		txtInput8.setBounds(404, 29, 23, 22);

-		frame.getContentPane().add(txtInput8);

-		jTextFieldList.add(txtInput8);

-		

-		JLabel lblT9 = new JLabel("T9");

-		lblT9.setBounds(439, 13, 15, 16);

-		frame.getContentPane().add(lblT9);

-		

-		JTextField txtInput9 = new JTextField();

-		txtInput9.setColumns(10);

-		txtInput9.setBounds(439, 29, 23, 22);

-		frame.getContentPane().add(txtInput9);

-		jTextFieldList.add(txtInput9);

-		

-		JLabel lblT10 = new JLabel("T10");

-		lblT10.setBounds(474, 13, 23, 16);

-		frame.getContentPane().add(lblT10);

-		

-		JTextField txtInput10 = new JTextField();

-		txtInput10.setColumns(10);

-		txtInput10.setBounds(474, 29, 23, 22);

-		frame.getContentPane().add(txtInput10);

-		jTextFieldList.add(txtInput10);

-		

-		JLabel lblT11 = new JLabel("T11");

-		lblT11.setBounds(509, 13, 23, 16);

-		frame.getContentPane().add(lblT11);

-		

-		JTextField txtInput11 = new JTextField();

-		txtInput11.setColumns(10);

-		txtInput11.setBounds(509, 29, 23, 22);

-		frame.getContentPane().add(txtInput11);

-		jTextFieldList.add(txtInput11);

-		

-		JLabel lblT12 = new JLabel("T12");

-		lblT12.setBounds(544, 13, 23, 16);

-		frame.getContentPane().add(lblT12);

-		

-		JTextField txtInput12 = new JTextField();

-		txtInput12.setColumns(10);

-		txtInput12.setBounds(544, 29, 23, 22);

-		frame.getContentPane().add(txtInput12);

-		jTextFieldList.add(txtInput12);

-		

-		JLabel lblT13 = new JLabel("T13");

-		lblT13.setBounds(579, 13, 23, 16);

-		frame.getContentPane().add(lblT13);

-		

-		JTextField txtInput13 = new JTextField();

-		txtInput13.setColumns(10);

-		txtInput13.setBounds(579, 29, 23, 22);

-		frame.getContentPane().add(txtInput13);

-		jTextFieldList.add(txtInput13);

-		

-		JLabel txtArm_0 = new JLabel("ARM0");

-		txtArm_0.setBounds(86, 154, 42, 22);

-		frame.getContentPane().add(txtArm_0);

-		

-		List arm0_list = new List();

-		arm0_list.setBounds(10, 180, 87, 145);

-		frame.getContentPane().add(arm0_list);

-		tListList.add(arm0_list);

-		

-		List arm0_rtList = new List();

-		arm0_rtList.setBounds(108, 180, 87, 145);

-		frame.getContentPane().add(arm0_rtList);

-		rtListList.add(arm0_rtList);

-		

-		JLabel txtArm_1 = new JLabel("ARM1");

-		txtArm_1.setBounds(288, 154, 42, 22);

-		frame.getContentPane().add(txtArm_1);

-		

-		List arm1_list = new List();

-		arm1_list.setBounds(212, 180, 87, 145);

-		frame.getContentPane().add(arm1_list);

-		tListList.add(arm1_list);

-		

-		List arm1_rtList = new List();

-		arm1_rtList.setBounds(309, 180, 87, 145);

-		frame.getContentPane().add(arm1_rtList);

-		rtListList.add(arm1_rtList);

-		

-		JLabel txtArm_2 = new JLabel("ARM2");

-		txtArm_2.setBounds(489, 154, 42, 22);

-		frame.getContentPane().add(txtArm_2);

-		

-		List arm2_list = new List();

-		arm2_list.setBounds(414, 180, 87, 145);

-		frame.getContentPane().add(arm2_list);

-		tListList.add(arm2_list);

-		

-		List arm2_rtList = new List();

-		arm2_rtList.setBounds(510, 180, 87, 145);

-		frame.getContentPane().add(arm2_rtList);

-		rtListList.add(arm2_rtList);

-		

-		JLabel txtArm_3 = new JLabel("ARM3");

-		txtArm_3.setBounds(691, 154, 42, 22);

-		frame.getContentPane().add(txtArm_3);

-		

-		List arm3_list = new List();

-		arm3_list.setBounds(616, 180, 87, 145);

-		frame.getContentPane().add(arm3_list);

-		tListList.add(arm3_list);

-		

-		List arm3_rtList = new List();

-		arm3_rtList.setBounds(711, 180, 87, 145);

-		frame.getContentPane().add(arm3_rtList);

-		rtListList.add(arm3_rtList);

-		

-		JLabel txtDenver_0 = new JLabel("Denver0");

-		txtDenver_0.setBounds(82, 335, 56, 22);

-		frame.getContentPane().add(txtDenver_0);

-		

-		List denver0_list = new List();

-		denver0_list.setBounds(10, 359, 87, 145);

-		frame.getContentPane().add(denver0_list);

-		tListList.add(denver0_list);

-		

-		List denver0_rtList = new List();

-		denver0_rtList.setBounds(108, 359, 87, 145);

-		frame.getContentPane().add(denver0_rtList);

-		rtListList.add(denver0_rtList);

-		

-		JLabel txtDenver_1 = new JLabel("Denver1");

-		txtDenver_1.setBounds(284, 335, 56, 22);

-		frame.getContentPane().add(txtDenver_1);

-		

-		List denver1_list = new List();

-		denver1_list.setBounds(212, 359, 87, 145);

-		frame.getContentPane().add(denver1_list);

-		tListList.add(denver1_list);

-		

-		List denver1_rtList = new List();

-		denver1_rtList.setBounds(309, 359, 87, 145);

-		frame.getContentPane().add(denver1_rtList);

-		rtListList.add(denver1_rtList);

-		

-		JLabel txtGpu = new JLabel("GPU");

-		txtGpu.setBounds(489, 335, 42, 22);

-		frame.getContentPane().add(txtGpu);

-		

-		List gpu_list = new List();

-		gpu_list.setBounds(414, 359, 87, 145);

-		frame.getContentPane().add(gpu_list);

-		tListList.add(gpu_list);

-		

-		List gpu_rtList = new List();

-		gpu_rtList.setBounds(510, 359, 87, 145);

-		frame.getContentPane().add(gpu_rtList);

-		rtListList.add(gpu_rtList);

-		

-		JLabel lblArm = new JLabel("0: ARM0");

-		lblArm.setBounds(12, 62, 56, 16);

-		frame.getContentPane().add(lblArm);

-		

-		JLabel lblArm_1 = new JLabel("1: ARM1");

-		lblArm_1.setBounds(12, 79, 56, 16);

-		frame.getContentPane().add(lblArm_1);

-		

-		JLabel lblArm_2 = new JLabel("2: ARM2");

-		lblArm_2.setBounds(12, 98, 56, 16);

-		frame.getContentPane().add(lblArm_2);

-		

-		JLabel lblArm_3 = new JLabel("3: ARM3");

-		lblArm_3.setBounds(12, 117, 56, 16);

-		frame.getContentPane().add(lblArm_3);

-		

-		JLabel lblDenver = new JLabel("4: Denver0");

-		lblDenver.setBounds(77, 62, 72, 16);

-		frame.getContentPane().add(lblDenver);

-		

-		JLabel lblDenver_1 = new JLabel("5: Denver1");

-		lblDenver_1.setBounds(77, 79, 72, 16);

-		frame.getContentPane().add(lblDenver_1);

-		

-		JLabel lblGpu = new JLabel("6: GPU");

-		lblGpu.setBounds(77, 96, 56, 16);

-		frame.getContentPane().add(lblGpu);

-		

-		JLabel lblApprta = new JLabel("APP4RTA");

-		lblApprta.setForeground(Color.BLUE);

-		lblApprta.setFont(new Font("Tahoma", Font.ITALIC, 20));

-		lblApprta.setBounds(747, 1, 87, 34);

-		frame.getContentPane().add(lblApprta);

-	}

-}
\ No newline at end of file