From ee694b8168dcdd5f58c76b55ae471a203fd84709 Mon Sep 17 00:00:00 2001 From: Lars Simon Winzer Date: Tue, 7 Apr 2026 13:30:09 +0200 Subject: [PATCH] Docs: Write JavaDoc for newly added methods --- .../server/domain/user/UserRegistry.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserRegistry.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserRegistry.java index b79bf69..2264805 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserRegistry.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/domain/user/UserRegistry.java @@ -31,6 +31,12 @@ public class UserRegistry { return Optional.of(user); } + /** + * Removes a user from the registry by user ID. + * + * @param userId the ID of the user to remove + * @return true if a user was removed, false if no user with that ID exists + */ public synchronized boolean removeByUserId(UserId userId) { User user = byId.get(userId); if (user == null) { @@ -42,6 +48,12 @@ public class UserRegistry { return true; } + /** + * Removes a user from the registry by session ID. + * + * @param sessionId the session ID associated with the user to remove + * @return true if a user was removed, false if no user with that session exists + */ public synchronized boolean removeBySessionId(SessionId sessionId) { User user = bySessionId.get(sessionId); if (user == null) { @@ -52,6 +64,12 @@ public class UserRegistry { return true; } + /** + * Removes a user from the registry by username. + * + * @param username the username associated with the user to remove + * @return true if a user was removed, false if no user with that session exists + */ public synchronized boolean removeByUsername(String username) { User user = byName.get(username); if (user == null) { @@ -62,6 +80,11 @@ public class UserRegistry { return true; } + /** + * Removes a user from the internals of the registry. + * + * @param user the user to remove + */ private synchronized void remove(User user) { byId.remove(user.getId()); byName.remove(user.getName());