edu.unh.sdb.datasource
Class DSListStencil

java.lang.Object
  extended by edu.unh.sdb.datasource.DSStencil
      extended by edu.unh.sdb.datasource.DSPartitionedStencil
          extended by edu.unh.sdb.datasource.DSListStencil

public class DSListStencil
extends DSPartitionedStencil

This is an implementation of a partitioned stencil that uses a list of ISIDs to maintain the record of active elements. As a result, the set and get methods are O(n), but iteration is efficient, and less memory is used than with the array implementation. However, it taxes the garbage collector by creating and destroying lots of IndexSpaceIDs, so it may not be so suitable for repeated use.


Field Summary
protected  java.util.ArrayList<IndexSpaceID> partitionList
           
 
Fields inherited from class edu.unh.sdb.datasource.DSPartitionedStencil
headerLength, partitioning, partitioningDimensionsArray, partitionListBytesLength
 
Fields inherited from class edu.unh.sdb.datasource.DSStencil
dimensionality, space
 
Constructor Summary
DSListStencil(RegularISPartitioning partitioning)
          Construct a stencil that identifies areas of interest using a partitioning.
 
Method Summary
 void clear()
          Clear this stencil of all elements.
 boolean get(IndexSpaceID id)
          Return true if the given id maps to an active stencil element, false otherwise.
 ISBounds getIndexedBounds(ISBounds stencilBounds, int index)
          Set the given ISBounds to a shape equal to the indexed stencil element.
protected  long getIndexedOffset(int index)
          Return the partition offset corresponding to the given index.
static void main(java.lang.String[] argv)
           
 boolean set(IndexSpaceID id)
          Set the stencil element containing the id to "active".
 boolean setElement(IndexSpaceID pid)
          Set the stencil element with index corresponding to id to "active.
protected  void setElementFromOffset(int offset)
          Set the element corresponding to the 1D offset to be active.
 int size()
          return number of element contained by this stencil
 
Methods inherited from class edu.unh.sdb.datasource.DSPartitionedStencil
chooseBytesPerValue, getPartitionDimensions, getPartitionDimensionsArray, getPartitioningDimensions, getPartitionListBytes, getPartitionListBytesLength, inPartitioningBounds, inPartitioningBounds, partitionVolume, setPartitionListFromBytes, toString, toString, volume
 
Methods inherited from class edu.unh.sdb.datasource.DSStencil
dim, getIndexedBounds, getSpaceBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

partitionList

protected java.util.ArrayList<IndexSpaceID> partitionList
Constructor Detail

DSListStencil

public DSListStencil(RegularISPartitioning partitioning)
Construct a stencil that identifies areas of interest using a partitioning.

Method Detail

set

public boolean set(IndexSpaceID id)
Set the stencil element containing the id to "active". If it is already active, then the method returns false. Returns true otherwise.

Specified by:
set in class DSStencil

setElement

public boolean setElement(IndexSpaceID pid)
Set the stencil element with index corresponding to id to "active. id should already have been mapped to the partitioning space. If it is already active, then the method returns false. Returns true otherwise.

Specified by:
setElement in class DSStencil

get

public boolean get(IndexSpaceID id)
Return true if the given id maps to an active stencil element, false otherwise.

Specified by:
get in class DSStencil

setElementFromOffset

protected void setElementFromOffset(int offset)
Set the element corresponding to the 1D offset to be active.

Specified by:
setElementFromOffset in class DSPartitionedStencil

getIndexedOffset

protected long getIndexedOffset(int index)
Return the partition offset corresponding to the given index.

Specified by:
getIndexedOffset in class DSPartitionedStencil

getIndexedBounds

public ISBounds getIndexedBounds(ISBounds stencilBounds,
                                 int index)
Set the given ISBounds to a shape equal to the indexed stencil element.

Specified by:
getIndexedBounds in class DSStencil

size

public int size()
return number of element contained by this stencil

Specified by:
size in class DSStencil

clear

public void clear()
Clear this stencil of all elements.

Specified by:
clear in class DSPartitionedStencil

main

public static void main(java.lang.String[] argv)