Skip to content

Commit

Permalink
Clear buttons after exporting - Task #1044
Browse files Browse the repository at this point in the history
  • Loading branch information
maur_pa authored and maur_pa committed Feb 21, 2022
1 parent 0584882 commit f2d6b91
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,8 @@ public void createPartControl(final Composite parent) {
parent.setLayout(new GridLayout(COL, true));
expliciteButtonComposite = new Composite(parent, SWT.NONE);
expliciteButtonComposite.setLayout(new GridLayout(2, false));
expliciteButtonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false));


expliciteButtonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false));
this.swtAwtComposite = parent;


createNorthButtonPanel(expliciteButtonComposite);
createSimulatorPanel(parent);
}
Expand Down Expand Up @@ -344,6 +340,21 @@ public void widgetSelected(SelectionEvent e) {
openSimulationHistoryExportShell();
}

if (outputtable != null) {
outputtable.removeAll();
outputtable.update();
outputtable.clearAll();
for (Control control : outputtable.getChildren()) {
if (control instanceof Button) {
control.dispose();
}
}
}

if (transitionsEditors != null) {
transitionsEditors.dispose();
}


List<StateMachine> sm = new ArrayList<StateMachine>();
for (TableItem item : table.getItems()) {
Expand All @@ -354,9 +365,9 @@ public void widgetSelected(SelectionEvent e) {

}
}
simulator = new StateMachineSimulator();

simulator = new StateMachineSimulator();
GlobalState gs = simulator.initialSimulationComputation(sm);

simulationhistory = new PriorityQueue<String>();
simulationhistory.add("Initial State: " + gs.printState());
createNewSimulationTrace(outputtable, gs);
Expand Down Expand Up @@ -403,11 +414,21 @@ private void openSimulationHistoryExportShell() {
exporter.export(simulationhistory);
simulationhistory.clear();
outputtable.removeAll();
for (Control control : outputtable.getChildren()) {
if (control instanceof Button) {
control.dispose();
}
}
transitionsEditors.dispose();
break;
case SWT.NO:
simulationhistory.clear();
outputtable.removeAll();
for (Control control : outputtable.getChildren()) {
if (control instanceof Button) {
control.dispose();
}
}
transitionsEditors.dispose();
break;
case SWT.CANCEL:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@
import de.dlr.sc.virsat.model.extension.statemachines.model.Transition;

public class StateMachineSimulator {


private HashMap<String, HashMap<String, HashMap<String, String>>> localEnabledTransitions;
private HashMap<String, HashMap<String, HashMap<String, String>>> stateConstraints;
private Set<String> stateMachines;
private Stack<GlobalState> globalStateStack;

/**
* State Machine Simulator
*/
public StateMachineSimulator() {
localEnabledTransitions = new HashMap<String, HashMap<String, HashMap<String, String>>>();
stateConstraints = new HashMap<String, HashMap<String, HashMap<String, String>>>();
stateMachines = new HashSet<String>();
globalStateStack = new Stack<GlobalState>();

}

/**
* used to compute information for transition
Expand Down Expand Up @@ -65,9 +82,7 @@ private void updateMap(HashMap<String, HashMap<String, HashMap<String, String>>>
}
}
}

private HashMap<String, HashMap<String, HashMap<String, String>>> localEnabledTransitions = new HashMap<String, HashMap<String, HashMap<String, String>>>();
private HashMap<String, HashMap<String, HashMap<String, String>>> stateConstraints = new HashMap<String, HashMap<String, HashMap<String, String>>>();

/**
* // this function must be called before running POR, it is used to compute
// enabled transitions for every local state
Expand Down Expand Up @@ -199,8 +214,7 @@ boolean isDependent(Trans t1, Trans t2) {
.contains(t2.stateMachine + "." + t2.destinationState);
}

Set<String> stateMachines = new HashSet<String>();
Stack<GlobalState> globalStateStack = new Stack<GlobalState>();



/**
Expand Down Expand Up @@ -258,7 +272,6 @@ boolean contain(Set<Trans> tranSet, Trans tr) {
return false;
}

int reducedTrace = 0;
/**
* Exploartion algorithm
* @param design
Expand All @@ -275,7 +288,6 @@ public GlobalState initialSimulationComputation(List<StateMachine> design) {
return s;
}

int exTraces = 0;
/**
* Exhaustive exploration
* @param design
Expand Down

0 comments on commit f2d6b91

Please sign in to comment.