From 1cef080606fc4d7f588999cf9599a6beaedf52b9 Mon Sep 17 00:00:00 2001 From: Moritz Dieing <63721811+moritzdieing@users.noreply.github.com> Date: Wed, 27 Jan 2021 19:39:18 +0100 Subject: [PATCH 1/3] MainView erstellen --- .../edu/kit/typicalc/view/main/MainView.java | 26 +++++++++++++++++++ .../kit/typicalc/view/main/MainViewImpl.java | 14 +++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/main/java/edu/kit/typicalc/view/main/MainView.java diff --git a/src/main/java/edu/kit/typicalc/view/main/MainView.java b/src/main/java/edu/kit/typicalc/view/main/MainView.java new file mode 100644 index 0000000..b55a795 --- /dev/null +++ b/src/main/java/edu/kit/typicalc/view/main/MainView.java @@ -0,0 +1,26 @@ +package edu.kit.typicalc.view.main; + +import edu.kit.typicalc.model.TypeInfererInterface; +import edu.kit.typicalc.model.parser.ParseError; + +/** + * Provides an interface for the presenter to interact with the view. The interaction consists of + * either passing a TypeInfererInterface or a ParseError to the view. + */ +public interface MainView { + + /** + * Starts the creation of the visual representation of the provided typeInferer. + * After the process is finished, the first step of the type inference tree is displayed. + * + * @param typeInferer the result of the computation of the type inference algorithm + */ + void setTypeInferenceView(TypeInfererInterface typeInferer); + + /** + * Displays the provided error indicating syntactically invalid input. + * + * @param error the error which is displayed to indicate invalid input + */ + void displayError(ParseError error); +} diff --git a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java index a889d7f..60419dd 100644 --- a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java +++ b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java @@ -17,6 +17,8 @@ import com.vaadin.flow.component.tabs.Tabs; import com.vaadin.flow.component.tabs.TabsVariant; import com.vaadin.flow.router.PageTitle; import com.vaadin.flow.router.RouterLink; +import edu.kit.typicalc.model.TypeInfererInterface; +import edu.kit.typicalc.model.parser.ParseError; import edu.kit.typicalc.view.content.typeinferencecontent.TypeInferenceView; import java.util.Optional; @@ -26,7 +28,7 @@ import java.util.Optional; */ @CssImport("./styles/views/main/main-view.css") @JsModule("./styles/shared-styles.js") -public class MainViewImpl extends AppLayout { +public class MainViewImpl extends AppLayout implements MainView { private final Tabs menu; private H1 viewTitle; @@ -103,4 +105,14 @@ public class MainViewImpl extends AppLayout { private String getCurrentPageTitle() { return getContent().getClass().getAnnotation(PageTitle.class).value(); } + + @Override + public void setTypeInferenceView(TypeInfererInterface typeInferer) { + // TODO Auto-generated method stub + } + + @Override + public void displayError(ParseError error) { + // TODO Auto-generated method stub + } } From 70a97b4c83e878504c5abbb81e3bad868c8340ee Mon Sep 17 00:00:00 2001 From: Johanna Stuber Date: Wed, 27 Jan 2021 19:51:54 +0100 Subject: [PATCH 2/3] =?UTF-8?q?checkstyle=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/checkstyle_typicalc.xml | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 src/test/resources/checkstyle_typicalc.xml diff --git a/src/test/resources/checkstyle_typicalc.xml b/src/test/resources/checkstyle_typicalc.xml new file mode 100644 index 0000000..eeb91a6 --- /dev/null +++ b/src/test/resources/checkstyle_typicalc.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + property name="allowUndeclaredRTE" value="true"/--> + property name="suppressLoadErrors" value="true"/--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 5dd3f0f969854e1f793166dee7c92a89615f18d2 Mon Sep 17 00:00:00 2001 From: Johanna Stuber Date: Wed, 27 Jan 2021 20:17:30 +0100 Subject: [PATCH 3/3] TypeVariableFactory implementieren --- .../edu/kit/typicalc/model/TypeVariableFactory.java | 11 ++++++++--- .../edu/kit/typicalc/model/type/TypeVariable.java | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/model/TypeVariableFactory.java b/src/main/java/edu/kit/typicalc/model/TypeVariableFactory.java index 3a9669e..da28271 100644 --- a/src/main/java/edu/kit/typicalc/model/TypeVariableFactory.java +++ b/src/main/java/edu/kit/typicalc/model/TypeVariableFactory.java @@ -7,11 +7,15 @@ import edu.kit.typicalc.model.type.TypeVariable; */ public class TypeVariableFactory { + private static final int FIRST_VARIABLE_INDEX = 1; + + private int nextVariableIndex; + /** * Initializes a new type variable factory. */ protected TypeVariableFactory() { - // TODO + nextVariableIndex = FIRST_VARIABLE_INDEX; } /** @@ -20,7 +24,8 @@ public class TypeVariableFactory { * @return a new unique type variable */ public TypeVariable nextTypeVariable() { - return null; - // TODO + TypeVariable nextTypeVariable = new TypeVariable(nextVariableIndex); + nextVariableIndex++; + return nextTypeVariable; } } diff --git a/src/main/java/edu/kit/typicalc/model/type/TypeVariable.java b/src/main/java/edu/kit/typicalc/model/type/TypeVariable.java index 3c394fe..9e92658 100644 --- a/src/main/java/edu/kit/typicalc/model/type/TypeVariable.java +++ b/src/main/java/edu/kit/typicalc/model/type/TypeVariable.java @@ -1,4 +1,7 @@ package edu.kit.typicalc.model.type; public class TypeVariable { + public TypeVariable(int index) { + + } }