ucar.nc2
Class RegularIndexer

java.lang.Object
  extended by ucar.nc2.Indexer
      extended by ucar.nc2.RegularIndexer

public class RegularIndexer
extends Indexer

Indexer into a regular array. This calculates byte lengths and offsets of the wanted data into the entire data. Assumes that the data is stored "regularly", like netcdf arrays and hdf5 continuous storage. Also handles netcdf3 record dimensions.

Version:
$Revision: 51 $ $Date: 2006-07-12 17:13:13Z $
Author:
caron

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.Indexer
Indexer.Chunk
 
Constructor Summary
RegularIndexer(int[] varShape, int elemSize, long startPos, java.util.List section, int recSize)
          Constructor.
 
Method Summary
 int getElemSize()
           
 int getTotalNelems()
           
 int[] getWantShape()
           
 boolean hasNext()
           
 Indexer.Chunk next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegularIndexer

public RegularIndexer(int[] varShape,
                      int elemSize,
                      long startPos,
                      java.util.List section,
                      int recSize)
               throws InvalidRangeException
Constructor.

Parameters:
varShape - shape of the entire data array.
elemSize - size of on element in bytes.
startPos - starting address of the entire data array.
section - the wanted section of data: List of Range objects, corresponding to each Dimension, else null means all.
recSize - if > 0, then size of outer stride in bytes, else ignored
Throws:
InvalidRangeException - is ranges are misformed
Method Detail

getWantShape

public int[] getWantShape()

getTotalNelems

public int getTotalNelems()
Specified by:
getTotalNelems in class Indexer
Returns:
total number of elements in the wanted subset.

getElemSize

public int getElemSize()
Specified by:
getElemSize in class Indexer
Returns:
size of each element in bytes.

hasNext

public boolean hasNext()
Specified by:
hasNext in class Indexer
Returns:
true if theres more to do

next

public Indexer.Chunk next()
Specified by:
next in class Indexer
Returns:
next chunk