Design Pattern Examples
Overview of object-oriented design patterns
GroupList Class Reference

Represents a list of Groups. More...

Collaboration diagram for GroupList:
Collaboration graph

Public Member Functions

GroupFindGroup (string name)
 Retrieve the Group instance for the specified group name.
 
void AddGroup (string name)
 Add a group to the list using the given group name. Operation ignored if the group is already in the list.
 
void RemoveGroup (string name)
 Remove the specified group from the list. Operation ignored if the group is not in the list.
 

Properties

string[] GroupNames [get]
 The names of all groups contained in this list (read-only). The list is always sorted.
 

Private Attributes

List< Group_groups = new List<Group>()
 The list of groups.
 

Detailed Description

Represents a list of Groups.

This is a simple implementation using a simple list. It is NOT thread-safe.

Definition at line 146 of file Mediator_Group_Classes.cs.

Member Function Documentation

◆ AddGroup()

void AddGroup ( string  name)
inline

Add a group to the list using the given group name. Operation ignored if the group is already in the list.

Parameters
nameName of the group to add. Cannot be null or empty.
Exceptions
ArgumentNullExceptionThe group name cannot be null or empty.

Definition at line 190 of file Mediator_Group_Classes.cs.

References GroupList._groups.

Referenced by UserGroupMediator.AddGroup().

◆ FindGroup()

Group? FindGroup ( string  name)
inline

Retrieve the Group instance for the specified group name.

Parameters
nameGroup name to search for.
Returns
Returns a Group object if name found. Returns null if not found.

Definition at line 178 of file Mediator_Group_Classes.cs.

References GroupList._groups.

Referenced by GroupList.AddGroup(), UserGroupMediator.AddUserToGroup(), UserGroupMediator.GetGroupsWithUser(), UserGroupMediator.GetUsersInGroup(), UserGroupMediator.IsUserInGroup(), UserGroupMediator.RemoveUserFromAllGroups(), and UserGroupMediator.RemoveUserFromGroup().

◆ RemoveGroup()

void RemoveGroup ( string  name)
inline

Remove the specified group from the list. Operation ignored if the group is not in the list.

Parameters
nameName of the group to remove.

Definition at line 210 of file Mediator_Group_Classes.cs.

References GroupList._groups.

Referenced by UserGroupMediator.RemoveGroup().

Member Data Documentation

◆ _groups

List<Group> _groups = new List<Group>()
private

Property Documentation

◆ GroupNames

string [] GroupNames
get

The names of all groups contained in this list (read-only). The list is always sorted.

Definition at line 158 of file Mediator_Group_Classes.cs.

Referenced by UserGroupMediator.GetAllGroups(), UserGroupMediator.GetGroupsWithUser(), and UserGroupMediator.RemoveUserFromAllGroups().


The documentation for this class was generated from the following file: