Wednesday, 23 May 2012

Combine() (or Collapse) DateRanges


Status: Completed
Competition start date: 2012.05.21
Competition end date: 2102.05.24
Download associated files. (once you are on the google docs page, click on the file tab and then download CTR + S)


Introduction:


In the manufacture or process industry we often have to deal with operations (or tasks) that have a certain duration.
The duration represents the time it takes to produce or consume a certain amount of product (i.e. quantity).

The aim of this competition is to implement an algorithm which will combine (or collapse) a collection of tasks that have date ranges that overlap. In other words tasks that overlap in time may have to be spliced, so that their overlapping parts are combined and their respective rates added up.

Please see below for an illustration of how the method should work as well as the existing classes which will assist you in writing your code.



======================================================================
UPDATE: 2012.05.24

Submissions:


Thank you to all the other contestants.

Outcome of the competition on the existing library:

- Renamed the Combine() method to Collapse()
- In the DateRange class, the method Overlap() has been renamed to GetOverlap(), and a new Overlaps() method was written which only returns a boolean.
- The DateRange class is now immutable, and implements IEquality, IComparable, and overloads the "==" and "!=" operators
- The Task class is now immutable and implements IEquality (Decided against implementing IComparable as there are too many variables. Most of the time defaulting to the DateRange comparer will suffice.)

No comments:

Post a Comment