Hi Joachim,
-- I have attached a fresh copy of the file out of the DynamicSortBlock class, just in case although I don't think there have been many if any changes. I should put it in VAST Goodies but right now it is in an app with lots of other little classes so I will need to pull it out into its own app. DynamicSortBlock acts like a two argument block of code and is used any place a sort block can be used. It does its work in the #value:value: method (see its comment). The rest of the methods just make it ease to setup. It contains two matching ordered collections: #accessors and #directions. The #accessors collection contains symbols that represent methods of the objects being sorted that should answer the value of interest. The #directions collection contains booleans (true or false) that represent the direction of sorting for its corresponding accessor (true means ascending, false means descending). This allows some parts of the sort to be ascending while others are descending. For example if you are sorting products by descending price and ascending name. Now to answer your question: Does your implementation support switching between ascending/descending for one or more criteria once a collection has been sorted? I guess this is just a matter of changing a boolean and resorting the collection, right? Yes. DynamicSortBlock is a pretty light weight class, so you could just have two or more defined however you like but the #accessors and #directions collections are exposed and you can do what you like to then. So, if you wanted to change one or more directions you could or replace the whole collection of directions. But I think having two instances of DynamicSortBlock would be best. I hope you find it useful, I have. Just ask if you have any questions. Lou On Wednesday, September 17, 2014 3:09:10 AM UTC-4, Joachim Tuchel wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. DynamicSortBlock.st (4K) Download Attachment |
Thanks Lou,
-- I'll start using it very soon now. I'll let you know if I see any problems or enhancements. About VASTGoodies: Not sure I understand your problem. You can move the class to another application and stuff it into a config map. That should be pretty much it, no? Joachim Am Mittwoch, 17. September 2014 20:34:58 UTC+2 schrieb Louis LaBrunda:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
On Monday, September 22, 2014 3:36:52 AM UTC-4, Joachim Tuchel wrote:
Great!
Not really a problem. Just need to decide where to put it (some existing app, a new app, whatever) and do it.
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |