epsilonlabs / emc-ptcim

EMC driver for the PTC Integrity Modeler
Eclipse Public License 1.0
2 stars 0 forks source link

Iteration error for associations that can return an element or a collection #9

Closed arcanefoam closed 8 years ago

arcanefoam commented 8 years ago

There are some associations that can return an element or a list, e.g. Projects.Active Dictionary Item

A relationship with the Dictionary Item that currently has the focus in Modeler. If a symbol on a diagram has the focus, a relationship with the dictionary item that is the under-lying dictionary item for that symbol. If you select multiple items in the active pane, Active Dictionary Item is a relationship with all the selected items. Multiplicity is 0+, access is read-only.

In this case, when there is only one selected element, we would expect the returned value to be a collection. However, invoking "MoreItems" on this element returns false and thus the hasNext() method of the collection's iterator returns false. However, in java the iterator of a collection with one element returns true for the same method.

More tests are needed to understand the duplicity of these associations, but for the time being the iterator can take into consideration the case in which the size is 1 an wok properly.

arcanefoam commented 8 years ago

The String representation in the debugger, which uses the iterator, provides the correct representation, so it seems it is perhaps more of a problem of the collection not being reseted properly

arcanefoam commented 8 years ago

This was a bogus behaviour. Not reproducible.