Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.treetable.db
Class AbstractGroupCache

java.lang.Object
  extended by com.citra.table.cache.AbstractCache
      extended by com.citra.treetable.db.AbstractGroupCache
All Implemented Interfaces:
Cache, TreeTableCache
Direct Known Subclasses:
DefaultGroupCache

public abstract class AbstractGroupCache
extends AbstractCache
implements TreeTableCache

AbstractGroupCache uses the user object property of a DefaultMutableTreeNode in order to cache the group value for that node.


Field Summary
protected  CacheableTreeTableModel model
          the cacheable treetable model.
 
Fields inherited from class com.citra.table.cache.AbstractCache
chunkSize, DEFAULT_CHUNK_SIZE, DEFAULT_MAX_CACHE_SIZE, maximumCacheSize
 
Constructor Summary
AbstractGroupCache(CacheableTreeTableModel model)
          Constructs an AbstractGroupCache.
AbstractGroupCache(CacheableTreeTableModel model, int chunkSize, int maximumCacheSize)
          Constructs an AbstractGroupCache.
 
Method Summary
abstract  Object convertObject(Object rowObject)
          Converts the object rowObject, as received from the database, and returns the result.
 Object get(Object key)
          Retrieves a value from the cache.
 Object getValueAt(Object row, int column)
          Retrieves the cached value for node at index column.
 boolean isValueCached(Object key)
          Determines whether the value specificed by key is cached.
 boolean isValueCached(Object row, int column)
          Determines whether the value for node at index column exists in the cache.
 void put(Object key, Object value)
          Inserts a value in the cache store.
 Object remove(Object key)
          Removes a value from the cache store.
 void removeAll()
          Clears the cache.
 void setCacheTreeTableModel(CacheableTreeTableModel model)
          Assigns a CacheableTreeTableModel that will be used to retrieve the uncached values.
 
Methods inherited from class com.citra.table.cache.AbstractCache
setChunkSize, setMaximumCacheSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected CacheableTreeTableModel model
the cacheable treetable model.

Constructor Detail

AbstractGroupCache

public AbstractGroupCache(CacheableTreeTableModel model)
Constructs an AbstractGroupCache.


AbstractGroupCache

public AbstractGroupCache(CacheableTreeTableModel model,
                          int chunkSize,
                          int maximumCacheSize)
Constructs an AbstractGroupCache.

Method Detail

convertObject

public abstract Object convertObject(Object rowObject)
Converts the object rowObject, as received from the database, and returns the result.

Parameters:
rowObject - the object as received from the database.
Returns:
the converted object.

get

public Object get(Object key)
Retrieves a value from the cache. If the value is not cached, this method retrieves the uncached value and inserts it in the cache store.

Specified by:
get in interface Cache
Parameters:
key - an object whose associated value is cached.
Returns:
the value to which key is associated.

getValueAt

public Object getValueAt(Object row,
                         int column)
Retrieves the cached value for node at index column. If the value is not cached, this method retrieves the uncached value and inserts it in the cache store.

Specified by:
getValueAt in interface TreeTableCache
Parameters:
row - the node to consider
column - the cell's column index
Returns:
the cached value

isValueCached

public boolean isValueCached(Object key)
Determines whether the value specificed by key is cached.

Specified by:
isValueCached in interface Cache
Parameters:
key - an object whose associated value is cached.
Returns:
true if the value is cached.

isValueCached

public boolean isValueCached(Object row,
                             int column)
Determines whether the value for node at index column exists in the cache.

Specified by:
isValueCached in interface TreeTableCache
Parameters:
row - the node to consider
column - the cell's column index
Returns:
true if the value is cached

put

public void put(Object key,
                Object value)
Inserts a value in the cache store.

Specified by:
put in interface Cache
Parameters:
key - an object whose associated value is cached.
value - the value to cache.

removeAll

public void removeAll()
Clears the cache.

Specified by:
removeAll in interface Cache

setCacheTreeTableModel

public void setCacheTreeTableModel(CacheableTreeTableModel model)
Assigns a CacheableTreeTableModel that will be used to retrieve the uncached values.

Specified by:
setCacheTreeTableModel in interface TreeTableCache
Parameters:
model - the cacheable treetable model that will be used as the source.

remove

public Object remove(Object key)
Removes a value from the cache store.

Specified by:
remove in interface Cache
Parameters:
key - an object whose associated value is cached.

Copyright © 2011 Citra Technologies. All Rights Reserved.