edu.iris.Fissures.seed.container
Class Blockette

java.lang.Object
  extended by edu.iris.Fissures.seed.container.SeedObject
      extended by edu.iris.Fissures.seed.container.Blockette
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
CachedBlocketteDecorator

public class Blockette
extends SeedObject

Generic class of all SEED blockettes and Fixed Section Data Header (FSDH) contents. Intended to be instantiated by BlocketteFactory class. All of the constructors are protected permissions so that we can keep a rein on how the objects are created and invoked...they really have a dependency on the BlocketteFactory, since that class contains the background information on all of the supported blockette types.

Version:
January 2010
Author:
Robert Casey, IRIS DMC
Sid Hellman, ISTI
Kevin Frechette, ISTI
See Also:
Serialized Form

Field Summary
protected  int blocketteType
           
protected  BlocketteVector childBlocketteVec
           
protected static float defaultSEEDVersion
           
protected  java.util.Vector fieldValue
           
protected  boolean incompleteFlag
           
protected  int lookupId
           
protected  java.util.Vector lookupMap
           
protected static float maxSEEDVersion
           
protected static float minSEEDVersion
           
protected  int numBytes
           
protected  Blockette parentBlockette
           
protected  float version
           
protected  Waveform waveformData
           
 
Method Summary
 int addChildBlockette(Blockette addBlockette)
          Add a child blockette to this blockette.
 int addDictionaryLookup(int abbrevLookupId)
          Add lookupId value from an outside abbreviation dictionary blockette to the lookupMap Vector in this blockette.
 int addDictionaryLookupIfNeeded(int abbrevLookupId)
          Add lookupId value from an outside abbreviation dictionary blockette to the lookupMap Vector in this blockette if it is not already there.
 void addFieldGrp(int fieldNum, java.util.Vector valueVec)
          Add a new repeat field group starting at the specified field number.
 void attachParent(Blockette parent)
          Designate the provided Blockette as this Blockette's parent.
 void attachWaveform(Waveform data)
          Attach waveform object to this blockette.
 void deleteFieldGrp(int fieldNum, int fieldIndex)
          Remove a repeat group at the indicated index.
 java.lang.String getCategory()
          Get the control header type of this blockette.
 Blockette getChildBlockette(int index)
          Get the child blockette associated with this blockette from the specified Vector index.
static float getDefaultVersion()
          Get the default SEED version for Blockettes.
 java.lang.String getDefinition()
          Return the entire description of this blockette type.
 int getDictionaryLookup(int index)
          Get the dictionary lookup value from the specified Vector index.
 java.util.Vector getFieldGrp(int fieldNum, int fieldIndex)
          Get a repeating field group cross-section in the form of a vector.
 java.lang.String getFieldLength(int fieldNum)
          Get the length of the field in bytes.
 java.lang.String getFieldMask(int fieldNum)
          Get the string expression of the mask or flag for this field.
 java.lang.String getFieldName(int fieldNum)
          Get the full name of the specified field.
 java.lang.Object getFieldObject(int fieldNum)
          Return the raw object assigned to this field number, regardless of the contents, or whether it is a repeat field or a repeat field with list values.
 int getFieldRepeat(int fieldNum)
          Get the field number that indicates the number of times this field repeats.
 java.lang.String getFieldType(int fieldNum)
          Get the letter that represents the field type.
 java.lang.Object getFieldVal(int fieldNum)
          Returns a single object value at the field number indicated.
 java.lang.Object getFieldVal(int fieldNum, int fieldIndex)
          Returns the value at the field number...NOTE that this is an Object.
 int getLookupId()
          Return the lookupId for this blockette.
 java.lang.String getName()
          Get the full name of this blockette.
 int getNumBytes()
          Returns the number of bytes read to generate this blockette.
 int getNumFields()
          Get the number of available fields in this blockette.
 Blockette getParentBlockette()
          Return the designated parent Blockette object.
 int getStageNumber()
          Return the stage number of this blockette IF it is a response blockette.
 int getType()
          Return the blockette type number.
 float getVersion()
          Return the SEED version represented in this blockette.
 Waveform getWaveform()
          Get the attached waveform object.
 boolean hasParent()
          Return true if this Blockette has a designated parent.
 void initialize(byte[] blocketteStream, boolean swapFlag, boolean isData)
          Resets this Blockette object to initialization state.
 void initialize(byte[] blocketteStream, boolean swapFlag, boolean isData, float version)
          Resets this Blockette object to initialization state.
 void initialize(java.lang.String inputString)
          Resets this Blockette object to initialization state.
 void initialize(java.lang.String inputString, float version)
          Resets this Blockette object to initialization state.
 void initialize(java.lang.String inputString, java.lang.String delimiter, java.lang.String blank)
          Resets this Blockette object to initialization state.
 void initialize(java.lang.String inputString, java.lang.String delimiter, java.lang.String blank, float version)
          Resets this Blockette object to initialization state.
 void insertFieldGrp(int fieldNum, int fieldIndex, java.util.Vector valueVec)
          Insert a repeat group before the indicated index.
protected  void instanceInit()
          Initialize instance variables.
 boolean isIncomplete()
          Return true if this blockette was not completely specified.
protected  boolean isPunctuation(char c)
          Indicate TRUE if this is character is some form of punctuation.
 boolean isResponseBlockette()
          Return true if this is a response blockette -- i.e.
 int numberofChildBlockettes()
          Return the number of child blockettes stored in this blockette.
 int numberofDictionaryLookups()
          Return the number of dictionary entries in the lookupMap.
 int purgeFieldGrp(int fieldNum)
          Completely erase contents of a field group where the first field of the group is fieldNum.
 void removeChildBlockette(int index)
          Remove child blockette reference at the indicated index.
 void removeParent()
          Remove the parent reference in this Blockette.
 void removeWaveform()
          Remove the attached waveform object from this blockette.
 void replaceChildBlockette(int index, Blockette newBlockette)
          Replace child blockette at the indicated index with a new blockette.
protected  int setByteStream(byte[] blocketteStream, boolean swapFlag, boolean isData)
          Establish the blockette contents through a byte stream written in SEED blockette format.
 void setDictionaryLookup(int index, int abbrevLookupId)
          Set the lookupId value of an abbreviation dictionary blockette for a corresponding index value, replacing an existing entry at that index.
 void setFieldObject(int fieldNum, java.lang.Object fieldObj)
          Similar to setFieldVal, except that the provided object can be whatever construct is needed to reflect the field contents.
protected  void setFieldString(int blkType, int fieldNum, int fieldIndex, java.lang.String addVal)
          Set a specific blockette field to a value specified as a String.
protected  void setFieldString(int blkType, int fieldNum, int fieldIndex, java.lang.String addVal, boolean lenient)
          Set a specific blockette field to a value specified as a String.
 void setFieldVal(int fieldNum, int fieldIndex, java.lang.Object value)
          Apply value contained in the provided object to the indicated field position in the blockette.
 void setFieldVal(int fieldNum, int fieldIndex, java.lang.Object value, boolean lenient)
          Apply value contained in the provided object to the indicated field position in the blockette.
 void setFieldVal(int fieldNum, java.lang.Object value)
          Apply value contained in the provided object to the indicated field position in the blockette.
 void setLookupId(int idValue)
          Set the lookupId value of this blockette.
 void setStageNumber(int stageNum)
           
 void setStageNumber(java.lang.Integer stageNum)
          Set the stage number of this blockette to the indicated value, but only if it is a response blockette.
protected  void setTokenString(java.lang.String inputString, java.lang.String delimiter, java.lang.String blank)
          Initialize the blockette with a character-delimited string.
protected  void setType()
          update/set the blockette type
protected  void setType(int i)
          allow explicit setting of the type -- use with caution!
 void setValuesFrom(java.lang.String inputString)
          Like initialize() except that the Blockette is not fully reset.
 void setValuesFrom(java.lang.String inputString, java.lang.String delimiter, java.lang.String blank)
          Like initialize() except that the Blockette is not fully reset.
 void setVersion(float ver)
          Set the SEED version that this blockette represents.
 java.lang.String toBlkFldString()
          Convert entire Blockette contents into a block/field string.
 java.lang.String toString()
          Convert entire Blockette contents into a tokenized string.
 java.lang.String toString(int fieldNum)
          Convert Blockette field value to a properly formatted string.
 java.lang.String toString(int fieldNum, int fieldIndex)
          Convert Blockette field value to a properly formatted string.
 java.lang.String toString(java.lang.String delimiter, java.lang.String blank)
          Convert entire Blockette contents into a tokenized string.
 java.lang.String toString(java.lang.String delimiter, java.lang.String blank, java.lang.String blkFldSpace)
          Convert entire Blockette contents into a tokenized string.
 java.lang.String translate(int fieldNum)
          Translate the value located at the blockette's field number, if there is one.
 
Methods inherited from class edu.iris.Fissures.seed.container.SeedObject
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fieldValue

protected java.util.Vector fieldValue

childBlocketteVec

protected BlocketteVector childBlocketteVec

parentBlockette

protected Blockette parentBlockette

waveformData

protected Waveform waveformData

lookupMap

protected java.util.Vector lookupMap

lookupId

protected int lookupId

blocketteType

protected int blocketteType

version

protected float version

minSEEDVersion

protected static final float minSEEDVersion
See Also:
Constant Field Values

maxSEEDVersion

protected static final float maxSEEDVersion
See Also:
Constant Field Values

defaultSEEDVersion

protected static final float defaultSEEDVersion

numBytes

protected int numBytes

incompleteFlag

protected boolean incompleteFlag
Method Detail

initialize

public void initialize(byte[] blocketteStream,
                       boolean swapFlag,
                       boolean isData,
                       float version)
                throws SeedException
Resets this Blockette object to initialization state. All previous information stored is removed. Used for optimization through object reuse. Is publicly callable and readies the object to be used again. Accept a stream of bytes that starts at byte zero of a blockette, with indicated flag to swap bytes to Java-endian (68000), flag indicating a binary data blockette, and SEED version number.

Throws:
SeedException

initialize

public void initialize(byte[] blocketteStream,
                       boolean swapFlag,
                       boolean isData)
                throws SeedException
Resets this Blockette object to initialization state. All previous information stored is removed. Used for optimization through object reuse. Is publicly callable and readies the object to be used again. Accept a stream of bytes that starts at byte zero of a blockette, with indicated flag to swap bytes to Java-endian (68000), and flag indicating a binary data blockette for default SEED version.

Throws:
SeedException

initialize

public void initialize(java.lang.String inputString,
                       java.lang.String delimiter,
                       java.lang.String blank,
                       float version)
                throws SeedException
Resets this Blockette object to initialization state. All previous information stored is removed. Used for optimization through object reuse. Is publicly callable and readies the object to be used again. Accept a delimited String as input, along with the SEED version this blockette will comply with. Delimiter characters are specified.

Throws:
SeedException

initialize

public void initialize(java.lang.String inputString,
                       java.lang.String delimiter,
                       java.lang.String blank)
                throws SeedException
Resets this Blockette object to initialization state. All previous information stored is removed. Used for optimization through object reuse. Is publicly callable and readies the object to be used again. Accept a delimited String as input. Default SEED version is used. Delimiter characters are specified.

Throws:
SeedException

initialize

public void initialize(java.lang.String inputString)
                throws SeedException
Resets this Blockette object to initialization state. All previous information stored is removed. Used for optimization through object reuse. Is publicly callable and readies the object to be used again. Accept a delimited String as input. Default SEED version is used. Default delimiter characters are used.

Throws:
SeedException

initialize

public void initialize(java.lang.String inputString,
                       float version)
                throws SeedException
Resets this Blockette object to initialization state. All previous information stored is removed. Used for optimization through object reuse. Is publicly callable and readies the object to be used again. Accept a delimited String as input. SEED version is specified. Default delimiter characters are used.

Throws:
SeedException

setValuesFrom

public void setValuesFrom(java.lang.String inputString,
                          java.lang.String delimiter,
                          java.lang.String blank)
                   throws SeedException
Like initialize() except that the Blockette is not fully reset. Just the field values are rewritten to be the contents of the offered delimited String.

Throws:
SeedException

setValuesFrom

public void setValuesFrom(java.lang.String inputString)
                   throws SeedException
Like initialize() except that the Blockette is not fully reset. Just the field values are rewritten to be the contents of the offered delimited String.

Throws:
SeedException

getType

public int getType()
Return the blockette type number. 0 (zero) will be returned if the blockette has not been initialized

Specified by:
getType in class SeedObject

getVersion

public float getVersion()
                 throws SeedException
Return the SEED version represented in this blockette.

Throws:
SeedException

isIncomplete

public boolean isIncomplete()
Return true if this blockette was not completely specified. Most likely due to a partial record used to create this blockette.


isResponseBlockette

public boolean isResponseBlockette()
                            throws SeedException
Return true if this is a response blockette -- i.e. has a stage number

Throws:
SeedException

getNumBytes

public int getNumBytes()
                throws SeedException
Returns the number of bytes read to generate this blockette. When unset, value returned is 0. This must be used with caution. Do not interpret the return value as being the number of bytes that the current value set in the blockette would output when written as SEED. This is a value that is set once at blockette inception and only when generated from byte input. Use it to test for the number of bytes read from the byte stream when making this blockette.

Throws:
SeedException

toString

public java.lang.String toString(int fieldNum,
                                 int fieldIndex)
Convert Blockette field value to a properly formatted string. fieldIndex would be an index number of repeating field starting with count of 0.


toString

public java.lang.String toString(int fieldNum)
Convert Blockette field value to a properly formatted string. Shortened version of toString that assumes the field is a non-repeating field (no fieldIndex).


toString

public java.lang.String toString(java.lang.String delimiter,
                                 java.lang.String blank)
Convert entire Blockette contents into a tokenized string. The token delimiter is specified as a string. blank refers to a character that denotes a blank field value. The output can potentially be read in by the tokenized string variant of the Blockette() constructor (or setTokenString() method).


toString

public java.lang.String toString(java.lang.String delimiter,
                                 java.lang.String blank,
                                 java.lang.String blkFldSpace)
Convert entire Blockette contents into a tokenized string. The token delimiter is specified as a string. blank refers to a character that denotes a blank field value. The output can potentially be read in by the tokenized string variant of the Blockette() constructor (or setTokenString() method).


toBlkFldString

public java.lang.String toBlkFldString()
Convert entire Blockette contents into a block/field string. The output has a line for each field in the following format: F__B___ VALUE


toString

public java.lang.String toString()
Convert entire Blockette contents into a tokenized string. Uses a default token and default blank marker.

Specified by:
toString in class SeedObject

getName

public java.lang.String getName()
                         throws SeedException
Get the full name of this blockette.

Throws:
SeedException

getCategory

public java.lang.String getCategory()
                             throws SeedException
Get the control header type of this blockette.

Throws:
SeedException

getNumFields

public int getNumFields()
                 throws SeedException
Get the number of available fields in this blockette.

Throws:
SeedException

getFieldName

public java.lang.String getFieldName(int fieldNum)
                              throws SeedException
Get the full name of the specified field.

Throws:
SeedException

getFieldType

public java.lang.String getFieldType(int fieldNum)
                              throws SeedException
Get the letter that represents the field type.

Throws:
SeedException

getFieldLength

public java.lang.String getFieldLength(int fieldNum)
                                throws SeedException
Get the length of the field in bytes. This is a string return because the field length for type V fields is of the form 'm-n', where m is the minimum value and n is the maximum value.

Throws:
SeedException

getFieldMask

public java.lang.String getFieldMask(int fieldNum)
                              throws SeedException
Get the string expression of the mask or flag for this field.

Throws:
SeedException

getFieldRepeat

public int getFieldRepeat(int fieldNum)
                   throws SeedException
Get the field number that indicates the number of times this field repeats. A value of 0 means that this field does not repeat.

Throws:
SeedException

getDefinition

public java.lang.String getDefinition()
                               throws SeedException
Return the entire description of this blockette type.

Throws:
SeedException

getFieldVal

public java.lang.Object getFieldVal(int fieldNum,
                                    int fieldIndex)
                             throws SeedException
Returns the value at the field number...NOTE that this is an Object. Use toString() to get string equivalent of returned Object and indexed iteration of that field if it is repeating. For a non-repeating field, fieldIndex is ignored. Null is returned if a stored null value is encountered. An out of bounds field number results in a thrown exception.

Throws:
SeedException

getFieldVal

public java.lang.Object getFieldVal(int fieldNum)
                             throws SeedException
Returns a single object value at the field number indicated. For repeating fields, the object returned is the first value in the repeating field.

Throws:
SeedException

getFieldGrp

public java.util.Vector getFieldGrp(int fieldNum,
                                    int fieldIndex)
                             throws SeedException
Get a repeating field group cross-section in the form of a vector. Returns a Vector that contains all of the fields in a repeat group, returning the value at fieldIndex in each, starting at fieldNum. An example of a repeat group is Response Blockette 53, fields 10 through 13. In wanting to get the third quartet of zero coefficients, the call to getFieldGrp would be fieldNum=10, fieldIndex=2. The result would be a Vector of size 4, with the third value from fields 10,11,12, and 13, in order.

Throws:
SeedException

getFieldObject

public java.lang.Object getFieldObject(int fieldNum)
Return the raw object assigned to this field number, regardless of the contents, or whether it is a repeat field or a repeat field with list values.

Parameters:
fieldNum - field number to return the assigned object from
Returns:
row object assigned to this field number

translate

public java.lang.String translate(int fieldNum)
                           throws SeedException
Translate the value located at the blockette's field number, if there is one. Some values in blockettes translate to a more elaborate description. Translate will return a specific String if there is a description to match the value at the blockette's field number. Otherwise, a default return such as 'Value Undefined' is returned.

Throws:
SeedException

getChildBlockette

public Blockette getChildBlockette(int index)
Get the child blockette associated with this blockette from the specified Vector index. Returns null in the case of the index exceeding the size of the Vector.


numberofChildBlockettes

public int numberofChildBlockettes()
Return the number of child blockettes stored in this blockette.


hasParent

public boolean hasParent()
Return true if this Blockette has a designated parent.


getParentBlockette

public Blockette getParentBlockette()
Return the designated parent Blockette object. The value could be null, which means that as far as this Blockette is concerned, there is no parent.


getWaveform

public Waveform getWaveform()
Get the attached waveform object. Return null if no Waveform object is attached.


getDictionaryLookup

public int getDictionaryLookup(int index)
Get the dictionary lookup value from the specified Vector index. Returns 0 in the case of the index exceeding the size of the Vector or no lookup present.


numberofDictionaryLookups

public int numberofDictionaryLookups()
Return the number of dictionary entries in the lookupMap. Note that the lookupMap starts counting from 1, not 0. Position 0 is reserved for internal use.


getLookupId

public int getLookupId()
Return the lookupId for this blockette.

Specified by:
getLookupId in class SeedObject

getStageNumber

public int getStageNumber()
                   throws SeedException
Return the stage number of this blockette IF it is a response blockette. Otherwise, return a -1

Throws:
SeedException

setStageNumber

public void setStageNumber(java.lang.Integer stageNum)
                    throws SeedException
Set the stage number of this blockette to the indicated value, but only if it is a response blockette.

Throws:
SeedException

setStageNumber

public void setStageNumber(int stageNum)
                    throws SeedException
Throws:
SeedException

setVersion

public void setVersion(float ver)
                throws SeedException
Set the SEED version that this blockette represents.

Throws:
SeedException

setFieldVal

public void setFieldVal(int fieldNum,
                        int fieldIndex,
                        java.lang.Object value,
                        boolean lenient)
                 throws SeedException
Apply value contained in the provided object to the indicated field position in the blockette. Sets the value at the blockette's field number (and repeat index of that field if it is repeating). For a non-repeating field, fieldIndex is ignored. The lenient flag, when set to true, means this method will not return an exception with an improperly formatted value, but instead place a substitute character before adding it to the blockette.

Throws:
SeedException

setFieldVal

public void setFieldVal(int fieldNum,
                        int fieldIndex,
                        java.lang.Object value)
                 throws SeedException
Apply value contained in the provided object to the indicated field position in the blockette. Sets the value at the blockette's field number (and repeat index of that field if it is repeating). For a non-repeating field, fieldIndex is ignored.

Throws:
SeedException

setFieldVal

public void setFieldVal(int fieldNum,
                        java.lang.Object value)
                 throws SeedException
Apply value contained in the provided object to the indicated field position in the blockette. This method variant assumes the indicated field is not a repeat field.

Throws:
SeedException

setFieldObject

public void setFieldObject(int fieldNum,
                           java.lang.Object fieldObj)
Similar to setFieldVal, except that the provided object can be whatever construct is needed to reflect the field contents. A single value, a vector of values, or a vector of vectors with values. This allows bulk setting of a field, but must be used with caution. getFieldObject is the accessor method that complements this.

Parameters:
fieldNum - field number to apply this object to
fieldObj - object to apply to the indicated field number

addFieldGrp

public void addFieldGrp(int fieldNum,
                        java.util.Vector valueVec)
                 throws SeedException
Add a new repeat field group starting at the specified field number. valueVec should be a Vector of sufficient size to contain Objects to fill all of the fields in the repeat field group. i.e. if a repeat field group starts at field 7 and goes through field 9, then fieldNum should be 7 and valueVec should be size 3 with 3 assigned Objects to place in those fields...otherwise, an exception will be thrown. repeatField contains the field number that indicates the number of Repeating fields currently present in the blockette...it also acts to verify that this field is a repeating field. For the special case of Blockette 60, field 6 must be a Vector of Integers placed in valueVec. Be careful using this so that you get the intended result!

Throws:
SeedException

insertFieldGrp

public void insertFieldGrp(int fieldNum,
                           int fieldIndex,
                           java.util.Vector valueVec)
                    throws SeedException
Insert a repeat group before the indicated index. This is much like addFieldGrp, except that it serves as an insert function instead of an append function. Insert group at fieldIndex, with the first field of the group being fieldNum, consisting of the values in valueVec.

Throws:
SeedException

deleteFieldGrp

public void deleteFieldGrp(int fieldNum,
                           int fieldIndex)
                    throws SeedException
Remove a repeat group at the indicated index. Causes the number of repeat groups to decrease by 1. Delete the group at fieldIndex, where the first field of the group being fieldNum.

Throws:
SeedException

purgeFieldGrp

public int purgeFieldGrp(int fieldNum)
                  throws SeedException
Completely erase contents of a field group where the first field of the group is fieldNum. Sets the repeatField count to zero.

Returns:
number of fields in group purged
Throws:
SeedException

addChildBlockette

public int addChildBlockette(Blockette addBlockette)
Add a child blockette to this blockette. Append another already-created blockette to the Vector list of this blockette, indicating that the added blockette is heirarchically a 'child' of this blockette, whose data is a subcomponent of this blockette.

Parameters:
addBlockette - the blockette to be added as a child to this blockette
Returns:
the index where the addition was made.

removeChildBlockette

public void removeChildBlockette(int index)
Remove child blockette reference at the indicated index. Use getChildBlockette() to find which blockette is at which index value.


replaceChildBlockette

public void replaceChildBlockette(int index,
                                  Blockette newBlockette)
Replace child blockette at the indicated index with a new blockette.


attachParent

public void attachParent(Blockette parent)
Designate the provided Blockette as this Blockette's parent.


removeParent

public void removeParent()
Remove the parent reference in this Blockette.


attachWaveform

public void attachWaveform(Waveform data)
Attach waveform object to this blockette. Usually this applies only to FSDH blockette (999).


removeWaveform

public void removeWaveform()
Remove the attached waveform object from this blockette.


addDictionaryLookup

public int addDictionaryLookup(int abbrevLookupId)
Add lookupId value from an outside abbreviation dictionary blockette to the lookupMap Vector in this blockette. The number returned is the index value where the lookupId has been placed. It is recommended that this return value is written to the appropriate blockette field that is used to reference the dictionary blockette.


addDictionaryLookupIfNeeded

public int addDictionaryLookupIfNeeded(int abbrevLookupId)
Add lookupId value from an outside abbreviation dictionary blockette to the lookupMap Vector in this blockette if it is not already there. The number returned is the index value where the lookupId has been placed. It is recommended that this return value is written to the appropriate blockette field that is used to reference the dictionary blockette. Contributed by Sid Hellman, ISTI - 1/16/2004


setDictionaryLookup

public void setDictionaryLookup(int index,
                                int abbrevLookupId)
Set the lookupId value of an abbreviation dictionary blockette for a corresponding index value, replacing an existing entry at that index. Typically used for changing an index reference.


setLookupId

public void setLookupId(int idValue)
Set the lookupId value of this blockette. It can be used as a reference from other blockettes. Typically used by dictionary blockettes as their reference number.


getDefaultVersion

public static float getDefaultVersion()
Get the default SEED version for Blockettes. This is a static method!


setByteStream

protected int setByteStream(byte[] blocketteStream,
                            boolean swapFlag,
                            boolean isData)
                     throws SeedException
Establish the blockette contents through a byte stream written in SEED blockette format. swapFlag will indicate that word groups need to be byte swapped. isData flags that we are loading a data blockette, which has a 2-byte type value instead of 3. The value returned is the number of bytes read from the beginning of blocketteStream.

Throws:
SeedException

setFieldString

protected void setFieldString(int blkType,
                              int fieldNum,
                              int fieldIndex,
                              java.lang.String addVal,
                              boolean lenient)
                       throws SeedException
Set a specific blockette field to a value specified as a String. Also ensures the the input value is properly formatted for the field. This is kept private because it does not check that the blockette is initialized. It is in fact one method used to initialize the blockette. The public variant of this method, that demands that the blockette is first initialized through the constructor, is String variant of setFieldVal(). For the unique case of Blockette 60, field 6, the most straightforward solution is to require that addVal represent the entire set of response keys for a given stage as a single string in Vector.toString() format, which is "[value1, value2, value3, ...]". A string value of zero length results in a null entry. If fieldIndex is 0, the result is a zero-size repeat vector. If lenient is set to true, then don't throw an exception in certain input value formatting cases, but perform a workaround to continue the processing.

Throws:
SeedException

setFieldString

protected void setFieldString(int blkType,
                              int fieldNum,
                              int fieldIndex,
                              java.lang.String addVal)
                       throws SeedException
Set a specific blockette field to a value specified as a String. Abbreviated version the defaults to lenient processing of the provided value.

Throws:
SeedException

setTokenString

protected void setTokenString(java.lang.String inputString,
                              java.lang.String delimiter,
                              java.lang.String blank)
                       throws SeedException
Initialize the blockette with a character-delimited string. Delimiter should be a single character distinguishable from the data. blank is a character distinct from delimiter that marks a zero-size (blank) variable length field entry. Implementer should be careful that there are enough columns in the string to fill the blockette sufficiently. Repeat fields are entered in multiplexed order: i.e. field7(0),field8(0),field9(0),field7(1),field8(1),field9(1),field7(2),... when there are zero repeat fields, the incoming string will still list each field, but only once and will each contain a 'blank' character. Blockette 60 is a special case where the repeat fields are two-dimensional, so you will need to enter each field 6 as a special string in Vector.toString() format, which is "[value1, value2, value3, ...]". This represents a case where it would be good for the delimiter (or blank) to not be a comma or square bracket.

Throws:
SeedException

isPunctuation

protected boolean isPunctuation(char c)
Indicate TRUE if this is character is some form of punctuation.


setType

protected void setType()
                throws SeedException
update/set the blockette type

Throws:
SeedException

setType

protected void setType(int i)
allow explicit setting of the type -- use with caution!

Throws:
SeedException

instanceInit

protected void instanceInit()
Initialize instance variables.