Slowly, but still – the project is moving forward. I’ve been rewriting my DLL following the plan (or as modern politician would say – road map). And of course during the process the plan has been amended. Most changes are cosmetic, the biggest change is that I introduced a sub-class inside Panel class – its responsibility is merging boxes in the panel. It is highly possible that available space would become highly fragmented during the execution of the Guillotine algorithm and some of the free boxes could be merged. The below picture illustrates the most simple case.
This is what Merger class will do. It is a sub-class within Panel class because I don’t see any other place where it may be useful.
Another thing that is worth mentioning is presence of singleton classes. I am aware of the fact that it may be considered as an anti-pattern but here I use them deliberately. The reason for that is my singleton classes don’t have any fields or properties, only methods therefore I do not fear any loss of data, unwanted instances or inheritance. I tried to implement that in most simple and safest way possible. I will probably write a general post about advantages and disadvantages of singleton, but here and now is no time and place for this.