Java Doc for SunTileCache.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » com » sun » media » jai » util » 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 » com.sun.media.jai.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Observable
      com.sun.media.jai.util.SunTileCache

SunTileCache
final public class SunTileCache extends Observable implements TileCache,CacheDiagnostics(Code)
This is Sun Microsystems' reference implementation of the javax.media.jai.TileCache interface. It provides a central location for images to cache computed tiles, and is used as the default tile cache mechanism when no other tile cache objects are specified.

In this implementation, the cache size is limited by the memory capacity, which may be set at construction time or using the setMemoryCapacity(long) method. The tile capacity is not used. Different images may have very different tile sizes. Therefore, the memory usage for a specific tile capacity may vary greatly depends on the type of images involved. In fact, the tile capacity is rather meaningless.
See Also:   javax.media.jai.TileCache




Constructor Summary
public  SunTileCache()
     No args constructor.
public  SunTileCache(long memoryCapacity)
     Constructor.

Method Summary
public  voidadd(RenderedImage owner, int tileX, int tileY, Raster tile)
     Adds a tile to the cache.

If the specified tile is already in the cache, it will not be cached again.

public synchronized  voidadd(RenderedImage owner, int tileX, int tileY, Raster tile, Object tileCacheMetric)
     Adds a tile to the cache with an associated tile compute cost.

If the specified tile is already in the cache, it will not be cached again.

public synchronized  voidaddTiles(RenderedImage owner, Point[] tileIndices, Raster[] tiles, Object tileCacheMetric)
     Adds an array of tiles to the tile cache.
public  voiddisableDiagnostics()
    
public  voiddump()
    
public  voidenableDiagnostics()
    
public synchronized  voidflush()
     Removes -ALL- tiles from the cache.
public  longgetCacheHitCount()
    
public  longgetCacheMemoryUsed()
    
public  longgetCacheMissCount()
    
public  longgetCacheTileCount()
    
public  ObjectgetCachedObject()
     Returns the Object that represents the actual cache.
public static  EnumeratedParameter[]getCachedTileActions()
     Returns an array of EnumeratedParameters corresponding to the numeric values returned by the getAction() method of the CachedTile implementation used by SunTileCache.
public  longgetMemoryCapacity()
     Returns the cache's memory capacity in bytes.
public  floatgetMemoryThreshold()
     Returns the current memoryThreshold.
public synchronized  RastergetTile(RenderedImage owner, int tileX, int tileY)
     Retrieves a tile from the cache.

If the specified tile is not in the cache, this method returns null.

public  intgetTileCapacity()
     Returns the cache's tile capacity.

This implementation of TileCache does not use the tile capacity.

public  ComparatorgetTileComparator()
    
public synchronized  Raster[]getTiles(RenderedImage owner)
     Retrieves a contiguous array of all tiles in the cache which are owned by the specified image.
public synchronized  Raster[]getTiles(RenderedImage owner, Point[] tileIndices)
     Returns an array of tile Rasters from the cache.
public synchronized  voidmemoryControl()
     Removes tiles from the cache based on their last-access time (old to new) until the memory usage is memoryThreshold % of that of the memory capacity.
public synchronized  voidremove(RenderedImage owner, int tileX, int tileY)
     Removes a tile from the cache.
public  voidremoveTiles(RenderedImage owner)
     Removes all the tiles that belong to a RenderedImage from the cache.
public  voidresetCounts()
     Reset hit and miss counters.
 voidsendExceptionToListener(String message, Exception e)
    
public  voidsetMemoryCapacity(long memoryCapacity)
     Sets the cache's memory capacity to the desired number of bytes.
public  voidsetMemoryThreshold(float mt)
     Set the memory threshold value.
public  voidsetTileCapacity(int tileCapacity)
     Sets the cache's tile capacity to the desired number of tiles.

This implementation of TileCache does not use the tile capacity.

public synchronized  voidsetTileComparator(Comparator c)
     The Comparator is used to produce an ordered list of tiles based on a user defined compute cost or priority metric.
public  StringtoString()
     Returns a string representation of the class object.


Constructor Detail
SunTileCache
public SunTileCache()(Code)
No args constructor. Use the DEFAULT_MEMORY_CAPACITY of 16 Megs.



SunTileCache
public SunTileCache(long memoryCapacity)(Code)
Constructor. The memory capacity should be explicitly specified.
Parameters:
  memoryCapacity - The maximum cache memory size in bytes.
throws:
  IllegalArgumentException - If memoryCapacityis less than 0.




Method Detail
add
public void add(RenderedImage owner, int tileX, int tileY, Raster tile)(Code)
Adds a tile to the cache.

If the specified tile is already in the cache, it will not be cached again. If by adding this tile, the cache exceeds the memory capacity, older tiles in the cache are removed to keep the cache memory usage under the specified limit.
Parameters:
  owner - The image the tile blongs to.
Parameters:
  tileX - The tile's X index within the image.
Parameters:
  tileY - The tile's Y index within the image.
Parameters:
  tile - The tile to be cached.




add
public synchronized void add(RenderedImage owner, int tileX, int tileY, Raster tile, Object tileCacheMetric)(Code)
Adds a tile to the cache with an associated tile compute cost.

If the specified tile is already in the cache, it will not be cached again. If by adding this tile, the cache exceeds the memory capacity, older tiles in the cache are removed to keep the cache memory usage under the specified limit.
Parameters:
  owner - The image the tile blongs to.
Parameters:
  tileX - The tile's X index within the image.
Parameters:
  tileY - The tile's Y index within the image.
Parameters:
  tile - The tile to be cached.
Parameters:
  tileCacheMetric - Metric for prioritizing tiles




addTiles
public synchronized 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:
   1.1



disableDiagnostics
public void disableDiagnostics()(Code)
Turn off diagnostic notification



dump
public void dump()(Code)



enableDiagnostics
public void enableDiagnostics()(Code)
Enable Tile Monitoring and Diagnostics



flush
public synchronized void flush()(Code)
Removes -ALL- tiles from the cache.



getCacheHitCount
public long getCacheHitCount()(Code)



getCacheMemoryUsed
public long getCacheMemoryUsed()(Code)



getCacheMissCount
public long getCacheMissCount()(Code)



getCacheTileCount
public long getCacheTileCount()(Code)



getCachedObject
public Object getCachedObject()(Code)
Returns the Object that represents the actual cache.



getCachedTileActions
public static EnumeratedParameter[] getCachedTileActions()(Code)
Returns an array of EnumeratedParameters corresponding to the numeric values returned by the getAction() method of the CachedTile implementation used by SunTileCache. The "name" of each EnumeratedParameter provides a brief string describing the numeric action value.



getMemoryCapacity
public long getMemoryCapacity()(Code)
Returns the cache's memory capacity in bytes.



getMemoryThreshold
public float getMemoryThreshold()(Code)
Returns the current memoryThreshold.
since:
   1.1



getTile
public synchronized Raster getTile(RenderedImage owner, int tileX, int tileY)(Code)
Retrieves a tile from the cache.

If the specified tile is not in the cache, this method returns null. If the specified tile is in the cache, its last-access time is updated.
Parameters:
  owner - The image the tile blongs to.
Parameters:
  tileX - The tile's X index within the image.
Parameters:
  tileY - The tile's Y index within the image.




getTileCapacity
public int getTileCapacity()(Code)
Returns the cache's tile capacity.

This implementation of TileCache does not use the tile capacity. This method always returns 0.




getTileComparator
public Comparator getTileComparator()(Code)
Return the current comparator
since:
   1.1



getTiles
public synchronized Raster[] getTiles(RenderedImage owner)(Code)
Retrieves a contiguous array of all tiles in the cache which are owned by the specified image. May be null if there were no tiles in the cache. The array contains no null entries.
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.



getTiles
public synchronized 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.
Parameters:
  owner - The RenderedImage that the tile belongs to.
Parameters:
  tileIndices - An array of Points containing thetileX and tileY indices for each tile.
since:
   1.1



memoryControl
public synchronized void memoryControl()(Code)
Removes tiles from the cache based on their last-access time (old to new) until the memory usage is memoryThreshold % of that of the memory capacity.



remove
public synchronized void remove(RenderedImage owner, int tileX, int tileY)(Code)
Removes a tile from the cache.

If the specified tile is not in the cache, this method does nothing.




removeTiles
public void removeTiles(RenderedImage owner)(Code)
Removes all the tiles that belong to a RenderedImage from the cache.
Parameters:
  owner - The image whose tiles are to be removed from the cache.



resetCounts
public void resetCounts()(Code)
Reset hit and miss counters.
since:
   1.1



sendExceptionToListener
void sendExceptionToListener(String message, Exception e)(Code)



setMemoryCapacity
public void setMemoryCapacity(long memoryCapacity)(Code)
Sets the cache's memory capacity to the desired number of bytes. If the new memory capacity is smaller than the amount of memory currently being used by this cache, tiles are removed from the cache until the memory usage is less than the specified memory capacity.
Parameters:
  memoryCapacity - The desired memory capacity for this cachein bytes.
throws:
  IllegalArgumentException - If memoryCapacityis less than 0.



setMemoryThreshold
public void setMemoryThreshold(float mt)(Code)
Set the memory threshold value.
since:
   1.1



setTileCapacity
public void setTileCapacity(int tileCapacity)(Code)
Sets the cache's tile capacity to the desired number of tiles.

This implementation of TileCache does not use the tile capacity. The cache size is limited by the memory capacity only. This method does nothing and has no effect on the cache.
Parameters:
  tileCapacity - The desired tile capacity for this cachein number of tiles.




setTileComparator
public synchronized void setTileComparator(Comparator c)(Code)
The Comparator is used to produce an ordered list of tiles based on a user defined compute cost or priority metric. This determines which tiles are subject to "ordered" removal during a memory control operation.
since:
   1.1



toString
public String toString()(Code)
Returns a string representation of the class object.



Methods inherited from java.util.Observable
public synchronized void addObserver(Observer o)(Code)(Java Doc)
protected synchronized void clearChanged()(Code)(Java Doc)
public synchronized int countObservers()(Code)(Java Doc)
public synchronized void deleteObserver(Observer o)(Code)(Java Doc)
public synchronized void deleteObservers()(Code)(Java Doc)
public synchronized boolean hasChanged()(Code)(Java Doc)
public void notifyObservers()(Code)(Java Doc)
public void notifyObservers(Object arg)(Code)(Java Doc)
protected synchronized void setChanged()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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