edu.unh.sdb.datasource
Class DynamicChunking

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataSource
          extended by edu.unh.sdb.datasource.DynamicChunking
All Implemented Interfaces:
Indexable

public class DynamicChunking
extends DataSource

Abstract class for a dynamic chunking data source that provides a Indexable.datum(edu.unh.sdb.datasource.IndexSpaceID) method that either reads the datum from memory if the block that contained it is loaded, or loads the block, eventually discards an already loaded block in LRU fashion and then returns the data from the loaded block. Each time a block is accessed, it it moved at the begining of the LRU list.

Author:
dlipsa

Field Summary
 
Fields inherited from class edu.unh.sdb.datasource.DataSource
fdlDescriptor, isActivated, name, wsName
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
DynamicChunking(DataSource dataSource)
          Creates a new instance of DynamicChunking
 
Method Summary
 void activate()
          Activates the cache for the given memory and page size.
 void datum(Datum datum, IndexSpaceID dataId)
          Given an IndexSpaceID, copy the values of the Datum at that position to the argument Datum.
 void datum(Datum dtm, IndexSpaceID did, FieldIDMapper mp)
          not implemented
 void deactivate()
          Dealocate all resources used for the DynamicChunking but do not deactivate the original dataSource.
 IndexSpaceID getBlockDimensions()
           
 DataSource getDataSource()
           
 java.util.Iterator getIterator()
           
 int getMaxMemoryBlockCount()
           
 long getMemory()
           
 java.lang.String getStatistics()
           
protected  ISBounds pageToRead(IndexSpaceID _pageId)
           
 void setBlockDimensions(IndexSpaceID dimensions)
           
 void setMemory(long memory)
           
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock theBlock, ISBounds dstBounds, ISBounds srcBounds, FieldIDMapper mp)
          not implemented
 
Methods inherited from class edu.unh.sdb.datasource.DataSource
checkActivated, clearCache, copyBestID, create, create, create, createRemote, createRemote, createRemoteClient, createRemoteClient, createRemoteDataSource, createRemoteDataSource, createRemoteDataSourceUDP, createRemoteUDP, createRemoteUDP, dumpData, equals, getName, getValues, isActivated, main, toString, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, datum, datum, datum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDouble, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloat, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInt, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShort, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValues, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicChunking

public DynamicChunking(DataSource dataSource)
Creates a new instance of DynamicChunking

Method Detail

getDataSource

public DataSource getDataSource()

setMemory

public void setMemory(long memory)

getMemory

public long getMemory()

setBlockDimensions

public void setBlockDimensions(IndexSpaceID dimensions)

getBlockDimensions

public IndexSpaceID getBlockDimensions()

getStatistics

public java.lang.String getStatistics()

activate

public void activate()
Activates the cache for the given memory and page size. If the memory is 0, it frees any memory that was previously used, if any.

Overrides:
activate in class DataSource

deactivate

public void deactivate()
Dealocate all resources used for the DynamicChunking but do not deactivate the original dataSource.

Overrides:
deactivate in class DataSource

pageToRead

protected ISBounds pageToRead(IndexSpaceID _pageId)

getMaxMemoryBlockCount

public int getMaxMemoryBlockCount()

datum

public void datum(Datum datum,
                  IndexSpaceID dataId)
Description copied from class: DataCollection
Given an IndexSpaceID, copy the values of the Datum at that position to the argument Datum. TODO Define error conditions

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum dtm,
                  IndexSpaceID did,
                  FieldIDMapper mp)
not implemented

Specified by:
datum in interface Indexable
Specified by:
datum in class DataCollection

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds)
Description copied from class: DataCollection
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.

Specified by:
subblock in interface Indexable
Specified by:
subblock in class DataCollection

subblock

public void subblock(DataBlock theBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     FieldIDMapper mp)
not implemented

Specified by:
subblock in interface Indexable
Specified by:
subblock in class DataCollection

getIterator

public java.util.Iterator getIterator()