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 { ...@@ -37,7 +37,7 @@ public class InspectionView extends BorderPane {
); );
public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu(); public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
public SequentOptionsMenu sequentOptionsMenu = new SequentOptionsMenu(); public SequentOptionsMenu sequentOptionsMenu = new SequentOptionsMenu(model.get());
@FXML @Getter @FXML @Getter
private ComboBox<PTreeNode<KeyData>> frames; private ComboBox<PTreeNode<KeyData>> frames;
......
package edu.kit.iti.formal.psdbg.gui.controls; 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.GoalNode;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData; import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import javafx.beans.property.ReadOnlyObjectProperty; import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade;
import javafx.beans.property.SimpleObjectProperty; 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.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import java.util.Map;
public class SequentMatcher extends BorderPane { public class SequentMatcher extends BorderPane {
...@@ -19,13 +25,113 @@ public class SequentMatcher extends BorderPane { ...@@ -19,13 +25,113 @@ public class SequentMatcher extends BorderPane {
@FXML @FXML
private ListView<GoalNode<KeyData>> goalView; private ListView<GoalNode<KeyData>> goalView;
@FXML
private TextArea matchpattern;
@FXML
private ListView<Map<String, MatchPath>> matchingsView;
public SequentMatcher() { 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() { 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; ...@@ -2,6 +2,7 @@ package edu.kit.iti.formal.psdbg.gui.controls;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; 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 edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
...@@ -21,22 +22,24 @@ import java.util.function.Function; ...@@ -21,22 +22,24 @@ import java.util.function.Function;
public class SequentOptionsMenu extends ContextMenu { public class SequentOptionsMenu extends ContextMenu {
private final InspectionModel model;
@FXML @FXML
private MenuItem openSequentMatcher; private MenuItem openSequentMatcher;
public SequentOptionsMenu() { public SequentOptionsMenu(InspectionModel model) {
Utils.createWithFXML(this); Utils.createWithFXML(this);
this.model = model;
openSequentMatcher.setOnAction(new EventHandler<ActionEvent>() { openSequentMatcher.setOnAction(new EventHandler<ActionEvent>() {
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
//TODO: Abchecken ob überhaupt eine Sequenz vorhanden ist //TODO: Abchecken ob überhaupt eine Sequenz vorhanden ist
try{ try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("SequentMatcher.fxml")); SequentMatcher root1 = new SequentMatcher();
Parent root1 = (Parent) fxmlLoader.load(); root1.setGoals(model.getGoals());
root1.setSelectedGoalNodeToShow(model.getSelectedGoalNodeToShow());
Stage stage = new Stage(); Stage stage = new Stage();
stage.setTitle("Sequent Matcher"); stage.setTitle("Sequent Matcher");
stage.setScene(new Scene(root1)); stage.setScene(new Scene(root1));
...@@ -44,7 +47,8 @@ public class SequentOptionsMenu extends ContextMenu { ...@@ -44,7 +47,8 @@ public class SequentOptionsMenu extends ContextMenu {
//TODO: probably have to add a few things here (Lulu) //TODO: probably have to add a few things here (Lulu)
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace();
System.out.println(e); System.out.println(e);
} }
} }
...@@ -53,8 +57,4 @@ public class SequentOptionsMenu extends ContextMenu { ...@@ -53,8 +57,4 @@ public class SequentOptionsMenu extends ContextMenu {
} }
} }
\ No newline at end of file
...@@ -11,49 +11,55 @@ ...@@ -11,49 +11,55 @@
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?> <?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> <center>
<SplitPane dividerPositions="0.4189895470383275" prefHeight="625.0" prefWidth="800"> <SplitPane dividerPositions="0.4189895470383275" prefHeight="625.0" prefWidth="800">
<items> <items>
<VBox prefHeight="200.0" prefWidth="100.0"> <VBox prefHeight="200.0" prefWidth="100.0">
<children> <children>
<Label text="Sequent" /> <Label text="Sequent"/>
<SequentView minHeight="0.0" minWidth="0.0" prefHeight="633.0" prefWidth="341.0" /> <SequentView fx:id="sequentView" minHeight="0.0" minWidth="0.0" prefHeight="633.0" prefWidth="341.0"/>
</children> </children>
</VBox> </VBox>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="348.0" prefWidth="814.0"> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="348.0" prefWidth="814.0">
<children> <children>
<SplitPane dividerPositions="0.28551136363636365" layoutX="11.0" layoutY="12.0" orientation="VERTICAL" prefHeight="706.0" prefWidth="641.0"> <SplitPane dividerPositions="0.28551136363636365" layoutX="11.0" layoutY="12.0"
<items> orientation="VERTICAL" prefHeight="706.0" prefWidth="641.0">
<VBox prefHeight="293.0" prefWidth="639.0"> <items>
<children> <VBox prefHeight="293.0" prefWidth="639.0">
<Label text="Matching Pattern" /> <children>
<TextArea minHeight="0.0" minWidth="0.0" prefHeight="159.0" prefWidth="639.0" text="Geben Sie hier Ihr Matching Pattern ein ... " /> <Label text="Matching Pattern"/>
<Button mnemonicParsing="false" text="Start Matching" onMouseClicked = "#startMatch" /> <TextArea fx:id="matchpattern" minHeight="0.0" minWidth="0.0" prefHeight="159.0" prefWidth="639.0"
</children> />
</VBox> <Button mnemonicParsing="false" text="Start Matching"
<VBox prefHeight="349.0" prefWidth="664.0"> onMouseClicked="#startMatch"/>
<children> </children>
<Label text="Matches" /> </VBox>
</children> <VBox prefHeight="349.0" prefWidth="664.0">
</VBox> <children>
</items> <Label text="Matches"/>
<ListView fx:id="matchingsView"/>
</children>
</VBox>
</items>
</SplitPane> </SplitPane>
</children> </children>
</AnchorPane> </AnchorPane>
</items> </items>
</SplitPane> </SplitPane>
</center> </center>
<top> <top>
<VBox prefHeight="218.0" prefWidth="1150.0"> <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 id="title" alignment="CENTER" contentDisplay="TOP" prefHeight="0.0" prefWidth="107.0"
<Label text="Goal List" /> style="-fx-font-weight: bold; -fx-font-size: 110%;" text="Sequent Matcher"/>
<ListView id="goalView" /> <Label text="Goal List"/>
<ListView fx:id="goalView"/>
</VBox> </VBox>
</top> </top>
<padding> <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> </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