From a25ea3878d8c772dae21e18b412a12935dadccdf Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 23 Sep 2022 09:00:22 +0200 Subject: [PATCH] Fix BuildPlan --- src/de/steamwar/linkage/plan/BuildPlan.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/de/steamwar/linkage/plan/BuildPlan.java b/src/de/steamwar/linkage/plan/BuildPlan.java index d53eeb8..ac2c06f 100644 --- a/src/de/steamwar/linkage/plan/BuildPlan.java +++ b/src/de/steamwar/linkage/plan/BuildPlan.java @@ -33,7 +33,7 @@ public class BuildPlan implements Writer { private Set imports = new HashSet<>(); private final String className; - private Map fieldBuilderMap = new HashMap<>(); + private List fieldBuilders = new ArrayList<>(); private Map methodBuilderMap = new HashMap<>(); private List staticLines = new ArrayList<>(); @@ -42,15 +42,7 @@ public class BuildPlan implements Writer { } public void addField(FieldBuilder fieldBuilder) { - fieldBuilderMap.putIfAbsent(fieldBuilder.getType(), fieldBuilder); - } - - public boolean hasField(String type) { - return fieldBuilderMap.containsKey(type); - } - - public String getFieldName(String type) { - return fieldBuilderMap.get(type).getFieldName(); + fieldBuilders.add(fieldBuilder); } public void addMethod(MethodBuilder methodBuilder) { @@ -76,8 +68,8 @@ public class BuildPlan implements Writer { } writer.write("\n"); writer.write("public class " + className + " {\n"); - if (!fieldBuilderMap.isEmpty()) { - for (FieldBuilder fieldBuilder : fieldBuilderMap.values()) { + if (!fieldBuilders.isEmpty()) { + for (FieldBuilder fieldBuilder : fieldBuilders) { fieldBuilder.write(writer); } writer.write("\n");