public class FlatFieldCache extends Object
FlatField
s. Maintains a fixed number of cache
arrays in memory. When a cache member is requested which is not currently
available in the cache it is loaded directly into one of the cache arrays.
This prevents the allocation or garbage collection of data arrays when they
are created. This allows caching to happen close to the data, rather than the
rendering and is intended to allow for large animation loops with as little
an affect as possible on rendering. This can however lead to large latency at
startup due to reading data sources and copying them to the cache arrays.
Most of this class was modeled after the FileFlatField
. This cache,
however, is not a static cache, it is a instance cache. The affect of this is
that if you create several large caches you can very quickly run out of memory.
Constructor and Description |
---|
FlatFieldCache(int cacheSize)
Create a cache with a fixed size and the default strategy.
|
FlatFieldCache(int cacheSize,
visad.data.FlatFieldCacheStrategy strategy)
Initialize cache.
|
Modifier and Type | Method and Description |
---|---|
void |
flushCache(visad.data.FlatFieldCache.Entry entry,
FlatFieldCacheAccessor fileAccessor)
Not currently implemented.
|
protected float[][] |
getData(AreaImageCacheAdapter owner,
FlatFieldCacheAccessor fileAccessor)
Does the work of getting data from the cache.
|
int |
getSize() |
void |
setDirty(AreaImageCacheAdapter owner,
boolean dirty)
Don't do this.
|
String |
toString() |
protected void |
updateEntry(visad.data.FlatFieldCache.Entry entry,
float[][] data,
visad.data.FlatFieldCache.CacheOwner owner) |
public FlatFieldCache(int cacheSize)
cacheSize
- public FlatFieldCache(int cacheSize, visad.data.FlatFieldCacheStrategy strategy)
cacheSize
- Number of FlatFields
to maintain in cache, >= 1.strategy
- How cache allocation is performed.protected void updateEntry(visad.data.FlatFieldCache.Entry entry, float[][] data, visad.data.FlatFieldCache.CacheOwner owner)
protected float[][] getData(AreaImageCacheAdapter owner, FlatFieldCacheAccessor fileAccessor)
owner
- fileAccessor
- public void flushCache(visad.data.FlatFieldCache.Entry entry, FlatFieldCacheAccessor fileAccessor) throws VisADException
entry
- fileAccessor
- UnsupportedOperationException
- All the time.VisADException
public void setDirty(AreaImageCacheAdapter owner, boolean dirty)
owner
- The owner of the cache entry to mark as dirty.dirty
- public int getSize()
Copyright © 1996–2023 The SSEC Visualization Project. All rights reserved.