com.bbn.openmap.dataAccess.iso8211
Class DDFRecord

java.lang.Object
  extended by com.bbn.openmap.dataAccess.iso8211.DDFRecord
All Implemented Interfaces:
DDFConstants

public class DDFRecord
extends java.lang.Object
implements DDFConstants

Contains instance data from one data record (DR). The data is contained as a list of DDFField instances partitioning the raw data into fields. Class contains one DR record from a file. We read into the same record object repeatedly to ensure that repeated leaders can be easily preserved.


Field Summary
protected  boolean bIsClone
           
protected  int nDataSize
           
protected  int nFieldCount
           
protected  int nFieldOffset
           
protected  boolean nReuseHeader
           
protected  byte[] pachData
           
protected  java.util.Vector paoFields
           
protected  DDFModule poModule
           
 
Fields inherited from interface com.bbn.openmap.dataAccess.iso8211.DDFConstants
DDF_FIELD_TERMINATOR, DDF_FOOTER_SIZE, DDF_LEADER_SIZE, DDF_UNIT_TERMINATOR
 
Constructor Summary
DDFRecord(DDFModule poModuleIn)
           
 
Method Summary
 void clear()
          Clear any information associated with the last header in preparation for reading a new header.
 DDFField findField(java.lang.String pszName, int iFieldIndex)
          Find the named field within this record.
 byte[] getData()
          Fetch the raw data for this record.
 int getDataSize()
          Fetch size of records raw data (GetData()) in bytes.
 DDFField getField(int i)
          Fetch field object based on index.
 int getFieldCount()
          Get the number of DDFFields on this record.
 double getFloatSubfield(java.lang.String pszField, int iFieldIndex, java.lang.String pszSubfield, int iSubfieldIndex)
          Fetch value of a subfield as a float (double).
 int getIntSubfield(java.lang.String pszField, int iFieldIndex, java.lang.String pszSubfield, int iSubfieldIndex)
          Fetch value of a subfield as an integer.
 DDFModule getModule()
          Fetch the DDFModule with which this record is associated.
 java.util.Iterator iterator()
          Get an iterator over the fields.
protected  boolean read()
          Read a record of data from the file, and parse the header to build a field list for the record (or reuse the existing one if reusing headers).
protected  boolean readHeader()
          This perform the header reading and parsing job for the read() method.
 java.lang.String toString()
          Write out record contents to debugging file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

poModule

protected DDFModule poModule

nReuseHeader

protected boolean nReuseHeader

nFieldOffset

protected int nFieldOffset

nDataSize

protected int nDataSize

pachData

protected byte[] pachData

nFieldCount

protected int nFieldCount

paoFields

protected java.util.Vector paoFields

bIsClone

protected boolean bIsClone
Constructor Detail

DDFRecord

public DDFRecord(DDFModule poModuleIn)
Method Detail

getFieldCount

public int getFieldCount()
Get the number of DDFFields on this record.


getDataSize

public int getDataSize()
Fetch size of records raw data (GetData()) in bytes.


getData

public byte[] getData()
Fetch the raw data for this record. The returned pointer is effectively to the data for the first field of the record, and is of size GetDataSize().


getModule

public DDFModule getModule()
Fetch the DDFModule with which this record is associated.


toString

public java.lang.String toString()
Write out record contents to debugging file. A variety of information about this record, and all it's fields and subfields is written to the given debugging file handle. Note that field definition information (ala DDFFieldDefn) isn't written.

Overrides:
toString in class java.lang.Object

read

protected boolean read()
Read a record of data from the file, and parse the header to build a field list for the record (or reuse the existing one if reusing headers). It is expected that the file pointer will be positioned at the beginning of a data record. It is the DDFModule's responsibility to do so. This method should only be called by the DDFModule class.


clear

public void clear()
Clear any information associated with the last header in preparation for reading a new header.


readHeader

protected boolean readHeader()
This perform the header reading and parsing job for the read() method. It reads the header, and builds a field list.


findField

public DDFField findField(java.lang.String pszName,
                          int iFieldIndex)
Find the named field within this record.

Parameters:
pszName - The name of the field to fetch. The comparison is case insensitive.
iFieldIndex - The instance of this field to fetch. Use zero (the default) for the first instance.
Returns:
Pointer to the requested DDFField. This pointer is to an internal object, and should not be freed. It remains valid until the next record read.

getField

public DDFField getField(int i)
Fetch field object based on index.

Parameters:
i - The index of the field to fetch. Between 0 and GetFieldCount()-1.
Returns:
A DDFField pointer, or null if the index is out of range.

iterator

public java.util.Iterator iterator()
Get an iterator over the fields.


getIntSubfield

public int getIntSubfield(java.lang.String pszField,
                          int iFieldIndex,
                          java.lang.String pszSubfield,
                          int iSubfieldIndex)
Fetch value of a subfield as an integer. This is a convenience function for fetching a subfield of a field within this record.

Parameters:
pszField - The name of the field containing the subfield.
iFieldIndex - The instance of this field within the record. Use zero for the first instance of this field.
pszSubfield - The name of the subfield within the selected field.
iSubfieldIndex - The instance of this subfield within the record. Use zero for the first instance.
Returns:
The value of the subfield, or zero if it failed for some reason.

getFloatSubfield

public double getFloatSubfield(java.lang.String pszField,
                               int iFieldIndex,
                               java.lang.String pszSubfield,
                               int iSubfieldIndex)
Fetch value of a subfield as a float (double). This is a convenience function for fetching a subfield of a field within this record.

Parameters:
pszField - The name of the field containing the subfield.
iFieldIndex - The instance of this field within the record. Use zero for the first instance of this field.
pszSubfield - The name of the subfield within the selected field.
iSubfieldIndex - The instance of this subfield within the record. Use zero for the first instance.
Returns:
The value of the subfield, or zero if it failed for some reason.


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details