mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Formatting: tabs -> spaces
This commit is contained in:
parent
b716b204b3
commit
e25a947621
@ -11,12 +11,13 @@ public interface TermVisitorTree {
|
||||
* Returns an {@link edu.kit.typicalc.model.step.AppStep} suiting the given application (lambda term)
|
||||
* to type-infer and the type assumptions to consider.
|
||||
* Simultaneously assembles the tree's constraint list.
|
||||
*
|
||||
* @param appTerm the application (lambda term) to build the inference step structure for,
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* @param typeAssumptions the type assumptions to consider,
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* @param conclusionType the type that the lambda term in the conclusion
|
||||
* of the returned inference step will be assigned
|
||||
* of the returned inference step will be assigned
|
||||
* @return an {@link edu.kit.typicalc.model.step.AppStep}
|
||||
*/
|
||||
InferenceStep visit(AppTerm appTerm, Map<VarTerm, TypeAbstraction> typeAssumptions, Type conclusionType);
|
||||
@ -25,12 +26,13 @@ public interface TermVisitorTree {
|
||||
* Returns an {@link edu.kit.typicalc.model.step.AbsStep} suiting the given abstraction (lambda term)
|
||||
* to type-infer and the type assumptions to consider.
|
||||
* Simultaneously assembles the tree's constraint list.
|
||||
*
|
||||
* @param absTerm the abstraction (lambda term) to build the inference step structure for,
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* @param typeAssumptions the type assumptions to consider,
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* @param conclusionType the type that the lambda term in the conclusion
|
||||
* of the returned inference step will be assigned
|
||||
* of the returned inference step will be assigned
|
||||
* @return an {@link edu.kit.typicalc.model.step.AbsStep}
|
||||
*/
|
||||
InferenceStep visit(AbsTerm absTerm, Map<VarTerm, TypeAbstraction> typeAssumptions, Type conclusionType);
|
||||
@ -39,12 +41,13 @@ public interface TermVisitorTree {
|
||||
* Returns an {@link edu.kit.typicalc.model.step.LetStep} suiting the given let expression (lambda term)
|
||||
* to type-infer and the type assumptions to consider.
|
||||
* Simultaneously assembles the tree's constraint list.
|
||||
*
|
||||
* @param letTerm the let expression (lambda term) to build the inference step structure for,
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* @param typeAssumptions the type assumptions to consider,
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* @param conclusionType the type that the lambda term in the conclusion
|
||||
* of the returned inference step will be assigned
|
||||
* of the returned inference step will be assigned
|
||||
* @return an {@link edu.kit.typicalc.model.step.LetStep}
|
||||
*/
|
||||
InferenceStep visit(LetTerm letTerm, Map<VarTerm, TypeAbstraction> typeAssumptions, Type conclusionType);
|
||||
@ -53,12 +56,13 @@ public interface TermVisitorTree {
|
||||
* Returns an {@link edu.kit.typicalc.model.step.ConstStep} suiting the given constant
|
||||
* to type-infer and the type assumptions to consider.
|
||||
* Simultaneously assembles the tree's constraint list.
|
||||
*
|
||||
* @param constTerm the constant to build the inference step structure for,
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* @param typeAssumptions the type assumptions to consider,
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* @param conclusionType the type that the lambda term in the conclusion
|
||||
* of the returned inference step will be assigned
|
||||
* of the returned inference step will be assigned
|
||||
* @return an {@link edu.kit.typicalc.model.step.ConstStep}
|
||||
*/
|
||||
InferenceStep visit(ConstTerm constTerm, Map<VarTerm, TypeAbstraction> typeAssumptions, Type conclusionType);
|
||||
@ -67,12 +71,13 @@ public interface TermVisitorTree {
|
||||
* Returns an {@link edu.kit.typicalc.model.step.VarStep} suiting the given variable (lambda term)
|
||||
* to type-infer and the type assumptions to consider.
|
||||
* Simultaneously assembles the tree's constraint list.
|
||||
*
|
||||
* @param varTerm the variable (lambda term) to build the inference step structure for,
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* i.e. the lambda term in the conclusion of the returned inference step
|
||||
* @param typeAssumptions the type assumptions to consider,
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* i.e. the type assumptions in the conclusion of the returned inference step
|
||||
* @param conclusionType the type that the lambda term in the conclusion
|
||||
* of the returned inference step will be assigned
|
||||
* of the returned inference step will be assigned
|
||||
* @return an {@link edu.kit.typicalc.model.step.VarStep}
|
||||
*/
|
||||
InferenceStep visit(VarTerm varTerm, Map<VarTerm, TypeAbstraction> typeAssumptions, Type conclusionType)
|
||||
|
@ -9,121 +9,121 @@ import java.util.Objects;
|
||||
* Models a simple named type.
|
||||
*/
|
||||
public class NamedType extends Type {
|
||||
/**
|
||||
* boolean type
|
||||
*/
|
||||
public static final NamedType BOOLEAN = new NamedType("boolean");
|
||||
/**
|
||||
* int type
|
||||
*/
|
||||
public static final NamedType INT = new NamedType("int");
|
||||
/**
|
||||
* boolean type
|
||||
*/
|
||||
public static final NamedType BOOLEAN = new NamedType("boolean");
|
||||
/**
|
||||
* int type
|
||||
*/
|
||||
public static final NamedType INT = new NamedType("int");
|
||||
|
||||
private final String name;
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Initializes a new NamedType with the given name.
|
||||
* @param name the name of this type
|
||||
*/
|
||||
public NamedType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* Initializes a new NamedType with the given name.
|
||||
* @param name the name of this type
|
||||
*/
|
||||
public NamedType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the named type.
|
||||
* @return the name of this type
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Returns the name of the named type.
|
||||
* @return the name of this type
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether some type occurs in this type.
|
||||
* @param x the type to look for
|
||||
* @return whether the specified type is equal to this type
|
||||
*/
|
||||
public boolean contains(Type x) {
|
||||
return this.equals(x);
|
||||
}
|
||||
/**
|
||||
* Checks whether some type occurs in this type.
|
||||
* @param x the type to look for
|
||||
* @return whether the specified type is equal to this type
|
||||
*/
|
||||
public boolean contains(Type x) {
|
||||
return this.equals(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Substitutes a type variable for a different type.
|
||||
* @param a the type to replace
|
||||
* @param b the type to insert
|
||||
* @return itself, or b if a is equal to this object
|
||||
*/
|
||||
@Override
|
||||
public Type substitute(TypeVariable a, Type b) {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Substitutes a type variable for a different type.
|
||||
* @param a the type to replace
|
||||
* @param b the type to insert
|
||||
* @return itself, or b if a is equal to this object
|
||||
*/
|
||||
@Override
|
||||
public Type substitute(TypeVariable a, Type b) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts a visitor.
|
||||
* @param typeVisitor the visitor that wants to visit this
|
||||
*/
|
||||
@Override
|
||||
public void accept(TypeVisitor typeVisitor) {
|
||||
typeVisitor.visit(this);
|
||||
}
|
||||
/**
|
||||
* Accepts a visitor.
|
||||
* @param typeVisitor the visitor that wants to visit this
|
||||
*/
|
||||
@Override
|
||||
public void accept(TypeVisitor typeVisitor) {
|
||||
typeVisitor.visit(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with
|
||||
* another. This method uses the constrainEqualToNamedType method on the other
|
||||
* type.
|
||||
* @param type the other type
|
||||
* @return unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualTo(Type type) {
|
||||
return type.constrainEqualToNamedType(this);
|
||||
}
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with
|
||||
* another. This method uses the constrainEqualToNamedType method on the other
|
||||
* type.
|
||||
* @param type the other type
|
||||
* @return unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualTo(Type type) {
|
||||
return type.constrainEqualToNamedType(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with a
|
||||
* function type.
|
||||
* @param type the function type
|
||||
* @return unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualToFunction(FunctionType type) {
|
||||
return UnificationUtil.functionNamed(type, this);
|
||||
}
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with a
|
||||
* function type.
|
||||
* @param type the function type
|
||||
* @return unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualToFunction(FunctionType type) {
|
||||
return UnificationUtil.functionNamed(type, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with a
|
||||
* named type.
|
||||
* @param type the named type
|
||||
* @return unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualToNamedType(NamedType type) {
|
||||
return UnificationUtil.namedNamed(this, type);
|
||||
}
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with a
|
||||
* named type.
|
||||
* @param type the named type
|
||||
* @return unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualToNamedType(NamedType type) {
|
||||
return UnificationUtil.namedNamed(this, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with a
|
||||
* type variable.
|
||||
* @param type the type variable
|
||||
* @return the unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualToVariable(TypeVariable type) {
|
||||
return UnificationUtil.variableNamed(type, this);
|
||||
}
|
||||
/**
|
||||
* Computes the necessary constraints (and substitution) to unify this type with a
|
||||
* type variable.
|
||||
* @param type the type variable
|
||||
* @return the unification steps necessary, or an error if that is impossible
|
||||
*/
|
||||
@Override
|
||||
public Result<UnificationActions, UnificationError> constrainEqualToVariable(TypeVariable type) {
|
||||
return UnificationUtil.variableNamed(type, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NamedType namedType = (NamedType) o;
|
||||
return Objects.equals(name, namedType.name);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NamedType namedType = (NamedType) o;
|
||||
return Objects.equals(name, namedType.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
}
|
||||
|
@ -4,21 +4,21 @@ package edu.kit.typicalc.model.type;
|
||||
* Can be implemented to process Type objects.
|
||||
*/
|
||||
public interface TypeVisitor {
|
||||
/**
|
||||
* Visit a named type.
|
||||
* @param named the type to be visited
|
||||
*/
|
||||
void visit(NamedType named);
|
||||
/**
|
||||
* Visit a named type.
|
||||
* @param named the type to be visited
|
||||
*/
|
||||
void visit(NamedType named);
|
||||
|
||||
/**
|
||||
* Visit a type variable
|
||||
* @param variable the variable to be visited
|
||||
*/
|
||||
void visit(TypeVariable variable);
|
||||
/**
|
||||
* Visit a type variable
|
||||
* @param variable the variable to be visited
|
||||
*/
|
||||
void visit(TypeVariable variable);
|
||||
|
||||
/**
|
||||
* Visit a function.
|
||||
* @param function the function to be visited
|
||||
*/
|
||||
void visit(FunctionType function);
|
||||
/**
|
||||
* Visit a function.
|
||||
* @param function the function to be visited
|
||||
*/
|
||||
void visit(FunctionType function);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class DrawerContent extends VerticalLayout implements LocaleChangeObserve
|
||||
private static final long serialVersionUID = -5751275682270653335L;
|
||||
|
||||
/*
|
||||
* Id's for the imported css-file
|
||||
* IDs for the imported CSS file
|
||||
*/
|
||||
private static final String RULE_CONTAINER_ID = "ruleContainer";
|
||||
private static final String DRAWER_CONTENT_ID = "drawerContent";
|
||||
@ -30,16 +30,16 @@ public class DrawerContent extends VerticalLayout implements LocaleChangeObserve
|
||||
}
|
||||
|
||||
private void initRuleContainer() {
|
||||
//TODO just demo content, exchange with correct rules
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
//TODO just demo content, exchange with correct rules
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
ruleContainer.add(new InferenceRuleField(getTranslation("abs-rule"), "root.absRule"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void localeChange(LocaleChangeEvent event) {
|
||||
heading.setText(getTranslation("root.inferenceRules"));
|
||||
heading.setText(getTranslation("root.inferenceRules"));
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,10 @@ import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||
|
||||
@CssImport("./styles/view/main/help-dialog.css")
|
||||
public class HelpDialog extends Dialog implements LocaleChangeObserver {
|
||||
|
||||
private static final long serialVersionUID = 4470277770276296164L;
|
||||
|
||||
/*
|
||||
* Id's for the imported css-file
|
||||
* IDs for the imported CSS file
|
||||
*/
|
||||
private static final String HEADING_LAYOUT_ID = "headingLayout";
|
||||
private static final String CONTENT_LAYOUT_ID = "contentLayout";
|
||||
@ -24,21 +23,21 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
|
||||
private final H5 inputSyntax;
|
||||
|
||||
public HelpDialog() {
|
||||
final HorizontalLayout headingLayout = new HorizontalLayout();
|
||||
heading = new H3(getTranslation("root.operatingHelp"));
|
||||
headingLayout.setId(HEADING_LAYOUT_ID);
|
||||
headingLayout.add(heading);
|
||||
final HorizontalLayout headingLayout = new HorizontalLayout();
|
||||
heading = new H3(getTranslation("root.operatingHelp"));
|
||||
headingLayout.setId(HEADING_LAYOUT_ID);
|
||||
headingLayout.add(heading);
|
||||
|
||||
final VerticalLayout contentLayout = new VerticalLayout();
|
||||
inputSyntax = new H5(getTranslation("root.inputSyntax"));
|
||||
contentLayout.setId(CONTENT_LAYOUT_ID);
|
||||
contentLayout.add(inputSyntax);
|
||||
add(headingLayout, contentLayout);
|
||||
final VerticalLayout contentLayout = new VerticalLayout();
|
||||
inputSyntax = new H5(getTranslation("root.inputSyntax"));
|
||||
contentLayout.setId(CONTENT_LAYOUT_ID);
|
||||
contentLayout.add(inputSyntax);
|
||||
add(headingLayout, contentLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void localeChange(LocaleChangeEvent event) {
|
||||
heading.setText(getTranslation("root.operatingHelp"));
|
||||
inputSyntax.setText(getTranslation("root.inputSyntax"));
|
||||
heading.setText(getTranslation("root.operatingHelp"));
|
||||
inputSyntax.setText(getTranslation("root.inputSyntax"));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||
*/
|
||||
@CssImport("./styles/view/main/input-bar.css")
|
||||
public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
|
||||
private static final long serialVersionUID = -6099700300418752958L;
|
||||
|
||||
/*
|
||||
@ -42,12 +41,12 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
|
||||
/**
|
||||
* Creates an InputBar with a Consumer-object to call the inferType()-method in UpperBar.
|
||||
* The current user input is passed as the methods argument.
|
||||
* The current user input is passed as the methods argument.
|
||||
*
|
||||
* @param callback Consumer to call the inferType()-method in UpperBar
|
||||
*/
|
||||
protected InputBar(final Consumer<String> callback) {
|
||||
infoIcon = new Icon(VaadinIcon.INFO_CIRCLE);
|
||||
infoIcon = new Icon(VaadinIcon.INFO_CIRCLE);
|
||||
// TODO: where is this tooltip supposed to show up? next to icon, currently not working
|
||||
infoTooltip = new Tooltip(infoIcon, TooltipPosition.LEFT, TooltipAlignment.LEFT);
|
||||
infoTooltip.add(new H5("Hallo"));
|
||||
@ -93,7 +92,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
}
|
||||
|
||||
private void initInfoTooltip() {
|
||||
infoTooltip.add(new H5("Hallo"));
|
||||
infoTooltip.add(new H5("Hallo"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ import edu.kit.typicalc.view.content.typeinferencecontent.TypeInferenceView;
|
||||
|
||||
/**
|
||||
* Contains all the displayed components and builds the applications user interface (UI).
|
||||
* Vaadins app layout provides the rough structure of the UI. Using this structure the UI always
|
||||
* Vaadin's app layout provides the rough structure of the UI. Using this structure the UI always
|
||||
* consists of an upper bar at the top of the screen and a drawer on the left side of
|
||||
* the screen.
|
||||
*/
|
||||
@ -28,7 +28,6 @@ import edu.kit.typicalc.view.content.typeinferencecontent.TypeInferenceView;
|
||||
@JsModule("./styles/shared-styles.js")
|
||||
@JavaScript("./src/tex-svg-full.js")
|
||||
public class MainViewImpl extends AppLayout implements MainView {
|
||||
|
||||
private static final long serialVersionUID = -2411433187835906976L;
|
||||
|
||||
/**
|
||||
@ -48,8 +47,8 @@ public class MainViewImpl extends AppLayout implements MainView {
|
||||
|
||||
@Override
|
||||
public void displayError(final ParseError error) {
|
||||
//TODO add error keys to bundle
|
||||
final VerticalLayout container = new VerticalLayout();
|
||||
//TODO add error keys to bundle
|
||||
final VerticalLayout container = new VerticalLayout();
|
||||
final Span errorText = new Span(getTranslation("root." + error.toString()));
|
||||
final Notification errorNotification = new Notification();
|
||||
final Button closeButton = new Button(getTranslation("root.close"), event -> errorNotification.close());
|
||||
|
Loading…
Reference in New Issue
Block a user