From: Stefan F. <ste...@we...> - 2012-09-02 07:03:28
|
*** Further updates on Portfolios: Considering Erik's feedback and some further considerations I have done the following changes to Portfolios / Ownable Items: A) Ownable extends Comparable: This implies that all ownable items have to define an ordering. By default (in abstract OwnableItem) the ordering is based on their (unique) ids. B) PortfolioSet is a SortedSet Using the required ordering of ownable items, the portfolios are sorted accordingly. (Accordingly PortfolioMap is a SortedMultimap). Major advantage is that the ordering is always specified, and there is no ambiguity which certificate is returned, even if one asks only for a specified type. *** Examples for orderings: * PublicCertificates are sorted by i) President or not ii) CertificateType (and those are sorted by number of shares inside) iii) CertificateId This keeps the PresidentShare at position zero of each portfolio without requiring any code to keep it there. And it keeps the multi-shares at the top of a list of certificates. * Trains are sorted by i) TrainType ii) TrainId This makes it easy to generate the list of trains, as they are already sorted as required. |