Skip to content

Commit 851addb

Browse files
committed
Repaired regression bug in Show Trace to State action
1 parent 3c43c21 commit 851addb

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/main/java/nl/utwente/groove/gui/jgraph/LTSJGraph.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -470,21 +470,16 @@ private Collection<LTSJCell> getTransitionCells(GraphTransition trans) {
470470
}
471471

472472
/** Returns the traces from the given set of states to the start state. */
473-
public Set<LTSJCell> findTraces(Iterable<GraphState> states) {
474-
Set<GraphTransition> simulatorTrace = new HashSet<>();
475-
Set<LTSJCell> result = new HashSet<>();
476-
LTSJModel model = getNonNullModel();
473+
public Set<GraphTransition> findTraces(Iterable<GraphState> states) {
474+
Set<GraphTransition> result = new HashSet<>();
477475
for (GraphState state : states) {
478476
while (state instanceof GraphNextState) {
479-
result.add((LTSJVertex) model.getJCellForNode(state));
480477
GraphTransition trans = ((GraphNextState) state).getInTransition();
481-
result.add((LTSJEdge) model.getJCellForEdge(trans));
482-
simulatorTrace.add(trans);
478+
result.add(trans);
483479
state = trans.source();
484480
}
485-
result.add((LTSJCell) model.getJCellForNode(state));
486481
}
487-
getSimulatorModel().setTrace(simulatorTrace);
482+
getSimulatorModel().setTrace(result);
488483
return result;
489484
}
490485

src/main/java/nl/utwente/groove/gui/menu/ShowHideMenu.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import nl.utwente.groove.io.GrooveFileChooser;
5858
import nl.utwente.groove.io.HTMLConverter;
5959
import nl.utwente.groove.lts.GTS;
60+
import nl.utwente.groove.lts.GraphTransition;
6061
import nl.utwente.groove.util.parse.FormatException;
6162

6263
/**
@@ -699,10 +700,19 @@ public void actionPerformed(ActionEvent evt) {
699700

700701
@Override
701702
protected boolean isInvolved(JCell<@NonNull GTS> jCell) {
702-
return this.trace.contains(jCell);
703+
boolean result = false;
704+
if (jCell instanceof LTSJCell ltsJCell) {
705+
for (var t : ltsJCell.getEdges()) {
706+
result = this.trace.contains(t);
707+
if (result) {
708+
break;
709+
}
710+
}
711+
}
712+
return result;
703713
}
704714

705-
private Set<LTSJCell> trace;
715+
private Set<GraphTransition> trace;
706716
}
707717

708718
/**

0 commit comments

Comments
 (0)