From 36c9f092c7eccb65f5a3cb913cdb7cb041737ea0 Mon Sep 17 00:00:00 2001 From: uogau Date: Wed, 27 Jan 2021 20:56:31 +0100 Subject: [PATCH] Step-Paket implementiert, StepVisitor-Methoden angepasst --- package.json | 33 ++++++++++++-- .../typicalc/model/step/AbsStepDefault.java | 27 ++++++++++- .../typicalc/model/step/AbsStepWithLet.java | 27 ++++++++++- .../typicalc/model/step/AppStepDefault.java | 29 +++++++++++- .../typicalc/model/step/ConstStepDefault.java | 27 ++++++++++- .../typicalc/model/step/InferenceStep.java | 45 ++++++++++++++++--- .../typicalc/model/step/LetStepDefault.java | 30 ++++++++++++- .../kit/typicalc/model/step/StepVisitor.java | 14 +++--- .../typicalc/model/step/VarStepDefault.java | 24 +++++++++- .../typicalc/model/step/VarStepWithLet.java | 24 +++++++++- .../typeinferencecontent/LatexCreator.java | 14 +++--- 11 files changed, 263 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index f126606..ea2cfad 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,20 @@ "lit-element": "2.3.1", "@vaadin/form": "./target/flow-frontend/form", "@vaadin/vaadin-avatar": "1.0.3", - "open": "^7.2.1" + "open": "^7.2.1", + "@vaadin/vaadin-crud": "1.3.0", + "@vaadin/vaadin-cookie-consent": "1.2.0", + "@vaadin/vaadin-upload": "4.4.1", + "@vaadin/vaadin-board": "2.2.0", + "@vaadin/vaadin-date-time-picker": "1.4.0", + "@vaadin/vaadin-login": "1.2.0", + "@vaadin/vaadin-accordion": "1.2.0", + "@vaadin/vaadin-checkbox": "2.5.0", + "@vaadin/vaadin-time-picker": "2.4.0", + "@vaadin/vaadin-context-menu": "4.5.0", + "@vaadin/vaadin-tabs": "3.2.0", + "@vaadin/vaadin-radio-button": "1.5.1", + "@vaadin/vaadin-rich-text-editor": "1.3.0" }, "devDependencies": { "webpack": "4.42.0", @@ -96,7 +109,21 @@ "@vaadin/vaadin-custom-field": "1.3.0", "lit-element": "2.3.1", "@vaadin/vaadin-avatar": "1.0.3", - "open": "^7.2.1" + "open": "^7.2.1", + "@vaadin/vaadin-crud": "1.3.0", + "@vaadin/vaadin-cookie-consent": "1.2.0", + "@vaadin/vaadin-upload": "4.4.1", + "@vaadin/vaadin-board": "2.2.0", + "@vaadin/vaadin-charts": "7.0.0", + "@vaadin/vaadin-date-time-picker": "1.4.0", + "@vaadin/vaadin-login": "1.2.0", + "@vaadin/vaadin-date-picker": "4.4.1", + "@vaadin/vaadin-accordion": "1.2.0", + "@vaadin/vaadin-checkbox": "2.5.0", + "@vaadin/vaadin-time-picker": "2.4.0", + "@vaadin/vaadin-tabs": "3.2.0", + "@vaadin/vaadin-radio-button": "1.5.1", + "@vaadin/vaadin-rich-text-editor": "1.3.0" }, "devDependencies": { "webpack-babel-multi-target-plugin": "2.3.3", @@ -122,6 +149,6 @@ "lit-css-loader": "0.0.4", "extract-loader": "5.1.0" }, - "hash": "b905e6c0ab4b1f42dcee18553457275cfa5c59c2404c0d9d2acc51cdb43de40b" + "hash": "176a855b9845a8bd6e1b6138940c86e0431291e79479361d27a18a7b50bd4678" } } diff --git a/src/main/java/edu/kit/typicalc/model/step/AbsStepDefault.java b/src/main/java/edu/kit/typicalc/model/step/AbsStepDefault.java index a260062..31ce9fe 100644 --- a/src/main/java/edu/kit/typicalc/model/step/AbsStepDefault.java +++ b/src/main/java/edu/kit/typicalc/model/step/AbsStepDefault.java @@ -1,4 +1,29 @@ package edu.kit.typicalc.model.step; -public class AbsStepDefault { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; + +/** + * Models one step of the inference tree where the abstraction rule + * is applied and no let rule is applied in the entire tree. + */ +public class AbsStepDefault extends AbsStep { + /** + * Initializes a new AbsStepDefault with the given values. + * @param premise the premise of this step + * @param conclusion the conclusion of this step + * @param constraint the constraint added in this step + */ + public AbsStepDefault(InferenceStep premise, Conclusion conclusion, Constraint constraint) { + super(premise, conclusion, constraint); + } + + /** + * Accepts a visitor. + * @param stepVisitor – the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/model/step/AbsStepWithLet.java b/src/main/java/edu/kit/typicalc/model/step/AbsStepWithLet.java index 55ce5ea..af4fa4a 100644 --- a/src/main/java/edu/kit/typicalc/model/step/AbsStepWithLet.java +++ b/src/main/java/edu/kit/typicalc/model/step/AbsStepWithLet.java @@ -1,4 +1,29 @@ package edu.kit.typicalc.model.step; -public class AbsStepWithLet { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; + +/** + * Models one step of the inference tree where the abstraction rule is applied and at least + * one let rule is applied in the entire tree. + */ +public class AbsStepWithLet extends AbsStep { + /** + *Initializes a new AbsStepWithLet with the given values. + * @param premise the premise of this step + * @param conclusion the conclusion of this step + * @param constraint constraint that can be derived from this step + */ + public AbsStepWithLet(InferenceStep premise, Conclusion conclusion, Constraint constraint) { + super(premise, conclusion, constraint); + } + + /** + * Accepts a visitor. + * @param stepVisitor the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/model/step/AppStepDefault.java b/src/main/java/edu/kit/typicalc/model/step/AppStepDefault.java index 036d94b..4c9cced 100644 --- a/src/main/java/edu/kit/typicalc/model/step/AppStepDefault.java +++ b/src/main/java/edu/kit/typicalc/model/step/AppStepDefault.java @@ -1,4 +1,31 @@ package edu.kit.typicalc.model.step; -public class AppStepDefault { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; + +/** + * Models one step of the inference tree where the abstraction rule is applied and no let rule + * is applied in the entire tree. + */ +public class AppStepDefault extends AppStep { + /** + *Initializes a new AbsStepWithLet with the given values. + * @param premise1 the first premise of this step + * @param premise2 the second premise of this step + * @param conclusion the conclusion of this step + * @param constraint constraint that can be derived from this step + */ + public AppStepDefault(InferenceStep premise1, InferenceStep premise2, + Conclusion conclusion, Constraint constraint) { + super(premise1, premise2, conclusion, constraint); + } + + /** + * Accepts a visitor. + * @param stepVisitor – the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/model/step/ConstStepDefault.java b/src/main/java/edu/kit/typicalc/model/step/ConstStepDefault.java index 5768d76..18c2933 100644 --- a/src/main/java/edu/kit/typicalc/model/step/ConstStepDefault.java +++ b/src/main/java/edu/kit/typicalc/model/step/ConstStepDefault.java @@ -1,4 +1,29 @@ package edu.kit.typicalc.model.step; -public class ConstStepDefault { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; + +/** + * Models one step of the inference tree where the constant rule is applied. As the constant + * rule is the same regardless of whether the tree contains a let step, this is the only subclass + * of ConstStep. + */ +public class ConstStepDefault extends ConstStep { + /** + * Initializes a new ConstStep with the given values. + * @param conclusion the conclusion of this step + * @param constraint the constraint added in this step + */ + public ConstStepDefault(Conclusion conclusion, Constraint constraint) { + super(conclusion, constraint); + } + + /** + * Accepts a visitor. + * @param stepVisitor the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java b/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java index c167a26..488437e 100644 --- a/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java +++ b/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java @@ -1,18 +1,49 @@ package edu.kit.typicalc.model.step; +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; /** - * Models one step of the inference tree. Depending on the inference rule that is applied in - * a step, different subclasses of InferenceStep should be used. A step always contains the - * Constraint that is added to the set of constraints of the type inference algorithm because - * of this step and a Conclusion. The subclasses vary in the premise(s) they contain. + * Models one step of the inference tree. + * Depending on the inference rule that is applied in a step, + * different subclasses of InferenceStep should be used. + * A step always contains the Constraint that is added + * to the set of constraints of the type inference algorithm because + * of this step and a Conclusion. + * The subclasses vary in the premise(s) they contain. */ public abstract class InferenceStep { -// todo + private Conclusion conclusion; + private Constraint constraint; + + /** + * Initializes a new InferenceStep with the given values. + * @param conclusion the conclusion of this step + * @param constraint the constraint added in this step + */ + protected InferenceStep(Conclusion conclusion, Constraint constraint) { + this.conclusion = conclusion; + this.constraint = constraint; + } + + /** + * Getter for the Conclusion of this step. + * @return conclusion the conclusion of this step + */ + public Conclusion getConclusion() { + return conclusion; + } + + /** + * Getter for the Constraint added in this step. + * @return conclusion the constraint added in this step + */ + public Constraint getConstraint() { + return constraint; + } /** * Accepts a visitor. * @param stepVisitor the visitor that wants to visit this object */ public abstract void accept(StepVisitor stepVisitor); - -} \ No newline at end of file +} diff --git a/src/main/java/edu/kit/typicalc/model/step/LetStepDefault.java b/src/main/java/edu/kit/typicalc/model/step/LetStepDefault.java index c07affe..5bfdd23 100644 --- a/src/main/java/edu/kit/typicalc/model/step/LetStepDefault.java +++ b/src/main/java/edu/kit/typicalc/model/step/LetStepDefault.java @@ -1,4 +1,32 @@ package edu.kit.typicalc.model.step; -public class LetStepDefault { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; +import edu.kit.typicalc.model.TypeInfererLet; + +/** + * Models one step of the inference tree where the let rule is applied. + */ +public class LetStepDefault extends LetStep { + /** + * Initializes a new LetStep with the given values. + * @param conclusion the conclusion of this step + * @param constraint the constraint added in this step + * @param premise the right premise of this step + * @param typeInferer the typeInferer that performs the Type Inference for the premise + * that needs its own type Inference. + */ + public LetStepDefault(Conclusion conclusion, Constraint constraint, InferenceStep premise, + TypeInfererLet typeInferer) { + super(conclusion, constraint, premise, typeInferer); + } + + /** + * Accepts a visitor. + * @param stepVisitor the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/model/step/StepVisitor.java b/src/main/java/edu/kit/typicalc/model/step/StepVisitor.java index d3702be..5469aaf 100644 --- a/src/main/java/edu/kit/typicalc/model/step/StepVisitor.java +++ b/src/main/java/edu/kit/typicalc/model/step/StepVisitor.java @@ -9,43 +9,43 @@ public interface StepVisitor { * Visits an AbsStepDefault. * @param absD the AbsStepDefault to visit */ - void visitAbsStepDefault(AbsStepDefault absD); + void visit(AbsStepDefault absD); /** * Visits an AbsStepWithLet. * @param absL the AbsStepWithLet to visit */ - void visitAbsStepWithLet(AbsStepWithLet absL); + void visit(AbsStepWithLet absL); /** * Visits an AppStepDefault. * @param appD the AppStepDefault to visit */ - void visitAppStepDefault(AppStepDefault appD); + void visit(AppStepDefault appD); /** * ConstStepDefault. * @param constD the ConstStepDefault to visit */ - void visitConstStepDefault(ConstStepDefault constD); + void visit(ConstStepDefault constD); /** * Visits a VarStepDefault. * @param varD the VarStepDefault to visit */ - void visitVarStepDefault(VarStepDefault varD); + void visit(VarStepDefault varD); /** * Visits a VarStepWithLet. * @param varL the VarStepWithLet to visit */ - void visitVarStepWithLet(VarStepWithLet varL); + void visit(VarStepWithLet varL); /** * Visits a LetStepDefault. * @param letD the LetStepDefault to visit */ - void visitLetStepDefault(LetStepDefault letD); + void visit(LetStepDefault letD); diff --git a/src/main/java/edu/kit/typicalc/model/step/VarStepDefault.java b/src/main/java/edu/kit/typicalc/model/step/VarStepDefault.java index a171b9a..62c198c 100644 --- a/src/main/java/edu/kit/typicalc/model/step/VarStepDefault.java +++ b/src/main/java/edu/kit/typicalc/model/step/VarStepDefault.java @@ -1,4 +1,26 @@ package edu.kit.typicalc.model.step; -public class VarStepDefault { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; +import edu.kit.typicalc.model.type.TypeAbstraction; + +public class VarStepDefault extends VarStep { + /** + * Initializes a new VarStep with the given values. + * @param conclusion the conclusion of this step + * @param constraint the constraint added in this step + * @param typeAbstractionInPremise the type abstraction in the premise of this step + */ + public VarStepDefault(Conclusion conclusion, Constraint constraint, TypeAbstraction typeAbstractionInPremise) { + super(conclusion, constraint, typeAbstractionInPremise); + } + + /** + * Accepts a visitor. + * @param stepVisitor the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/model/step/VarStepWithLet.java b/src/main/java/edu/kit/typicalc/model/step/VarStepWithLet.java index db53b05..134cf31 100644 --- a/src/main/java/edu/kit/typicalc/model/step/VarStepWithLet.java +++ b/src/main/java/edu/kit/typicalc/model/step/VarStepWithLet.java @@ -1,4 +1,26 @@ package edu.kit.typicalc.model.step; -public class VarStepWithLet { +import edu.kit.typicalc.model.Conclusion; +import edu.kit.typicalc.model.Constraint; +import edu.kit.typicalc.model.type.TypeAbstraction; + +public class VarStepWithLet extends VarStep { + /** + * Initializes a new VarStep with the given values. + * @param conclusion the conclusion of this step + * @param constraint the constraint added in this step + * @param typeAbstractionInPremise the type abstraction in the premise of this step + */ + public VarStepWithLet(Conclusion conclusion, Constraint constraint, TypeAbstraction typeAbstractionInPremise) { + super(conclusion, constraint, typeAbstractionInPremise); + } + + /** + * Accepts a visitor. + * @param stepVisitor the visitor that wants to visit this object + */ + @Override + public void accept(StepVisitor stepVisitor) { + stepVisitor.visit(this); + } } diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/LatexCreator.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/LatexCreator.java index 7de2190..e9b9457 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/LatexCreator.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/LatexCreator.java @@ -90,44 +90,44 @@ public class LatexCreator implements StepVisitor, TermVisitor, TypeVisitor { } @Override - public void visitAbsStepDefault(AbsStepDefault absD) { + public void visit(AbsStepDefault absD) { generateConclusion(absD, LABEL_ABS, UIC); } @Override - public void visitAbsStepWithLet(AbsStepWithLet absL) { + public void visit(AbsStepWithLet absL) { generateConclusion(absL, LABEL_ABS, UIC); } @Override - public void visitAppStepDefault(AppStepDefault appD) { + public void visit(AppStepDefault appD) { generateConclusion(appD, LABEL_APP, UIC); } @Override - public void visitConstStepDefault(ConstStepDefault constD) { + public void visit(ConstStepDefault constD) { generateConclusion(constD, LABEL_CONST, UIC); } @Override - public void visitVarStepDefault(VarStepDefault varD) { + public void visit(VarStepDefault varD) { generateConclusion(varD, LABEL_VAR, UIC); } @Override - public void visitVarStepWithLet(VarStepWithLet varL) { + public void visit(VarStepWithLet varL) { generateConclusion(varL, LABEL_VAR, UIC); } @Override - public void visitLetStepDefault(LetStepDefault letD) { + public void visit(LetStepDefault letD) { generateConclusion(letD, LABEL_LET, UIC); }