com.hlcl.rql.util.as
Class PageCache

java.lang.Object
  extended by com.hlcl.rql.util.as.PageCache

public class PageCache
extends java.lang.Object

Author:
lejafr This class is a memory optimized cache for pages.

Constructor Summary
PageCache(Project project)
          Construct a page cache.
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Returns true if this page cache contains a mapping for the specified key.
 Page get(java.lang.Object key)
          Returns the Page to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this key.
 PageArrayList getAllPages()
          Returns all cached pages.
 void put(java.lang.Object key, Page page)
          Associates the specified value with the specified page in this map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageCache

public PageCache(Project project)
Construct a page cache.

Method Detail

put

public void put(java.lang.Object key,
                Page page)
         throws RQLException
Associates the specified value with the specified page in this map. If the map previously contained a mapping for this key, the old page is replaced.

Parameters:
key - key with which the specified value is to be associated.
page - value to be associated with the specified key.
Throws:
RQLException

get

public Page get(java.lang.Object key)
         throws RQLException
Returns the Page to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to null. The containsKey method may be used to distinguish these two cases.

Parameters:
key - the key whose associated value is to be returned.
Returns:
the page to which this map maps the specified key, or null if the map contains no mapping for this key.
Throws:
RQLException
See Also:
put(Object, Page)

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if this page cache contains a mapping for the specified key.

Parameters:
key - The key whose presence in this map is to be tested
Returns:
true if this map contains a mapping for the specified key.

getAllPages

public PageArrayList getAllPages()
                          throws RQLException
Returns all cached pages.

Returns:
PageArrayList
Throws:
RQLException