diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-02-16 13:26:43 -0500 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-02-16 13:26:43 -0500 |
commit | a4aa226955df2284a298b6ae35ee72d4996978a3 (patch) | |
tree | aad3d8d420402298a112dc3c4952599f4aba6d4d /ufund-api/src/main/java/com/ufund/api/ufundapi/model | |
parent | b7c662afadf531eae34c5044c50c7b5c5330345b (diff) | |
download | JellySolutions-a4aa226955df2284a298b6ae35ee72d4996978a3.tar.gz JellySolutions-a4aa226955df2284a298b6ae35ee72d4996978a3.tar.bz2 JellySolutions-a4aa226955df2284a298b6ae35ee72d4996978a3.zip |
Implement FileDAO
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/model')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/model/Cupboard.java | 2 | ||||
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Cupboard.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Cupboard.java index de1695a..a626561 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Cupboard.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Cupboard.java @@ -34,7 +34,7 @@ public class Cupboard { public void removeNeed(String name) throws IOException { for (Need need : getNeeds()) { if (need.getName().equals(name)) { - dao.deleteNeed(need.getID()); + dao.deleteNeed(need.getId()); return; } } diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java index df65032..9187796 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java @@ -14,6 +14,14 @@ public class Need { private double maxGoal; private double current; + /** + * Create a new need + * + * @param name The name of the need + * @param id The unique ID of the need + * @param maxGoal The maximum goal for this need + * @param type The type of need (monetary, physical) + */ public Need(String name, int id, double maxGoal, GoalType type) { this.id = id; this.name = name; @@ -21,11 +29,25 @@ public class Need { this.type = type; } + /** + * Create a deep copy of another need + * + * @param other The need to copy from + */ + public Need(Need other) { + this.name = other.name; + this.id = other.id; + this.filterAttributes = other.filterAttributes; + this.type = other.type; + this.maxGoal = other.maxGoal; + this.current = other.current; + } + public String getName() { return name; } - public int getID() { + public int getId() { return id; } |