Merge remote-tracking branch 'origin/master'

This commit is contained in:
uogau 2021-01-27 20:57:06 +01:00
commit 22f72620c5
5 changed files with 159 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -1,4 +1,7 @@
package edu.kit.typicalc.model.type;
public class TypeVariable {
public TypeVariable(int index) {
}
}

View File

@ -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);
}

View File

@ -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
}
}

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<property name="tabWidth" value="4"/>
<module name="JavadocType">
<property name="scope" value="package"/>
<!-->property name="allowUndeclaredRTE" value="true"/-->
<!-->property name="suppressLoadErrors" value="true"/-->
</module>
<module name="JavadocMethod">
<property name="scope" value="package"/>
</module>
<module name="JavadocVariable">
<property name="scope" value="public"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="ExecutableStatementCount">
<property name="max" value="20"/>
<property name="tokens" value="CTOR_DEF"/>
</module>
<module name="ExecutableStatementCount">
<property name="max" value="100"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="MethodLength"/>
<module name="AnonInnerLength">
<property name="max" value="60"/>
</module>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="INC,DEC,UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT"/>
</module>
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="WhitespaceAfter"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<!--<module name="DoubleCheckedLocking">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>-->
<module name="EmptyStatement"/>
<module name="IllegalCatch"/>
<module name="IllegalThrows"/>
<module name="InnerAssignment"/>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="ModifierOrder"/>
<module name="ClassTypeParameterName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName"/>
<module name="OuterTypeNumber"/>
<module name="MethodParamPad"/>
<module name="TypecastParenPad">
<property name="tokens" value="RPAREN,TYPECAST"/>
</module>
<module name="CovariantEquals"/>
<module name="DefaultComesLast"/>
<module name="MultipleVariableDeclarations"/>
<module name="PackageDeclaration"/>
<module name="ParameterAssignment"/>
</module>
<module name="LineLength">
<property name="max" value="120"/>
<property name="tabWidth" value="4"/>
</module>
<module name="Translation"/>
<module name="FileLength"/>
<!-- <module name="StrictDuplicateCode">
<property name="min" value="10"/>
</module> -->
</module>