Class ChunkDataAccessor

java.lang.Object
noaa.coastwatch.util.chunk.ChunkDataAccessor
All Implemented Interfaces:
ChunkVisitor

public class ChunkDataAccessor extends Object implements ChunkVisitor

The ChunkDataAccessor class is a visitor that makes (possibly unpacked) data values available from any type of DataChunk instance. The type of data available after the visitor is accepted by a chunk can be determined from the DataChunk.getExternalType() method.

The family of methods for accessing chunk data values in this class takes the form getXXXValue(int) where XXX is one of either Byte, Short, Int, Long, Float, or Double. The isMissingValue(int) method is used to determine if a data value at a given index is invalid or missing, for any integer and floating-point data.

Since:
3.4.0
Author:
Peter Hollemans
  • Constructor Details

    • ChunkDataAccessor

      public ChunkDataAccessor()
  • Method Details

    • setMissingMode

      public void setMissingMode(boolean flag)
      Sets the missing mode flag. In missing mode, only the missing array values are computed and stored by the accessor. This saves access time and memory. By default the missing mode is off and all data values are extracted as well.
      Parameters:
      flag - the mimssing mode flag.
      Since:
      3.8.1
    • visitByteChunk

      public void visitByteChunk(ByteChunk chunk)
      Description copied from interface: ChunkVisitor
      Visits a chunk of native byte data.
      Specified by:
      visitByteChunk in interface ChunkVisitor
      Parameters:
      chunk - the byte chunk to visit.
    • visitShortChunk

      public void visitShortChunk(ShortChunk chunk)
      Description copied from interface: ChunkVisitor
      Visits a chunk of native short data.
      Specified by:
      visitShortChunk in interface ChunkVisitor
      Parameters:
      chunk - the short chunk to visit.
    • visitIntChunk

      public void visitIntChunk(IntChunk chunk)
      Description copied from interface: ChunkVisitor
      Visits a chunk of native int data.
      Specified by:
      visitIntChunk in interface ChunkVisitor
      Parameters:
      chunk - the int chunk to visit.
    • visitLongChunk

      public void visitLongChunk(LongChunk chunk)
      Description copied from interface: ChunkVisitor
      Visits a chunk of native long data.
      Specified by:
      visitLongChunk in interface ChunkVisitor
      Parameters:
      chunk - the long chunk to visit.
    • visitFloatChunk

      public void visitFloatChunk(FloatChunk chunk)
      Description copied from interface: ChunkVisitor
      Visits a chunk of native float data.
      Specified by:
      visitFloatChunk in interface ChunkVisitor
      Parameters:
      chunk - the float chunk to visit.
    • visitDoubleChunk

      public void visitDoubleChunk(DoubleChunk chunk)
      Description copied from interface: ChunkVisitor
      Visits a chunk of native double data.
      Specified by:
      visitDoubleChunk in interface ChunkVisitor
      Parameters:
      chunk - the double chunk to visit.
    • isMissingValue

      public boolean isMissingValue(int index)
    • getByteValue

      public byte getByteValue(int index)
    • getShortValue

      public short getShortValue(int index)
    • getIntValue

      public int getIntValue(int index)
    • getLongValue

      public long getLongValue(int index)
    • getFloatValue

      public float getFloatValue(int index)
    • getDoubleValue

      public double getDoubleValue(int index)
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception
      Since:
      3.6.1