Commit 655f5937 authored by LULUDBR\Lulu's avatar LULUDBR\Lulu

View of Matching results of Sequentmatcher changed

parent fe2d7fa5
Pipeline #17111 passed with stages
in 9 minutes and 18 seconds
......@@ -26,7 +26,9 @@ import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class SequentMatcher extends BorderPane {
......@@ -77,6 +79,7 @@ public class SequentMatcher extends BorderPane {
//Highlight Matchings
matchingsView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
sequentView.clearHighlight();
if (newValue != null) {
newValue.forEach((name, mp) -> {
PosInOccurrence pio = mp.pio();
......@@ -121,7 +124,6 @@ public class SequentMatcher extends BorderPane {
Matchings matchings = MatcherFacade.matches(matchpattern.getText(), getSelectedGoalNodeToShow().getData().getNode().sequent(), true,
services);
ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings);
//If no matchings found, addCell "No matchings found"
......@@ -131,12 +133,39 @@ public class SequentMatcher extends BorderPane {
} else {
nomatchings.setVisible(false);
matchingsView.setItems(resultlist);
matchingsView.setCellFactory(param -> new ListCell<Map<String, MatchPath>>() {
//needed to hide position information of match paths
@Override
protected void updateItem(Map<String, MatchPath> item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(null);
} else {
setText("Match " + (resultlist.indexOf(item) +1)
+ ": " + matchingsToString(item));
}
}
});
matchingsView.setVisible(true);
}
}
/**
* Removes position information of the MatchPath
* @param match
* @return string without position information
*/
private String matchingsToString(Map<String, MatchPath> match) {
String string = match.toString();
string = string.replaceAll("[?]{2}_([0-9]*)=", "");
return string;
}
public ObservableList<GoalNode<KeyData>> getMatchingresults() {
return matchingresults.get();
}
......
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