User Tools

Site Tools


caching:ex4

This is an old revision of the document!


Caching: Invalidate (part II)

Task: Pass tests.Invalidation2a and pass tests.Invalidation2b.

Of course, the previous aspect didn't really solve the problem. What if a Point that is part of a Group moves? Whenever either of the fields of a Point are set it should invalidate the caches of all enclosing groups.

Store the enclosing Group as a newly introduced field of a FigureElement (intercept the add() method of Group to populate this field). When the FigureElement moves, the cache of its enclosing group should be invalidated.

A correct implementation should at least pass the tests of suite tests.Invalidation2a. However, check if you really did it correctly by also running the suite tests.Invalidation2b. If you pass, congratulations! Otherwise, you have fallen prey to our cruel trap: Remember that whenever a point moves it should invalidate the caches of all enclosing groups (recursively).


When done, remove your aspects from the build path and return to the Overview.

caching/ex4.1172512219.txt.gz · Last modified: 2007/02/26 18:50 by bdefrain