package users; import java.util.Collection; /** * UserDB acts as a database for all users who utilize the Test Tool. Users are defined in Section 2.1 of the requirements documentation. */ public abstract class UserDB { /** * A collection of users. */ Collection users; /** * Default constructor for a UserDB object. */ public UserDB() { } /** * Adds a user to the user database * @param u A user to add to the database * pre: // the userdb does not contain u (!users.contains(u)); post: // the user u must be in the users list // and the size of the users list must be one larger. (users'.contains(u)) && (users'.size() == users.size() + 1); */ public abstract void addUser(User u); /** * Removes a user from the user database * @param u A suer to remove from the database * pre: // the userdb does contains u (users.contains(u)); post: // the user u must not be in the user list // and the size of the users list must be one smaller. (!users'.contains(u)) && (users'.size() == users.size() - 1); */ public abstract void removeUser(User u); /** * Edits a user from the user database * @param u The user being edited * pre: // the userdb does contains user u (users.contains(u)); */ public abstract void editUser(User u); /** * Finds a user object in the userDB by userid * @param id The id of the user to get * @return User who's id is the same as the parameter * pre: // the UserID id must match an existing user in the userdb exists(User u ; users.contains(u) ; u.userID.equals(id)); post: // the return value must be a user object from the user database (users.contains(return)); */ public abstract User getUser(UserID id); }