Java Doc for TileCache.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » media » jai » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » javax.media.jai 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.media.jai.TileCache

All known Subclasses:   com.sun.media.jai.util.SunTileCache,
TileCache
public interface TileCache (Code)
A class implementing a caching mechanism for image tiles.

TileCache provides a mechanism by which an OpImage may cache its computed tiles. There may be multiple TileCaches used in an application up to the point of having a different TileCache for each OpImage.

The TileCache used for a particular OpImage is derived from the RenderingHints assigned to the associated imaging chain node. If the node is constructed using JAI.create() and no TileCache is specified in the RenderingHints parameter, then one is derived from the RenderingHints associated with the instance of the JAI class being used.

In the Sun reference implementation, the cache size is limited by the memory capacity, which is set to a default value at construction or subsequently using the setMemoryCapacity() method. The initial value may be obtained using getMemoryCapacity(). The tile capacity is not used as different images may have very different tile sizes so that this metric is not a particularly meaningful control of memory resource consumption in general.
See Also:   JAI
See Also:   RenderedOp
See Also:   java.awt.RenderingHints





Method Summary
 voidadd(RenderedImage owner, int tileX, int tileY, Raster data)
     Adds a tile to the cache.
 voidadd(RenderedImage owner, int tileX, int tileY, Raster data, Object tileCacheMetric)
    
 voidaddTiles(RenderedImage owner, Point[] tileIndices, Raster[] tiles, Object tileCacheMetric)
     Adds an array of tiles to the tile cache.
 voidflush()
     Advises the cache that all of its tiles may be discarded.
 longgetMemoryCapacity()
     Returns the memory capacity in bytes.
 floatgetMemoryThreshold()
     Returns the memory threshold, which is the fractional amount of cache memory to retain during tile removal.
 RastergetTile(RenderedImage owner, int tileX, int tileY)
     Retrieves a tile.
 intgetTileCapacity()
     Returns the tile capacity in tiles.
 ComparatorgetTileComparator()
     Returns the Comparator currently set for use in ordering the CachedTiles stored by the TileCache.
 Raster[]getTiles(RenderedImage owner)
     Retrieves an array of all tiles in the cache which are owned by the specified image.
Parameters:
  owner - The RenderedImage to which the tiles belong.
 Raster[]getTiles(RenderedImage owner, Point[] tileIndices)
     Returns an array of tile Rasters from the cache.
 voidmemoryControl()
     Advises the cache that some of its tiles may be discarded.
 voidremove(RenderedImage owner, int tileX, int tileY)
     Advises the cache that a tile is no longer needed.
 voidremoveTiles(RenderedImage owner)
     Advises the cache that all tiles associated with a given image are no longer needed.
 voidsetMemoryCapacity(long memoryCapacity)
     Sets the memory capacity to a desired number of bytes.
 voidsetMemoryThreshold(float memoryThreshold)
     Sets the memoryThreshold value to a floating point number that ranges from 0.0 to 1.0. When the cache memory is full, the memory usage will be reduced to this fraction of the total cache memory capacity.
 voidsetTileCapacity(int tileCapacity)
     Sets the tile capacity to a desired number of tiles. If the capacity is smaller than the current capacity, tiles are flushed from the cache.
 voidsetTileComparator(Comparator comparator)
     Sets a Comparator which imposes an order on the CachedTiles stored in the TileCache. This ordering is used in memoryControl() to determine the sequence in which tiles will be removed from the TileCache so as to reduce the memory to the level given by the memory threshold.



Method Detail
add
void add(RenderedImage owner, int tileX, int tileY, Raster data)(Code)
Adds a tile to the cache.
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileX - The X index of the tile in the owner's tile grid.
Parameters:
  tileY - The Y index of the tile in the owner's tile grid.
Parameters:
  data - A Raster containing the tile data.



add
void add(RenderedImage owner, int tileX, int tileY, Raster data, Object tileCacheMetric)(Code)
Adds a tile to the cache with an associated compute cost
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileX - The X index of the tile in the owner's tile grid.
Parameters:
  tileY - The Y index of the tile in the owner's tile grid.
Parameters:
  data - A Raster containing the tile data.
Parameters:
  tileCacheMetric - An Object as a tile metric.
since:
   JAI 1.1



addTiles
void addTiles(RenderedImage owner, Point[] tileIndices, Raster[] tiles, Object tileCacheMetric)(Code)
Adds an array of tiles to the tile cache.
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileIndices - An array of Points containing thetileX and tileY indices for each tile.
Parameters:
  tiles - The array of tile Rasters containing tile data.
Parameters:
  tileCacheMetric - Object which provides an ordering metricassociated with the RenderedImage owner.
since:
   JAI 1.1



flush
void flush()(Code)
Advises the cache that all of its tiles may be discarded. It is legal to implement this method as a no-op.



getMemoryCapacity
long getMemoryCapacity()(Code)
Returns the memory capacity in bytes.



getMemoryThreshold
float getMemoryThreshold()(Code)
Returns the memory threshold, which is the fractional amount of cache memory to retain during tile removal.
since:
   JAI 1.1



getTile
Raster getTile(RenderedImage owner, int tileX, int tileY)(Code)
Retrieves a tile. Returns null if the tile is not present in the cache.
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileX - The X index of the tile in the owner's tile grid.
Parameters:
  tileY - The Y index of the tile in the owner's tile grid.



getTileCapacity
int getTileCapacity()(Code)
Returns the tile capacity in tiles. It is legal to implement this method as a no-op which should be signaled by returning zero.



getTileComparator
Comparator getTileComparator()(Code)
Returns the Comparator currently set for use in ordering the CachedTiles stored by the TileCache. The tile Comparator or null if theimplementation-dependent ordering algorithm is being used.
since:
   JAI 1.1



getTiles
Raster[] getTiles(RenderedImage owner)(Code)
Retrieves an array of all tiles in the cache which are owned by the specified image.
Parameters:
  owner - The RenderedImage to which the tiles belong. An array of all tiles owned by the specified image ornull if there are none currently in the cache.
since:
   JAI 1.1



getTiles
Raster[] getTiles(RenderedImage owner, Point[] tileIndices)(Code)
Returns an array of tile Rasters from the cache. Any or all of the elements of the returned array may be null if the corresponding tile is not in the cache. The length of the returned array must be the same as that of the parameter array and the ith Raster in the returned array must correspond to the ith tile index in the parameter array.
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileIndices - An array of Points containing thetileX and tileY indices for each tile.
since:
   JAI 1.1



memoryControl
void memoryControl()(Code)
Advises the cache that some of its tiles may be discarded. It is legal to implement this method as a no-op.
since:
   JAI 1.1



remove
void remove(RenderedImage owner, int tileX, int tileY)(Code)
Advises the cache that a tile is no longer needed. It is legal to implement this method as a no-op.
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileX - The X index of the tile in the owner's tile grid.
Parameters:
  tileY - The Y index of the tile in the owner's tile grid.



removeTiles
void removeTiles(RenderedImage owner)(Code)
Advises the cache that all tiles associated with a given image are no longer needed. It is legal to implement this method as a no-op.
Parameters:
  owner - The RenderedImage owner of the tilesto be removed.



setMemoryCapacity
void setMemoryCapacity(long memoryCapacity)(Code)
Sets the memory capacity to a desired number of bytes. If the memory capacity is smaller than the amount of memory currently used by the cache, tiles are flushed until the TileCache's memory usage is less than memoryCapacity.
Parameters:
  memoryCapacity - The new capacity, in bytes.



setMemoryThreshold
void setMemoryThreshold(float memoryThreshold)(Code)
Sets the memoryThreshold value to a floating point number that ranges from 0.0 to 1.0. When the cache memory is full, the memory usage will be reduced to this fraction of the total cache memory capacity. For example, a value of .75 will cause 25% of the memory to be cleared, while retaining 75%. memoryThreshold. Retained fraction of memory
throws:
  IllegalArgumentException - if the memoryThresholdis less than 0.0 or greater than 1.0
since:
   JAI 1.1



setTileCapacity
void setTileCapacity(int tileCapacity)(Code)
Sets the tile capacity to a desired number of tiles. If the capacity is smaller than the current capacity, tiles are flushed from the cache. It is legal to implement this method as a no-op.
Parameters:
  tileCapacity - The new capacity, in tiles.



setTileComparator
void setTileComparator(Comparator comparator)(Code)
Sets a Comparator which imposes an order on the CachedTiles stored in the TileCache. This ordering is used in memoryControl() to determine the sequence in which tiles will be removed from the TileCache so as to reduce the memory to the level given by the memory threshold. The Objects passed to the compare() method of the Comparator will be instances of CachedTile. CachedTiles will be removed from the TileCache in the ascending order imposed by this Comparator. If no Comparator is currently set, the TileCache should use an implementation-dependent default ordering. In the Sun Microsystems, Inc., implementation of TileCache, this ordering is the least recently used ordering, i.e., the tiles least recently used will be removed first by memoryControl().
Parameters:
  comparator - A Comparator which orders theCachedTiles stored by the TileCache;if null an implementation-dependent algorithmwill be used.
since:
   JAI 1.1



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.