#253 Add mixin class for ordered comparisons.

v4.0
closed
Classes (154)
5
2012-08-14
2007-10-10
No

The DateTime and TimeSpan implementations demonstrated what a pain implementing a class that supports the comparison operators beyond just "==" and "\==" varieties. It is necessary to implement 18(!) different operator methods to get the entire set.

In the case of the DateTime and TimeSpan classes, these methods ended up being stubs that called the compareTo() method to figure out the comparison result. Each class needed to implement their own version of this, which was a pain. This also meant that the documentation needed to be duplicated for each of the classes.

The methods from DateTime can be extracted and combined with an ABSTRACT compareTo() method to create a mixin that will stream line this process. Now a class that wants to provide this need only implement the single compareTo() method rather than the 18 separate methods.

Attached is a prototype version of the mixin and a test program.

NOTE: This should be targetted to the post 3.2.0 timeframe.

Discussion

  • Rick McGuire

    Rick McGuire - 2007-10-10

    Prototype mixin class to simplify adding comparisons.

     
  • Rick McGuire

    Rick McGuire - 2007-10-10

    Same test file showing how this works.

     
  • Rick McGuire

    Rick McGuire - 2007-10-10

    Logged In: YES
    user_id=1125291
    Originator: YES

    File Added: testOrderable.rex

     
  • Rick McGuire

    Rick McGuire - 2008-08-14

    Logged In: YES
    user_id=1125291
    Originator: YES

    Committed revision 2966.

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-09-16

    This request for a feature enhancement has been included in a prior release so the tracker item is being closed.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks