Package kr.ac.konkuk.ccslab.cm.entity
Class CMMember
java.lang.Object
kr.ac.konkuk.ccslab.cm.entity.CMObject
kr.ac.konkuk.ccslab.cm.entity.CMMember
This class represents a list of users.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a user to this member list.findMember
(String name) Finds a member with a given name.Returns the Vector reference of this member list.int
Returns the number of current users in this member list.boolean
isEmpty()
Checks if the member list is empty or not.boolean
Checks if a given name is in this member list.boolean
Checks if a given user is in this member list.boolean
boolean
Removes all users in this member list.boolean
removeMember
(String name) Removes a user with the given name from this member list.boolean
removeMember
(CMUser user) Removes a user from this member list.boolean
removeMemberObject
(String name) boolean
removeMemberObject
(CMUser user) toString()
-
Constructor Details
-
CMMember
public CMMember()creates an instance of the CMMember class.
-
-
Method Details
-
addMember
Adds a user to this member list.- Parameters:
user
- - an added user.- Returns:
- true if the user is successfully added, or false.
-
removeMember
Removes a user from this member list.If the member list has a user object that has the same name as the given user.
- Parameters:
user
- - a removed user.- Returns:
- true if the user is successfully removed, or false.
-
removeMemberObject
-
removeMember
Removes a user with the given name from this member list.- Parameters:
name
- - the name of a removed user.- Returns:
- true if the user is successfully removed, or false.
-
removeMemberObject
-
removeAllMembers
public boolean removeAllMembers()Removes all users in this member list.- Returns:
- true if this member list is not empty and cleared; false if the list is already empty.
-
removeAllMemberObjects
public boolean removeAllMemberObjects() -
isMember
Checks if a given user is in this member list.The given user is regarded as a member if the list has a member with the same name.
- Parameters:
user
- - a given user.- Returns:
- true if the user is a member, or false.
-
isMember
Checks if a given name is in this member list.The given name is regarded as a member if the list has a member with the same name.
- Parameters:
name
- - a given name.- Returns:
- true if the name is a member, or false.
-
isEmpty
public boolean isEmpty()Checks if the member list is empty or not.- Returns:
- true if the member list is empty, or false.
-
findMember
Finds a member with a given name.- Parameters:
name
- - a member name- Returns:
- the user with the name if found; null otherwise.
-
getMemberNum
public int getMemberNum()Returns the number of current users in this member list.- Returns:
- the number of members.
-
getAllMembers
Returns the Vector reference of this member list.- Returns:
- the Vector of this member list.
-
toString
-