www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/+mbcgui/+widget/@ScrollTable/doUpdateCacheSizes.m
function doUpdateCacheSizes(obj) %DOUPDATECACHESIZES Update the size of the main and header caches % % DOUPDATECACHESIZES(OBJ) calculates the sizes of the main and header % object caches based on the public CacheSize property, and cleans up the % caches if necessary. % Copyright 2000-2006 The MathWorks, Inc. and Ford Global Technologies, Inc. if obj.MaximumObjectCacheSize == 0 delete(obj.mainObjectCache); delete(obj.rowObjectCache); delete(obj.colObjectCache); obj.mainObjectCache = []; obj.rowObjectCache = []; obj.colObjectCache = []; obj.mainObjectCacheSize = 0; obj.headObjectCacheSize = 0; else if obj.ShowRowHeaders && obj.ShowColumnHeaders nHead = floor(max(roots([1 2 -obj.MaximumObjectCacheSize]))); nMain = obj.MaximumObjectCacheSize - 2*nHead; elseif obj.ShowRowHeaders || obj.ShowColumnHeaders nHead = floor(max(roots([1 1 -obj.MaximumObjectCacheSize]))); nMain = obj.MaximumObjectCacheSize - nHead; else nHead = 0; nMain = obj.MaximumObjectCacheSize; end obj.mainObjectCacheSize = nMain; obj.headObjectCacheSize = nHead; if length(obj.mainObjectCache)>nMain delete(obj.mainObjectCache(nMain+1:end)); obj.mainObjectCache = obj.mainObjectCache(1:nMain); end if length(obj.rowObjectCache)>nHead delete(obj.rowObjectCache(nHead+1:end)); obj.rowObjectCache = obj.rowObjectCache(1:nHead); end if length(obj.colObjectCache)>nHead delete(obj.colObjectCache(nHead+1:end)); obj.colObjectCache = obj.colObjectCache(1:nHead); end end