This commit is contained in:
Jan-Philipp Luithardt
2025-12-03 11:04:32 +01:00
parent 6992100fff
commit e8a1f161b4
46 changed files with 312 additions and 56 deletions

View File

@@ -3,11 +3,8 @@ package hhn.temp.project;
public class Main {
public void Main() {
// public void Main() {
//
// }
}
public String loadString() {
return "test";
}
}

View File

@@ -0,0 +1,65 @@
package hhn.temp.project;
public class Task {
private String name;
private String description;
private TaskStatus taskStatus;
private int taskID;
private static int idCounter = 0;
public Task(String name, String description) {
if (name == null || description == null ) {
throw new IllegalArgumentException("Name/Description is null!");
}
if(name.isEmpty() || description.isEmpty()) {
throw new IllegalArgumentException("Name/Description is empty!");
}
this.name = name;
this.description = description;
this.taskStatus = TaskStatus.OPEN;
//TODO when DB then auto IDs
this.taskID = idCounter++;
}
public int getTaskID() {
return taskID;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public TaskStatus getStatus() {
return taskStatus;
}
public void setDescription(String description) {
if (description == null ) {
throw new IllegalArgumentException("Description is null!");
}
if(description.isEmpty()) {
throw new IllegalArgumentException("Description is empty!");
}
this.description = description;
}
public void setStatus(TaskStatus taskStatus) {
if (taskStatus == null ) {
throw new IllegalArgumentException("TaskStatus is null!");
}
this.taskStatus = taskStatus;
}
}

View File

@@ -0,0 +1,20 @@
package hhn.temp.project;
import java.util.HashMap;
import java.util.Map;
public class TaskManager {
private Map<Integer, Task> taskMap;
public TaskManager() {
taskMap = new HashMap<>();
}
public Task createTask(String name, String description) {
Task task = new Task(name, description);
taskMap.put(task.getTaskID(), task);
return task;
}
}

View File

@@ -0,0 +1,5 @@
package hhn.temp.project;
public enum TaskStatus {
OPEN, CLOSED, IN_PROCESS
}