From 58d757398d0c44198ec53750feced0e4aa70cfc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Fri, 11 Jan 2019 23:00:27 +0100 Subject: [PATCH] modified: ../../../main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/model/PlaceholderType.java zurueck zum alten Zustand --- .../syntaxtree/factory/UnifyTypeFactory.java | 2 +- .../unify/model/PlaceholderType.java | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) 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; }