Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.cache
Class AbstractTableCache

java.lang.Object
  extended by com.citra.table.cache.AbstractCache
      extended by com.citra.table.cache.AbstractTableCache
All Implemented Interfaces:
Cache, TableCache
Direct Known Subclasses:
DefaultTableCache

public abstract class AbstractTableCache
extends AbstractCache
implements TableCache

AbstractTableCache is a TableCache that uses a map as the cache store.


Field Summary
protected  int lastRow
          the last row read
protected  Object lastRowOb
          the last object data read
protected  CacheableTableModel model
          the cacheable table model
 
Fields inherited from class com.citra.table.cache.AbstractCache
chunkSize, DEFAULT_CHUNK_SIZE, DEFAULT_MAX_CACHE_SIZE, maximumCacheSize
 
Constructor Summary
AbstractTableCache(CacheableTableModel model)
          Creates an AbstractTableCache.
AbstractTableCache(CacheableTableModel model, int chunkSize, int maximumCacheSize)
          Creates an AbstractTableCache.
 
Method Summary
 Object get(Object key)
          Retrieves a value from the cache.
abstract  Object getObjectAt(Object row, int column)
          Returns the Object found at column of row passed as a parameter.
 Object getValueAt(int row, int column)
          Retrieves the cached value at the cell at (row, column).
 boolean isValueCached(int row, int column)
          Determines whether the cell's value at (row, column) is cached.
 boolean isValueCached(Object key)
          Determines whether the value specificed by key is cached.
 void put(int row, Object rowObject)
          Inserts a row in the cache.
 void put(Object key, Object value)
          Inserts a value in the cache store.
 Object remove(int row)
          Removes a row from the cache.
 Object remove(Object key)
          Removes a value from the cache store.
 void removeAll()
          Clears the cache.
 void setCacheTableModel(CacheableTableModel model)
          Assigns a CacheableTableModel 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

lastRow

protected int lastRow
the last row read


lastRowOb

protected Object lastRowOb
the last object data read


model

protected CacheableTableModel model
the cacheable table model

Constructor Detail

AbstractTableCache

public AbstractTableCache(CacheableTableModel model)
Creates an AbstractTableCache.


AbstractTableCache

public AbstractTableCache(CacheableTableModel model,
                          int chunkSize,
                          int maximumCacheSize)
Creates an AbstractTableCache.

Method Detail

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.

getObjectAt

public abstract Object getObjectAt(Object row,
                                   int column)
Returns the Object found at column of row passed as a parameter.

Parameters:
row - the row data
column - an index
Returns:
the object found at column of the row data row

getValueAt

public Object getValueAt(int row,
                         int column)
Retrieves the cached value at the cell at (row, 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 TableCache
Parameters:
row - the cell's row index
column - the cell's column index
Returns:
the cached value

isValueCached

public boolean isValueCached(int row,
                             int column)
Determines whether the cell's value at (row, column) is cached.

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

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.

put

public void put(int row,
                Object rowObject)
Inserts a row in the cache.

Specified by:
put in interface TableCache
Parameters:
row - the row to insert to
rowObject - the object to insert at row

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

setCacheTableModel

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

Specified by:
setCacheTableModel in interface TableCache
Parameters:
model - the cacheable table model that will be used as the source.

remove

public Object remove(int row)
Removes a row from the cache.

Specified by:
remove in interface TableCache
Parameters:
row - the row to remove from the cache

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.