test unification and tree reveal

This commit is contained in:
ucrhh 2021-01-29 19:55:31 +01:00
parent 31cc4cb235
commit 38399222e5
2 changed files with 24 additions and 12 deletions

View File

@ -22,8 +22,8 @@ public class StartPageView extends VerticalLayout implements ControlPanelView {
private final Div content;
private final ControlPanel controlPanel;
MathjaxProofTree mjxPT;
MathjaxUnification mjxU;
MathjaxProofTree tree;
MathjaxUnification unification;
public StartPageView() {
// todo implement correctly
@ -42,12 +42,14 @@ public class StartPageView extends VerticalLayout implements ControlPanelView {
}
private void createContent() {
String[] strings = new String[]{"$\\vdash$", "$\\Gamma$"};
String[] strings = new String[]{"$\\tau_0$", "$\\tau_1$", "$\\tau_2$", "$\\tau_3$", "$\\tau_4$",
"$\\tau_5$", "$\\tau_6$", "$\\tau_7$", "$\\tau_8$", "$\\tau_9$", "$\\tau_{10}$", "$\\tau_{11}$",
"$\\tau_{12}$", "$\\tau_{13}$", "$\\tau_{14}$"};
content.add(new MathjaxDisplay(getTranslation("abs-rule")));
mjxU = new MathjaxUnification(strings);
mjxPT = new MathjaxProofTree(getTranslation("demo-tree"));
content.add(mjxU);
content.add(mjxPT);
unification = new MathjaxUnification(strings);
tree = new MathjaxProofTree(getTranslation("demo-tree"));
content.add(unification);
content.add(tree);
content.add(new MathjaxProofTree(getTranslation("demo-tree")));
content.add(new MathjaxProofTree(getTranslation("demo-tree")));
content.add(new MathjaxProofTree(getTranslation("demo-tree")));
@ -67,23 +69,33 @@ public class StartPageView extends VerticalLayout implements ControlPanelView {
public void shareButton() {
}
private int currentStep = 0;
private void refreshElements(int currentStep) {
unification.showStep(currentStep);
tree.showStep(currentStep < tree.getStepCount() ? currentStep : tree.getStepCount() - 1);
}
@Override
public void firstStepButton() {
mjxPT.showStep(0);
currentStep = currentStep > tree.getStepCount() ? tree.getStepCount() - 1 : 0;
refreshElements(currentStep);
}
@Override
public void lastStepButton() {
mjxPT.showStep(5);
currentStep = currentStep < tree.getStepCount() - 1 ? tree.getStepCount() - 1 : unification.getStepCount() - 1;
refreshElements(currentStep);
}
@Override
public void nextStepButton() {
mjxU.showStep(1);
currentStep = currentStep < unification.getStepCount() - 1 ? currentStep + 1 : currentStep;
refreshElements(currentStep);
}
@Override
public void previousStepButton() {
mjxU.showStep(0);
currentStep = currentStep > 0 ? currentStep - 1 : currentStep;
refreshElements(currentStep);
}
}

View File

@ -52,7 +52,7 @@ public class TypeInferenceView extends HorizontalLayout
@Override
public void firstStepButton() {
currentStep = currentStep > tree.getStepCount() ? tree.getStepCount() : 0;
currentStep = currentStep > tree.getStepCount() ? tree.getStepCount() - 1 : 0;
refreshElements(currentStep);
}