Skip to content
Snippets Groups Projects
Commit a9b41afb authored by dgelessus's avatar dgelessus
Browse files

Refactor TracePrinter construction

parent 00bf9116
Branches
Tags
No related merge requests found
......@@ -9,6 +9,7 @@ import tlc2.output.MP;
import tlc2.output.Message;
import tlc2.output.OutputCollector;
import tlc2.tool.BuiltInOPs;
import tlc2.tool.TLCState;
import tlc2.tool.TLCStateInfo;
import tlc2.tool.ToolGlobals;
......@@ -179,13 +180,13 @@ public class TLCResults implements ToolGlobals {
private void evalTrace() {
List<TLCStateInfo> trace = OutputCollector.getTrace();
TracePrinter printer = null;
if (!trace.isEmpty()) {
printer = new TracePrinter(trace, tlcOutputInfo);
} else if (OutputCollector.getInitialState() != null) {
printer = new TracePrinter(OutputCollector.getInitialState(), tlcOutputInfo);
TLCState initialState = OutputCollector.getInitialState();
if (trace.isEmpty() && initialState != null) {
trace = Collections.singletonList(new TLCStateInfo(initialState));
}
if (printer != null) {
if (!trace.isEmpty()) {
TracePrinter printer = new TracePrinter(trace, tlcOutputInfo);
traceString = printer.getTrace().toString();
}
}
......
......@@ -31,10 +31,6 @@ public class TracePrinter {
this.trace = trace;
this.tlcOutputInfo = tlcOutputInfo;
setup();
}
private void setup() {
constants = new ArrayList<>();
variables = new ArrayList<>();
for (int i = 0; i < TLCState.vars.length; i++) {
......@@ -49,12 +45,6 @@ public class TracePrinter {
evalTrace();
}
public TracePrinter(TLCState initialState, TLCOutputInfo tlcOutputInfo) {
this.initialState = initialState;
this.tlcOutputInfo = tlcOutputInfo;
setup();
}
public StringBuilder getTrace() {
return traceBuilder;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment