package de.prob2.ui.verifications.tracereplay;

import de.prob.check.tracereplay.PersistentTrace;
import de.prob.statespace.Trace;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;

public class ReplayTrace{

	enum Status {
		SUCCESSFUL, FAILED, NOT_CHECKED
	}

	private ObjectProperty<Status> status;
	private PersistentTrace persistentTrace;
	private Exception error;

	public ReplayTrace(Trace trace) {
		this.persistentTrace = new PersistentTrace(trace);
		this.setStatus(Status.NOT_CHECKED);
	}

	public ReplayTrace(PersistentTrace pTrace) {
		this.persistentTrace = pTrace;
		this.setStatus(Status.NOT_CHECKED);
	}

	public PersistentTrace getStoredTrace() {
		return this.persistentTrace;
	}
	
	public void setStatus(Status status) {
		if(this.status == null) {
			this.status = new SimpleObjectProperty<>();
		}
		if(!status.equals(Status.FAILED)) {
			this.error = null;
		}
		this.status.set(status);
	}
	
	public void setError(Exception e) {
		this.error = e;
	}
	
	public ObjectProperty<Status> getStatus() {
		return status;
	}
	
	public Exception getError() {
		return error;
	}
}

@@ -310,16 +310,22 @@
 private 
+final 
 ObjectPr
@@ -440,15 +440,26 @@
 ace(
+Persistent
 Trace 
-t
+pT
 race
@@ -473,71 +473,60 @@
 his.
-persistentTrace = new PersistentTrace(trace);%0A%09%09this.setS
+status = new SimpleObjectProperty%3C%3E(this, %22s
 tatus
-(
+%22, 
 Stat
@@ -534,32 +534,86 @@
 s.NOT_CHECKED);%0A
+%09%09this.persistentTrace = pTrace;%0A%09%09this.error = null;%0A
 %09%7D%0A%0A%09public Repl
@@ -620,34 +620,23 @@
 ayTrace(
-Persistent
 Trace 
-pT
+t
 race) %7B%0A
@@ -637,26 +637,30 @@
 ce) %7B%0A%09%09this
-.p
+(new P
 ersistentTra
@@ -665,54 +665,15 @@
 race
- = pTrace;%0A%09%09this.setStatus(Status.NOT_CHECKED
+(trace)
 );%0A%09
@@ -798,87 +798,8 @@
 ) %7B%0A
-%09%09if(this.status == null) %7B%0A%09%09%09this.status = new SimpleObjectProperty%3C%3E();%0A%09%09%7D%0A
 %09%09if

Refactor ReplayTrace constructors