qsim "activity components" as List or as Set?

Description

Sebastian, Michał,

accepts List as an argument. I.e. arguments can exist multiple times.

However, it fails later when it is attempted to install the same module twice.

It looks a bit like the latter restriction was introduced later by Michał. So I am wondering a bit what is the design decision. Should it be possible to request the same module twice, or not?

Note that for "strategies", where we are using the same dialect (register to strategy manager, and request via config), it is possible to register the same strategy twice, and with good reasons.

So the questions are:

  • Michał, have you encountered situations where multiple requests of the same module were bad? Could you please report a bit?

  • Sebastian, have you deliberately allowed for multiple requests of the same module? Or was that more by accident or because it already existed like that from before?

Thanks ...
[Created via e-mail received from: "Nagel, Kai, Prof. Dr." <nagel@vsp.tu-berlin.de>]

Environment

None

Activity

Show:
Michal Maciejewski
November 16, 2019, 11:20 AM

It looks a bit like the latter restriction was introduced later by Michał.

I only fixed the way “uniqueness” was being verified. Guice does a lot of tricks when checking equality of annotated bindings, so the only way to do this, without mimicking (“hacking”) the internals of guice, was to create Keys (Key.get(Object.class, annotation)) and use them for those checks.

So I am wondering a bit what is the design decision. Should it be possible to request the same module twice, or not?

The idea is to activate QSim components annotated with specific annotations (according to the list order). So it is enough to do have this component only once on the list of active components.

 

 

Kai Nagel
November 16, 2019, 11:25 AM

Ok so I guess using List instead of Set in QSimComponentsConfigGroup is rather an accident than design?

 

Michal Maciejewski
November 16, 2019, 11:35 AM
Edited

Despite having only one annotation (“component name”) on the list of active components, you can have more than one QSim component annotated with the same annotation. For each DVRP mode there are many QSim components (like passenger engine, optimizer, some listeners etc.) annotated the same DvrpMode(mode) annotation.

Seems that the naming is really misleading, as QSimComponentsConfigGroup#setActiveComponents(...) takes a list of Strings that are (supposed to be) later converted into Named annotations. But it is not a list of actual QSim components.

 

Michal Maciejewski
November 16, 2019, 11:39 AM

And there is also QSimComponentsConfig.addComponent() that accepts all annotations (not only Named)

Michal Maciejewski
November 16, 2019, 12:07 PM

Ok so I guess using List instead of Set in QSimComponentsConfigGroup is rather an accident than design?

It is somehow in between. Ordered as List and without duplicates as Set. I would keep it as List and fail on duplicates (because it is not clear which duplicated entry should be removed, as the order matters).

Assignee

Sebastian Hörl

Reporter

Kai Nagel

Labels

None

Priority

Major
Configure