From 5dd3f0f969854e1f793166dee7c92a89615f18d2 Mon Sep 17 00:00:00 2001 From: Johanna Stuber Date: Wed, 27 Jan 2021 20:17:30 +0100 Subject: [PATCH] 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) { + + } }