edu.unh.sdb.datasource
Class CompositeBlock

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

public class CompositeBlock
extends DataBlock


Field Summary
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
CompositeBlock(ISBounds isb, RecordDescriptor recordDesc)
          Construct a datablock with the given bounds and RecordDescriptor.
CompositeBlock(ISBounds isb, RecordDescriptor recordDesc, boolean attrOrder)
          Construct a datablock with the given bounds and RecordDescriptor.
CompositeBlock(ISBounds isb, RecordDescriptor recordDesc, FieldIDMapper fm)
          Construct a datablock with the given bounds and RecordDescriptor.
CompositeBlock(ISBounds isb, RecordDescriptor recordDesc, RecordSpec rs)
          Construct a datablock with the given bounds and RecordDescriptor.
 
Method Summary
 void datum(Datum datum, IndexSpaceID did)
          Given IndexSpaceID, load the corresponding datum into the datum argument.
 void datum(Datum dtm, IndexSpaceID did, FieldIDMapper mp)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding FieldIDMapper.
 void datum(Datum dtm, IndexSpaceID did, RecordSpec recSpec)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding RecordSpec.
 void datum(Datum datum, int[] coords)
          Given an array of coordinates, load the corresponding datum into the datum argument.
 Datum datum(IndexSpaceID did)
          Given an IndexSpaceID, return the corresponding datum.
 Datum datum(IndexSpaceID did, RecordSpec spec)
          Given an IndexSpaceID, return the corresponding datum with attributes specified in the RecordSpec.
 BasicBlock getBasicBlock(int bbID)
          given a BasicBlock ID, return a reference to the corresponding basicBlock
 byte getByte(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as a byte.
 byte getByteAttribute(IndexSpaceID did, int fieldNumber)
          get the byte attribute for a given IndexSpaceID and attributeID
 double getDouble(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as a double.
 double getDoubleAttribute(IndexSpaceID did, int fieldNumber)
          get the double attribute for a given IndexSpaceID and attributeID
 void getDoubleAttributes(double[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated double array, attributes specified by recordSpec are copied from this compositeBlock to the dstArray.
 float getFloat(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as a float.
 float getFloatAttribute(IndexSpaceID did, int fieldNumber)
          get the float attribute for a given IndexSpaceID and attributeID
 void getFloatAttributes(float[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated float array, attributes specified by recordSpec are copied from this CompositeBlock to the dstArray.
 double getIndexedDoubleAttribute(int OneDIndex, int fieldNumber)
          get indexedFieldShort , OneDIndex is the conceptual index of the datum in the one D array
 float getIndexedFloatAttribute(int OneDIndex, int fieldNumber)
          get indexed float attribute , OneDIndex is the conceptual index of the datum in the one D array
 int getIndexedIntAttribute(int OneDIndex, int fieldNumber)
          get indexed int attribue, OneDIndex is the conceptual index of the datum in the one D array
 short getIndexedShortAttribute(int OneDIndex, int fieldNumber)
          get indexed Short attribute, OneDIndex is the conceptual index of the datum in the one D array
 int getInt(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as an int.
 int getIntAttribute(IndexSpaceID did, int fieldNumber)
          get the int attribute for a given IndexSpaceID and attributeID
 void getIntAttributes(int[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated int array, attributes specified by recordSpec are copied from this Compositeblock to the dstArray.
 int getNumBasicBlock()
          return number of basicBlocks contained in this Compositeblock
 short getShort(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as a short.
 short getShortAttribute(IndexSpaceID did, int fieldNumber)
          get the short attribute for a given IndexSpaceID and attributeID
 void getShortAttributes(short[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated short array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray.
 Values getValues(int attr)
          return a Values array consisting of the data for the specified attribute.
 edu.unh.sdb.datasource.CompositeBlock.FieldInfo locateAttribute(int fieldID)
          given a fieldID (fieldID of this compositeBlock, return a array with length of two, first element of the array represents the basicBlock number, and second element represents the corresponding fieldID in the basicBlock.
protected  void setAttributeOrderRod(java.nio.ByteBuffer rod, int rodSize, int iniDataArrayOffset, int dataArrayStep, int attributeID, int attributeByteSize, int storageType)
          set a rod of data in the corresponding location of this datablock, assume the rod contains only one attribute, works for attributeOrder
 void setBytes(int attr, byte[] newValues)
          Assign attribute values for all points in the block
 void setDatum(IndexSpaceID isid, Datum d)
          Set the location specified by the IndexSpaceID to the given datum.
 void setDoubles(int attr, double[] newValues)
          Assign attribute values for all points in the block
 void setField(int index, double doubleData, int fieldID)
          set double data of a given attribute at a given index ( index of the datum in the one D array )
 void setField(int index, float floatData, int fieldID)
          set float data of a given attribute at a given index ( index of the datum in the one D array )
 void setField(int index, int intData, int fieldID)
          set int data of a given attribute at a given index ( index of the datum in the one D array )
 void setField(int index, short shortData, int fieldID)
          set short data of a given attribute at a given index ( index of the datum in the one D array )
 void setFloats(int attr, float[] newValues)
          Assign attribute values for all points in the block
 void setInts(int attr, int[] newValues)
          Assign attribute values for all points in the block
protected  void setrod(java.nio.ByteBuffer rod, int rodSize, int iniDataArrayOffset, int dataArrayStep, FieldIDMapper mp, RecordDescriptor sourceRecordDesc)
          set a rod of data in the corresponding location of this datablock
protected  void setrod(java.nio.ByteBuffer rod, int rodSize, int iniDataArrayOffset, int dataArrayStep, RecordDescriptor sourceRecordDesc)
          set a rod of data in the corresponding location of this datablock
protected  void setrod(java.nio.ByteBuffer rod, int rodSize, int iniDataArrayOffset, int dataArrayStep, RecordSpec recSpec, RecordDescriptor sourceRecordDesc)
          set a rod of data in the corresponding location of this datablock
 void setShorts(int attr, short[] newValues)
          Assign attribute values for all points in the block
 void setValues(int attr, Values newValues)
          Assign attribute values for all points in the block
 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 dstBlock, ISBounds dstBounds, ISBounds srcBounds, FieldIDMapper mp)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds, RecordSpec spec)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 DataBlock subblock(ISBounds db)
          Return a new DataBlock( currently it returns a CompositeBlock) that is a subset of this datablock.
 DataBlock subblock(ISBounds srcBounds, RecordSpec rs)
          the returning DataBlock is a CompositeBlock
 
Methods inherited from class edu.unh.sdb.datasource.DataBlock
getValues, setByAttribute, setByte, setBytes, setBytesByAttribute, setBytesByPoint, setDouble, setDoubles, setDoublesByAttribute, setDoublesByPoint, setFloat, setFloats, setFloatsByAttribute, setFloatsByPoint, setInt, setInts, setIntsByAttribute, setIntsByPoint, setShort, setShorts, setShortsByAttribute, setShortsByPoint, setValues, setValuesByAttribute, setValuesByPoint, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeBlock

public CompositeBlock(ISBounds isb,
                      RecordDescriptor recordDesc)
Construct a datablock with the given bounds and RecordDescriptor. Internal data arrays will be allocated according to the bounds and recordDesc. The attributes will be stored in attribute order, which means that each attribute will be in its own BasicBlock. This will be more efficient if the applications want to extract all the values for a particular attribute.


CompositeBlock

public CompositeBlock(ISBounds isb,
                      RecordDescriptor recordDesc,
                      boolean attrOrder)
Construct a datablock with the given bounds and RecordDescriptor. Internal data arrays will be allocated according to the bounds and recordDesc. The attributes will be stored by type. If the third argument is true, they will be stored entirely by attribute, which means that each attribute will be in its own BasicBlock. This will be more efficient if the applications want to extract all the values for a particular attribute. If the third attribute is false, the attributes of the same storage type will be stored together in a single array in point order. That is, the attributes of the same type for a given spatial position will be adjacent in the array.


CompositeBlock

public CompositeBlock(ISBounds isb,
                      RecordDescriptor recordDesc,
                      RecordSpec rs)
Construct a datablock with the given bounds and RecordDescriptor. Select a subset of attributes based on the RecordSpec. Appropriate internal data arrays will be allocated.


CompositeBlock

public CompositeBlock(ISBounds isb,
                      RecordDescriptor recordDesc,
                      FieldIDMapper fm)
Construct a datablock with the given bounds and RecordDescriptor. Select a subset of attributes based on the RecordSpec. Appropriate internal data arrays will be allocated.

Method Detail

locateAttribute

public edu.unh.sdb.datasource.CompositeBlock.FieldInfo locateAttribute(int fieldID)
given a fieldID (fieldID of this compositeBlock, return a array with length of two, first element of the array represents the basicBlock number, and second element represents the corresponding fieldID in the basicBlock.


getBasicBlock

public BasicBlock getBasicBlock(int bbID)
given a BasicBlock ID, return a reference to the corresponding basicBlock


getNumBasicBlock

public int getNumBasicBlock()
return number of basicBlocks contained in this Compositeblock


setrod

protected void setrod(java.nio.ByteBuffer rod,
                      int rodSize,
                      int iniDataArrayOffset,
                      int dataArrayStep,
                      FieldIDMapper mp,
                      RecordDescriptor sourceRecordDesc)
set a rod of data in the corresponding location of this datablock


setrod

protected void setrod(java.nio.ByteBuffer rod,
                      int rodSize,
                      int iniDataArrayOffset,
                      int dataArrayStep,
                      RecordSpec recSpec,
                      RecordDescriptor sourceRecordDesc)
set a rod of data in the corresponding location of this datablock


setrod

protected void setrod(java.nio.ByteBuffer rod,
                      int rodSize,
                      int iniDataArrayOffset,
                      int dataArrayStep,
                      RecordDescriptor sourceRecordDesc)
set a rod of data in the corresponding location of this datablock


setAttributeOrderRod

protected void setAttributeOrderRod(java.nio.ByteBuffer rod,
                                    int rodSize,
                                    int iniDataArrayOffset,
                                    int dataArrayStep,
                                    int attributeID,
                                    int attributeByteSize,
                                    int storageType)
set a rod of data in the corresponding location of this datablock, assume the rod contains only one attribute, works for attributeOrder


setField

public final void setField(int index,
                           float floatData,
                           int fieldID)
set float data of a given attribute at a given index ( index of the datum in the one D array )


setField

public final void setField(int index,
                           int intData,
                           int fieldID)
set int data of a given attribute at a given index ( index of the datum in the one D array )


setField

public final void setField(int index,
                           double doubleData,
                           int fieldID)
set double data of a given attribute at a given index ( index of the datum in the one D array )


setField

public final void setField(int index,
                           short shortData,
                           int fieldID)
set short data of a given attribute at a given index ( index of the datum in the one D array )


getValues

public Values getValues(int attr)
return a Values array consisting of the data for the specified attribute.

Overrides:
getValues in class DataCollection

getDouble

public double getDouble(IndexSpaceID did,
                        int fieldNumber)
get the field value at the ISID position as a double. Convert type if necessary.

Overrides:
getDouble in class DataCollection

getFloat

public float getFloat(IndexSpaceID did,
                      int fieldNumber)
get the field value at the ISID position as a float. Convert type if necessary.

Overrides:
getFloat in class DataCollection

getInt

public int getInt(IndexSpaceID did,
                  int fieldNumber)
get the field value at the ISID position as an int. Convert type if necessary.

Overrides:
getInt in class DataCollection

getShort

public short getShort(IndexSpaceID did,
                      int fieldNumber)
get the field value at the ISID position as a short. Convert type if necessary.

Overrides:
getShort in class DataCollection

getByte

public byte getByte(IndexSpaceID did,
                    int fieldNumber)
get the field value at the ISID position as a byte. Convert type if necessary.

Overrides:
getByte in class DataCollection

getDoubleAttribute

public final double getDoubleAttribute(IndexSpaceID did,
                                       int fieldNumber)
get the double attribute for a given IndexSpaceID and attributeID


getFloatAttribute

public final float getFloatAttribute(IndexSpaceID did,
                                     int fieldNumber)
get the float attribute for a given IndexSpaceID and attributeID


getIntAttribute

public final int getIntAttribute(IndexSpaceID did,
                                 int fieldNumber)
get the int attribute for a given IndexSpaceID and attributeID


getShortAttribute

public final short getShortAttribute(IndexSpaceID did,
                                     int fieldNumber)
get the short attribute for a given IndexSpaceID and attributeID


getByteAttribute

public final byte getByteAttribute(IndexSpaceID did,
                                   int fieldNumber)
get the byte attribute for a given IndexSpaceID and attributeID


getIndexedFloatAttribute

public float getIndexedFloatAttribute(int OneDIndex,
                                      int fieldNumber)
get indexed float attribute , OneDIndex is the conceptual index of the datum in the one D array


getIndexedShortAttribute

public short getIndexedShortAttribute(int OneDIndex,
                                      int fieldNumber)
get indexed Short attribute, OneDIndex is the conceptual index of the datum in the one D array


getIndexedIntAttribute

public int getIndexedIntAttribute(int OneDIndex,
                                  int fieldNumber)
get indexed int attribue, OneDIndex is the conceptual index of the datum in the one D array


getIndexedDoubleAttribute

public double getIndexedDoubleAttribute(int OneDIndex,
                                        int fieldNumber)
get indexedFieldShort , OneDIndex is the conceptual index of the datum in the one D array


getShortAttributes

public void getShortAttributes(short[] dstArray,
                               RecordSpec recordSpec,
                               boolean pointOrder)
User passes in a pre-allocated short array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into shorts if they are not stored as shorts in this BasicBlock.


getDoubleAttributes

public void getDoubleAttributes(double[] dstArray,
                                RecordSpec recordSpec,
                                boolean pointOrder)
User passes in a pre-allocated double array, attributes specified by recordSpec are copied from this compositeBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into doubles if they are not stored as doulbes in this CompositeBlock.


getFloatAttributes

public void getFloatAttributes(float[] dstArray,
                               RecordSpec recordSpec,
                               boolean pointOrder)
User passes in a pre-allocated float array, attributes specified by recordSpec are copied from this CompositeBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into floats if they are not stored as float in this CompositeBlock.


getIntAttributes

public void getIntAttributes(int[] dstArray,
                             RecordSpec recordSpec,
                             boolean pointOrder)
User passes in a pre-allocated int array, attributes specified by recordSpec are copied from this Compositeblock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into ints if they are not stored as ints in this CompositeBlock.


datum

public Datum datum(IndexSpaceID did)
Given an IndexSpaceID, return the corresponding datum.

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

datum

public void datum(Datum datum,
                  IndexSpaceID did)
Given IndexSpaceID, load the corresponding datum into the datum argument. data will be converted into float if it is not stored as float in this compositeBlock

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

datum

public void datum(Datum datum,
                  int[] coords)
Given an array of coordinates, load the corresponding datum into the datum argument. Note: only works for floats

Overrides:
datum in class DataCollection

datum

public Datum datum(IndexSpaceID did,
                   RecordSpec spec)
Given an IndexSpaceID, return the corresponding datum with attributes specified in the RecordSpec.

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

datum

public void datum(Datum dtm,
                  IndexSpaceID did,
                  FieldIDMapper mp)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding FieldIDMapper.

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

datum

public void datum(Datum dtm,
                  IndexSpaceID did,
                  RecordSpec recSpec)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding RecordSpec.

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

setDatum

public void setDatum(IndexSpaceID isid,
                     Datum d)
Set the location specified by the IndexSpaceID to the given datum.

Specified by:
setDatum in class DataBlock

subblock

public DataBlock subblock(ISBounds db)
Return a new DataBlock( currently it returns a CompositeBlock) that is a subset of this datablock. Data is copied from this DataBlock to the return DataBlock

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

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The dstBlock has to be a compositeBlock. Currently we do not support subblocking from CompositeBlock to BasicBlock

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

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     FieldIDMapper mp)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The FieldIDMapper argument determines the mapping between datums in this DataBlock and datums in the argument DataBlock.

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

subblock

public DataBlock subblock(ISBounds srcBounds,
                          RecordSpec rs)
the returning DataBlock is a CompositeBlock

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

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     RecordSpec spec)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The RecordSpec argument specifies a subset of the attributes of this DataSource to be written into the DataBlock datums. currently the dstBlock has to be a compositeBlock

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

setDoubles

public void setDoubles(int attr,
                       double[] newValues)
Assign attribute values for all points in the block

Overrides:
setDoubles in class DataBlock

setFloats

public void setFloats(int attr,
                      float[] newValues)
Assign attribute values for all points in the block

Overrides:
setFloats in class DataBlock

setInts

public void setInts(int attr,
                    int[] newValues)
Assign attribute values for all points in the block

Overrides:
setInts in class DataBlock

setShorts

public void setShorts(int attr,
                      short[] newValues)
Assign attribute values for all points in the block

Overrides:
setShorts in class DataBlock

setBytes

public void setBytes(int attr,
                     byte[] newValues)
Assign attribute values for all points in the block

Overrides:
setBytes in class DataBlock

setValues

public void setValues(int attr,
                      Values newValues)
Assign attribute values for all points in the block

Overrides:
setValues in class DataBlock