com.bbn.openmap.dataAccess.iso8211
Class DDFFieldDefinition

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

public class DDFFieldDefinition
extends java.lang.Object
implements DDFConstants

Information from the DDR defining one field. Note that just because a field is defined for a DDFModule doesn't mean that it actually occurs on any records in the module. DDFFieldDefns are normally just significant as containers of the DDFSubfieldDefinitions.


Nested Class Summary
static class DDFFieldDefinition.DataStructCode
           
static class DDFFieldDefinition.DataTypeCode
           
 
Field Summary
protected  java.lang.String _arrayDescr
           
protected  DDFFieldDefinition.DataStructCode _data_struct_code
           
protected  DDFFieldDefinition.DataTypeCode _data_type_code
           
protected  java.lang.String _fieldName
           
protected  java.lang.String _formatControls
           
protected  boolean bRepeatingSubfields
           
protected  int nFixedWidth
           
protected  java.util.Vector paoSubfieldDefns
           
protected  DDFModule poModule
           
protected  java.lang.String pszTag
           
 
Fields inherited from interface com.bbn.openmap.dataAccess.iso8211.DDFConstants
DDF_FIELD_TERMINATOR, DDF_FOOTER_SIZE, DDF_LEADER_SIZE, DDF_UNIT_TERMINATOR
 
Constructor Summary
DDFFieldDefinition()
           
DDFFieldDefinition(DDFModule poModuleIn, java.lang.String pszTagIn, byte[] pachFieldArea)
           
 
Method Summary
protected  boolean applyFormats(java.lang.String _formatControls)
          This method parses the format string partially, and then applies a subfield format string to each subfield object.
protected  boolean buildSubfieldDefns(java.lang.String pszSublist)
          Based on the list contained in the string, build a set of subfield definitions.
protected  java.lang.String expandFormat(java.lang.String pszSrc)
          Given a string that contains a coded size symbol, expand it out.
protected  java.lang.String extractSubstring(java.lang.String pszSrc)
          Extract a substring terminated by a comma (or end of string).
 DDFSubfieldDefinition findSubfieldDefn(java.lang.String pszMnemonic)
          Find a subfield definition by it's mnemonic tag.
 java.lang.String getDescription()
          Fetch a longer descriptio of this field.
 int getFixedWidth()
          Get the width of this field.
 java.lang.String getName()
          Fetch a pointer to the field name (tag).
 int getSubfieldCount()
          Get the number of subfields.
 DDFSubfieldDefinition getSubfieldDefn(int i)
          Fetch a subfield by index.
 boolean initialize(DDFModule poModuleIn, java.lang.String pszTagIn, byte[] pachFieldArea)
          Initialize the field definition from the information in the DDR record.
 boolean isRepeating()
          Fetch repeating flag.
 void setRepeating(boolean val)
          this is just for an S-57 hack for swedish data
 java.lang.String toString()
          Write out field definition info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

poModule

protected DDFModule poModule

pszTag

protected java.lang.String pszTag

_fieldName

protected java.lang.String _fieldName

_arrayDescr

protected java.lang.String _arrayDescr

_formatControls

protected java.lang.String _formatControls

bRepeatingSubfields

protected boolean bRepeatingSubfields

nFixedWidth

protected int nFixedWidth

_data_struct_code

protected DDFFieldDefinition.DataStructCode _data_struct_code

_data_type_code

protected DDFFieldDefinition.DataTypeCode _data_type_code

paoSubfieldDefns

protected java.util.Vector paoSubfieldDefns
Constructor Detail

DDFFieldDefinition

public DDFFieldDefinition()

DDFFieldDefinition

public DDFFieldDefinition(DDFModule poModuleIn,
                          java.lang.String pszTagIn,
                          byte[] pachFieldArea)
Method Detail

getName

public java.lang.String getName()
Fetch a pointer to the field name (tag).

Returns:
this is an internal copy and shouldn't be freed.

getDescription

public java.lang.String getDescription()
Fetch a longer descriptio of this field.

Returns:
this is an internal copy and shouldn't be freed.

getSubfieldCount

public int getSubfieldCount()
Get the number of subfields.


getFixedWidth

public int getFixedWidth()
Get the width of this field. This function isn't normally used by applications.

Returns:
The width of the field in bytes, or zero if the field is not apparently of a fixed width.

isRepeating

public boolean isRepeating()
Fetch repeating flag.

Returns:
true if the field is marked as repeating.

setRepeating

public void setRepeating(boolean val)
this is just for an S-57 hack for swedish data


initialize

public boolean initialize(DDFModule poModuleIn,
                          java.lang.String pszTagIn,
                          byte[] pachFieldArea)
Initialize the field definition from the information in the DDR record. This is called by DDFModule.open().

Parameters:
poModuleIn - DDFModule representing file being read.
pszTagIn - the name of this field.
pachFieldArea - the data bytes in the file representing the field from the header.

toString

public java.lang.String toString()
Write out field definition info. A variety of information about this field definition, and all its subfields are written out too.

Overrides:
toString in class java.lang.Object

buildSubfieldDefns

protected boolean buildSubfieldDefns(java.lang.String pszSublist)
Based on the list contained in the string, build a set of subfield definitions.


extractSubstring

protected java.lang.String extractSubstring(java.lang.String pszSrc)
Extract a substring terminated by a comma (or end of string). Commas in brackets are ignored as terminated with bracket nesting understood gracefully. If the returned string would being and end with a bracket then strip off the brackets.

Given a string like "(A,3(B,C),D),X,Y)" return "A,3(B,C),D". Give a string like "3A,2C" return "3A".


expandFormat

protected java.lang.String expandFormat(java.lang.String pszSrc)
Given a string that contains a coded size symbol, expand it out.


applyFormats

protected boolean applyFormats(java.lang.String _formatControls)
This method parses the format string partially, and then applies a subfield format string to each subfield object. It in turn does final parsing of the subfield formats.


findSubfieldDefn

public DDFSubfieldDefinition findSubfieldDefn(java.lang.String pszMnemonic)
Find a subfield definition by it's mnemonic tag.

Parameters:
pszMnemonic - The name of the field.
Returns:
The subfield pointer, or null if there isn't any such subfield.

getSubfieldDefn

public DDFSubfieldDefinition getSubfieldDefn(int i)
Fetch a subfield by index.

Parameters:
i - The index subfield index. (Between 0 and GetSubfieldCount()-1)
Returns:
The subfield pointer, or null if the index is out of range.


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