Community
Participate
Working Groups
Preserve the order of sub-objects in its containers in the following operations: Element::subobjects() : Set(Element) Element::subobjectsOfType(OclType) : Set(Element) Element::subobjectsOfKind(OclType) : Set(Element) Element::allSubobjectsOfKind(OclType) : Set(Element) The current implementation give random order, caused by using java HahSet implementation. Take into account the OCL runtime is based on java.util.HahSet being mapped to OCL Set type. Consider subclassing java.util.HashSet and used cached initial collection to preduce the iterator on sets. Making it readonly, as we can't really modify Sets in OCL should be a simplification.
I would recommend only giving a repeatable order when some -debug execution option has been requested.
It is tempting to just return an OrderedSet under the guise of a Set, but this won't work. See: On Better Understanding OCL Collections or An OCL Ordered Set is not an OCL Set Fabian B¨uttner, Martin Gogolla, Lars Hamann, Mirco Kuhlmann http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&ved=0CEgQFjAD&url=http%3A%2F%2Fwww.springerlink.com%2Findex%2F98l4826172434143.pdf&ei=sX1dUYqcN4210QWj84DQBw&usg=AFQjCNFUF80OMoWByFBYQE0u2471uBw1zw&sig2=uKx2A9Juefan8Bi2W-XliQ&bvm=bv.44770516,d.d2k