diff --git a/Roboterfabrik/src/Domäne/RobotFactory.java b/Roboterfabrik/src/Domäne/RobotFactory.java new file mode 100644 index 0000000..b311fc9 --- /dev/null +++ b/Roboterfabrik/src/Domäne/RobotFactory.java @@ -0,0 +1,30 @@ +package Domäne; + +import java.util.HashMap; + +public class RobotFactory { +private String name; +private HashMap roboters = new HashMap<>(); + +public RobotFactory (String name) { + this.name = name; +} + + public int addRoboter (RobotType robotType) { + Roboter roboter; + + if (RobotType.R2D2 == robotType) { + roboter = new R2D2 ("R2D2"); + roboters.put(roboter.getId(), roboter); + return roboter.getId(); + } + else if (RobotType.C3PO == robotType) { + roboter = new C3PO ("C3PO"); + roboters.put(roboter.getId(), roboter); + return roboter.getId(); + + } + else + return -1; + } +}