User Tools

Site Tools


caching:ex1

Intro Ex1 Ex2 Ex3 Ex4

Caching: Constant Override

Task: Pass tests.BoundsConstant.

A first, very crude approximation of the bounding box, would be to return the entire drawing canvas. This is certainly very fast to calculate (it is a constant value), although it might mean excessive redrawing.

Implement an aspect to return the entire canves when the getBounds() method of a Group is invoked. The entire canvas can be retrieved through the static field MAX_BOUNDS of FigureElement.

You can override the getBounds() method entirely with around advice intercepting the method.

This should make the test cases of tests.BoundsConstant pass.


When done, remove the aspect from your build path. Continue with Exercise 2.

caching/ex1.txt · Last modified: 2021/02/05 13:51 (external edit)