In the old implementation, the system goes through all the snappers in the space in order to find the space volume snappers that belong to a particular space volume, which is not optimal. Hence, a new _spaceVolumeSnappers
field is introduced in SpaceVolume
to cache the space volume snappers that belong to a space volume. A space volume snapper is added to _spaceVolumeSnappers
through SpaceVolumeEventViewer::updateAfterAddSnapper(..)
whenever it is inserted into a space, and is removed from _spaceVolumeSnappers
through SpaceVolumeEventViewer::updateAfterRemoveSnapper(..)
whenever it is removed from a space. In addition, when the space volume id of a space volume snapper is changed, it is removed from _spaceVolumeSnappers
of the old space volume, and added to _spaceVolumeSnappers
of the new space volume, through spaceVolumeSnapperIdChanged(..)
.
// Class: cm.core.spaceVolume.SpaceVolume New: private Snapper{} _spaceVolumeSnappers : copy=shallow, stream=null;