diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index 326f5a77..743fbb74 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -120,7 +120,7 @@ public class UnifyTypeFactory { } public static UnifyType convert(TypePlaceholder tph){ - PlaceholderType ntph = PlaceholderType.convertTypePlaceholder(tph.getName());//eingefuegt PL 2019-01-11 //new PlaceholderType(tph.getName()); + PlaceholderType ntph = new PlaceholderType(tph.getName()); int in = PLACEHOLDERS.indexOf(ntph); if (in == -1) { PLACEHOLDERS.add(ntph); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/PlaceholderType.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/PlaceholderType.java index 23848ae6..09402c2f 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/PlaceholderType.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/PlaceholderType.java @@ -23,7 +23,7 @@ public final class PlaceholderType extends UnifyType{ * Static list containing the names of all existing placeholders. * Used for generating fresh placeholders. */ - public static final ArrayList EXISTING_PLACEHOLDERS = new ArrayList(); + public static final ArrayList EXISTING_PLACEHOLDERS = new ArrayList(); /** * Prefix of auto-generated placeholder names. @@ -60,28 +60,17 @@ public final class PlaceholderType extends UnifyType{ */ public PlaceholderType(String name) { super(name, new TypeParams()); + EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names IsGenerated = false; // This type is user generated } - public static PlaceholderType convertTypePlaceholder(String name) {//eingefuegt PL 2019-01-11 - PlaceholderType newTph = new PlaceholderType(name); - int i = EXISTING_PLACEHOLDERS.indexOf(newTph);//equals vergleicht den Namen - if (i == -1) { - EXISTING_PLACEHOLDERS.add(newTph); // Add to list of existing placeholder names - return newTph; - } - else { - return EXISTING_PLACEHOLDERS.get(i); - } - } - /** * Creates a new placeholdertype * @param isGenerated true if this placeholder is auto-generated, false if it is user-generated. */ protected PlaceholderType(String name, boolean isGenerated) { super(name, new TypeParams()); - EXISTING_PLACEHOLDERS.add(this); // Add to list of existing placeholder names + EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names IsGenerated = isGenerated; }