org.apache.batik.ext.awt.color
Class NamedProfileCache

java.lang.Object
  extended by org.apache.batik.util.SoftReferenceCache
      extended by org.apache.batik.ext.awt.color.NamedProfileCache

public class NamedProfileCache
extends SoftReferenceCache

This class manages a cache of soft references to named profiles that we have already loaded.


Field Summary
 
Fields inherited from class org.apache.batik.util.SoftReferenceCache
map
 
Constructor Summary
NamedProfileCache()
          Let people create there own caches.
 
Method Summary
 void clear(String profileName)
          Clear the entry for String.
static NamedProfileCache getDefaultCache()
           
 boolean isDone(String profileName)
          Check if request(profileName) will return immediately with the ICCColorSpaceExt.
 boolean isPresent(String profileName)
          Check if request(profileName) will return with a ICCColorSpaceExt (not putting you on the hook for it).
 void put(String profileName, ICCColorSpaceExt bi)
          Associate bi with profileName.
 ICCColorSpaceExt request(String profileName)
          If this returns null then you are now 'on the hook'.
 
Methods inherited from class org.apache.batik.util.SoftReferenceCache
clearImpl, flush, isDoneImpl, isPresentImpl, putImpl, requestImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedProfileCache

public NamedProfileCache()
Let people create there own caches.

Method Detail

getDefaultCache

public static NamedProfileCache getDefaultCache()

isPresent

public boolean isPresent(String profileName)
Check if request(profileName) will return with a ICCColorSpaceExt (not putting you on the hook for it). Note that it is possible that this will return true but between this call and the call to request the soft-reference will be cleared. So it is still possible for request to return NULL, just much less likely (you can always call 'clear' in that case).


isDone

public boolean isDone(String profileName)
Check if request(profileName) will return immediately with the ICCColorSpaceExt. Note that it is possible that this will return true but between this call and the call to request the soft-reference will be cleared.


request

public ICCColorSpaceExt request(String profileName)
If this returns null then you are now 'on the hook'. to put the ICCColorSpaceExt associated with String into the cache.


clear

public void clear(String profileName)
Clear the entry for String. This is the easiest way to 'get off the hook'. if you didn't indend to get on it.


put

public void put(String profileName,
                ICCColorSpaceExt bi)
Associate bi with profileName. bi is only referenced through a soft reference so don't rely on the cache to keep it around. If the map no longer contains our profileName it was probably cleared or flushed since we were put on the hook for it, so in that case we will do nothing.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.