|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jaitools.tilecache.BasicCacheVisitor
public class BasicCacheVisitor
A basic visitor class for DiskMemTileCache that can be used
to examine cache contents.
Example of use:
// Query the cache for tiles that belong to a given image
// and that are currently resident in memory
DiskMemTileCache cache = ...
RenderedImage owner = ...
Map filters = CollectionFactory.newMap();
filters.put(BasicCacheVisitor.Key.OWNER, owner);
filters.put(BasicCachevisitor.Key.RESIDENT, Boolean.TRUE);
BasicCacheVisitor visitor = new BasicCacheVisitor();
visitor.setFilters(filters);
cache.accept(visitor);
for (DiskCachedTile tile : visitor.getTiles()) {
System.out.println(String.format("tile %d,%d", tile.getTileX(), tile.getTileY()));
}
| Nested Class Summary | |
|---|---|
static class |
BasicCacheVisitor.Key
Defines keys to filter the tles visited |
| Constructor Summary | |
|---|---|
BasicCacheVisitor()
|
|
| Method Summary | |
|---|---|
void |
clear()
Clear collected tile data. |
void |
clearFilters()
Clear all existing filter conditions |
Collection<DiskCachedTile> |
getTiles()
Returns an unmodifiable collection of tiles retrieved from the cache. |
void |
setFilter(BasicCacheVisitor.Key key,
Object value)
Set a single filter condition. |
void |
setFilters(Map<BasicCacheVisitor.Key,Object> params)
Set filter conditions. |
void |
visit(DiskCachedTile tile,
boolean isResident)
This method is called by the cache for each tile in turn. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicCacheVisitor()
| Method Detail |
|---|
public void setFilters(Map<BasicCacheVisitor.Key,Object> params)
params - a Map where each key is one of the constants
defined by BasicCacheVisitor.Key and each value is the
corresponding value to match tiles against
public void setFilter(BasicCacheVisitor.Key key,
Object value)
key - one of the constants defined by BasicCacheVisitor.Keyvalue - corresponding value to match tiles againstpublic void clearFilters()
public Collection<DiskCachedTile> getTiles()
public void visit(DiskCachedTile tile,
boolean isResident)
visit in interface DiskMemTileCacheVisitortile - the cached tile being visitedisResident - set by the cache to indicate whether the tile is
currently resident in memorypublic void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||