1 of 5

ModuleManager’s AML

:AvailableModulesList

availableModuleList: ModuleList

When we add a module to the Module Manager’s available module list,

we create a NewModule and we add it into ModuleManager’s AML and the availableModuleList which is in the AML and is a class-level ModuleList.

E.g: we add CS2113

CS2113:NewModule

2 of 5

When we add a module to the Module Manager’s available module list,

we create a NewModule and we add it into ModuleManager’s AML and the availableModuleList which is in the AML and is a class-level ModuleList.

E.g: we add CS2113

ModuleManager’s AML

:AvailableModulesList

availableModuleList: ModuleList

CS2113:NewModule

CS2113:NewModule

3 of 5

I notice that you write a getModule() method in AvailableModulesList

this method returns a module actually from the availableModuleList.

E.g. if the moduleIdentifier is CS2113, getModule() returns the blue one.

ModuleManager’s AML

:AvailableModulesList

availableModuleList: ModuleList

CS2113:NewModule

CS2113:NewModule

4 of 5

When we want to remove the module in the execute() method:

“availableModulesList.remove(moduleChosen)”,

here the “availableModulesList” is the ModuleManager’s AML in the right picture and the moduleChosen is the blue one in the right picture.

Actually this line trys to remove the chosen module in the list of ModuleManager’s AML (i.e. The circled area).

Luckily, we have the red one which is the same as blue one, so we can remove the red one from the list of MM’s AML

ModuleManager’s AML

:AvailableModulesList

availableModuleList: ModuleList

CS2113:NewModule

CS2113:NewModule

5 of 5

But now, we still keep the blue one in the availableModulesList.

We need to remove the blue one too.

So that is the reason why we need to override the remove method.

ModuleManager’s AML

:AvailableModulesList

availableModuleList: ModuleList

CS2113:NewModule