Commit 454a5619 authored by LULUDBR\Lulu's avatar LULUDBR\Lulu

matcher added

parent fc301d6c
Pipeline #16070 passed with stages
in 11 minutes and 5 seconds
......@@ -37,7 +37,7 @@ public class InspectionView extends BorderPane {
);
public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
public SequentOptionsMenu sequentOptionsMenu = new SequentOptionsMenu();
public SequentOptionsMenu sequentOptionsMenu = new SequentOptionsMenu(model.get());
@FXML @Getter
private ComboBox<PTreeNode<KeyData>> frames;
......
package edu.kit.iti.formal.psdbg.gui.controls;
import edu.kit.iti.formal.psdbg.gui.model.InspectionModel;
import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade;
import edu.kit.iti.formal.psdbg.termmatcher.Matchings;
import edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import java.util.Map;
public class SequentMatcher extends BorderPane {
......@@ -19,13 +25,113 @@ public class SequentMatcher extends BorderPane {
@FXML
private ListView<GoalNode<KeyData>> goalView;
@FXML
private TextArea matchpattern;
@FXML
private ListView<Map<String, MatchPath>> matchingsView;
public SequentMatcher() {
sequentView = new SequentView();
Utils.createWithFXML(this);
selectedGoalNodeToShow.addListener((observable, oldValue, newValue) -> {
sequentView.setGoal(newValue.getData().getGoal());
sequentView.setNode(newValue.getData().getNode());
}
);
goalView.getSelectionModel().selectedItemProperty().addListener((prop, old, nnew) ->
selectedGoalNodeToShow.setValue(nnew)
);
goals.addListener((observable, oldValue, newValue) -> goalView.setItems(newValue));
}
public void startMatch() {
System.out.println("Start Match got clicked");
Matchings matchings = MatcherFacade.matches(matchpattern.getText(), getSelectedGoalNodeToShow().getData().getNode().sequent(), true);
ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings);
if (resultlist.isEmpty()) {
System.out.println("No matchings found for this sequent");
}
matchingsView.setItems(resultlist);
}
//alle aktuellen nicht geschlossene Ziele -> alle leaves später (open+closed)
private final ListProperty<GoalNode<KeyData>> goals = new SimpleListProperty<>(this, "goals", FXCollections.observableArrayList());
private final ListProperty<GoalNode<KeyData>> matchingresults = new SimpleListProperty<>(this, "matchingresults", FXCollections.observableArrayList());
public ObservableList<GoalNode<KeyData>> getMatchingresults() {
return matchingresults.get();
}
public ObservableList<Map<String, MatchPath>> getResults() {
return results.get();
}
public ListProperty<Map<String, MatchPath>> resultsProperty() {
return results;
}
public void setResults(ObservableList<Map<String, MatchPath>> results) {
this.results.set(results);
}
private final ListProperty<Map<String, MatchPath>> results = new SimpleListProperty<>(this, "results", FXCollections.observableArrayList());
//sicht user selected
private final ObjectProperty<GoalNode<KeyData>> selectedGoalNodeToShow = new SimpleObjectProperty<>(this, "selectedGoalNodeToShow");
public ObservableList<GoalNode<KeyData>> getGoals() {
return goals.get();
}
public ListProperty<GoalNode<KeyData>> goalsProperty() {
return goals;
}
public void setGoals(ObservableList<GoalNode<KeyData>> goals) {
this.goals.set(goals);
}
public GoalNode<KeyData> getSelectedGoalNodeToShow() {
return selectedGoalNodeToShow.get();
}
public ObjectProperty<GoalNode<KeyData>> selectedGoalNodeToShowProperty() {
return selectedGoalNodeToShow;
}
public void setSelectedGoalNodeToShow(GoalNode<KeyData> selectedGoalNodeToShow) {
this.selectedGoalNodeToShow.set(selectedGoalNodeToShow);
}
public ListView<Map<String, MatchPath>> getMatchingsView() {
return matchingsView;
}
public void setMatchingsView(ListView<Map<String, MatchPath>> matchingsView) {
this.matchingsView = matchingsView;
}
public ListProperty<GoalNode<KeyData>> matchingresultsProperty() {
return matchingresults;
}
public void setMatchingresults(ObservableList<GoalNode<KeyData>> matchingresults) {
this.matchingresults.set(matchingresults);
}
}
......@@ -2,6 +2,7 @@ package edu.kit.iti.formal.psdbg.gui.controls;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import edu.kit.iti.formal.psdbg.gui.model.InspectionModel;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
......@@ -21,22 +22,24 @@ import java.util.function.Function;
public class SequentOptionsMenu extends ContextMenu {
private final InspectionModel model;
@FXML
private MenuItem openSequentMatcher;
public SequentOptionsMenu() {
public SequentOptionsMenu(InspectionModel model) {
Utils.createWithFXML(this);
this.model = model;
openSequentMatcher.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
//TODO: Abchecken ob überhaupt eine Sequenz vorhanden ist
try{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("SequentMatcher.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
try {
SequentMatcher root1 = new SequentMatcher();
root1.setGoals(model.getGoals());
root1.setSelectedGoalNodeToShow(model.getSelectedGoalNodeToShow());
Stage stage = new Stage();
stage.setTitle("Sequent Matcher");
stage.setScene(new Scene(root1));
......@@ -44,7 +47,8 @@ public class SequentOptionsMenu extends ContextMenu {
//TODO: probably have to add a few things here (Lulu)
} catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
}
......@@ -53,8 +57,4 @@ public class SequentOptionsMenu extends ContextMenu {
}
}
\ No newline at end of file
......@@ -11,49 +11,55 @@
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<BorderPane prefHeight="600" prefWidth="1200" xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1" fx:controller="edu.kit.iti.formal.psdbg.gui.controls.SequentMatcher">
<fx:root xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1"
type="edu.kit.iti.formal.psdbg.gui.controls.SequentMatcher">
<center>
<SplitPane dividerPositions="0.4189895470383275" prefHeight="625.0" prefWidth="800">
<items>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<Label text="Sequent" />
<SequentView minHeight="0.0" minWidth="0.0" prefHeight="633.0" prefWidth="341.0" />
</children>
</VBox>
<SplitPane dividerPositions="0.4189895470383275" prefHeight="625.0" prefWidth="800">
<items>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<Label text="Sequent"/>
<SequentView fx:id="sequentView" minHeight="0.0" minWidth="0.0" prefHeight="633.0" prefWidth="341.0"/>
</children>
</VBox>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="348.0" prefWidth="814.0">
<children>
<SplitPane dividerPositions="0.28551136363636365" layoutX="11.0" layoutY="12.0" orientation="VERTICAL" prefHeight="706.0" prefWidth="641.0">
<items>
<VBox prefHeight="293.0" prefWidth="639.0">
<children>
<Label text="Matching Pattern" />
<TextArea minHeight="0.0" minWidth="0.0" prefHeight="159.0" prefWidth="639.0" text="Geben Sie hier Ihr Matching Pattern ein ... " />
<Button mnemonicParsing="false" text="Start Matching" onMouseClicked = "#startMatch" />
</children>
</VBox>
<VBox prefHeight="349.0" prefWidth="664.0">
<children>
<Label text="Matches" />
</children>
</VBox>
</items>
<children>
<SplitPane dividerPositions="0.28551136363636365" layoutX="11.0" layoutY="12.0"
orientation="VERTICAL" prefHeight="706.0" prefWidth="641.0">
<items>
<VBox prefHeight="293.0" prefWidth="639.0">
<children>
<Label text="Matching Pattern"/>
<TextArea fx:id="matchpattern" minHeight="0.0" minWidth="0.0" prefHeight="159.0" prefWidth="639.0"
/>
<Button mnemonicParsing="false" text="Start Matching"
onMouseClicked="#startMatch"/>
</children>
</VBox>
<VBox prefHeight="349.0" prefWidth="664.0">
<children>
<Label text="Matches"/>
<ListView fx:id="matchingsView"/>
</children>
</VBox>
</items>
</SplitPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</center>
<top>
<VBox prefHeight="218.0" prefWidth="1150.0">
<Label id="title" alignment="CENTER" contentDisplay="TOP" prefHeight="0.0" prefWidth="107.0" style="-fx-font-weight: bold; -fx-font-size: 110%;" text="Sequent Matcher" />
<Label text="Goal List" />
<ListView id="goalView" />
<Label id="title" alignment="CENTER" contentDisplay="TOP" prefHeight="0.0" prefWidth="107.0"
style="-fx-font-weight: bold; -fx-font-size: 110%;" text="Sequent Matcher"/>
<Label text="Goal List"/>
<ListView fx:id="goalView"/>
</VBox>
</top>
<padding>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0"/>
</padding>
</BorderPane>
</fx:root>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment