org.urhl7.igor
Class HL7FieldComponent

java.lang.Object
  extended by org.urhl7.igor.HL7FieldComponent
All Implemented Interfaces:
DataField, DelimitedStructure, GenericStructure

public class HL7FieldComponent
extends Object
implements DataField, DelimitedStructure

HL7FieldComponent is a data object that represents the discrete field component portions of an HL7 message.


Constructor Summary
HL7FieldComponent(char[] delims)
          Creates a HL7FieldComponent object that understands the specified delimiters.
HL7FieldComponent(HL7Field parent)
          Creates a HL7FieldComponent object that understands the specified delimiters of the parent, as well as references it's parent.
 
Method Summary
 boolean addFieldSubcomponent(HL7FieldSubcomponent fieldcomp)
          Adds a HL7FieldSubcomponent to the underlying data structure for this HL7FieldComponent
 void addFieldSubcomponent(int index, HL7FieldSubcomponent fieldsubcomp)
          Adds a HL7FieldSubcomponent to the underlying data structure for this HL7FieldComponent at a specified index
 void changeDelims(char[] delims)
          Changes the internal delimiters for this field
 String getData()
          Retrieve the underlying data for this data object.
 char[] getDelims()
          Returns the delimiter set for this data object.
 HL7FieldSubcomponent getFieldSubcomponent(int pos)
          Returns a specific HL7FieldSubcomponent based off index
 List<HL7FieldSubcomponent> getFieldSubcomponents()
          Returns the underlying array list data structure containing HL7FieldSubcomponents.
 HL7Field getParent()
          Returns a reference to the parent HL7Field for this HL7FieldComponent
 boolean isBaseField()
          Returns if this field is the base field, or if it has subfields included.
 String marshal()
          Returns a string representation of this and the underlying data structures
 boolean removeFieldSubcomponent(HL7FieldSubcomponent fieldcomp)
          Removes the HL7FieldSubcomponent from the underlying data structure
 HL7FieldSubcomponent removeFieldSubcomponent(int pos)
          Removes the HL7FieldSubcomponent from the underlying data structure
 void setData(String data)
          Set the underlying data for this data object.
 HL7FieldSubcomponent setFieldSubcomponent(int pos, HL7FieldSubcomponent fieldsubcomp)
          Replaces the HL7FieldSubcomponent at the specified position with the provied subcomponent
 void setParent(HL7Field parent)
          Sets the parent of this HL7FieldComponent to a HL7Field
 String toString()
          Returns a String representation of this field
 void unmarshal(String data)
          Unmarshals an arbitrary String representation of a structure into this data structure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HL7FieldComponent

public HL7FieldComponent(char[] delims)
Creates a HL7FieldComponent object that understands the specified delimiters.

Parameters:
delims -

HL7FieldComponent

public HL7FieldComponent(HL7Field parent)
Creates a HL7FieldComponent object that understands the specified delimiters of the parent, as well as references it's parent.

Parameters:
parent -
Method Detail

setParent

public void setParent(HL7Field parent)
Sets the parent of this HL7FieldComponent to a HL7Field

Parameters:
parent - the parent to set

getParent

public HL7Field getParent()
Returns a reference to the parent HL7Field for this HL7FieldComponent

Returns:
the parent

getDelims

public char[] getDelims()
Returns the delimiter set for this data object.

Specified by:
getDelims in interface DelimitedStructure
Returns:
delimiter array

changeDelims

public void changeDelims(char[] delims)
Changes the internal delimiters for this field

Specified by:
changeDelims in interface DelimitedStructure
Parameters:
delims - the delimiters

unmarshal

public void unmarshal(String data)
Unmarshals an arbitrary String representation of a structure into this data structure

Specified by:
unmarshal in interface GenericStructure
Parameters:
data - a String representation of data

marshal

public String marshal()
Returns a string representation of this and the underlying data structures

Specified by:
marshal in interface GenericStructure
Returns:
a String representation of this structure

setData

public void setData(String data)
Set the underlying data for this data object.

Specified by:
setData in interface DataField
Parameters:
data - a String representation of the data

getData

public String getData()
Retrieve the underlying data for this data object.

Specified by:
getData in interface DataField
Returns:
String representation of the data

isBaseField

public boolean isBaseField()
Returns if this field is the base field, or if it has subfields included.

Returns:
the baseField

toString

public String toString()
Returns a String representation of this field

Overrides:
toString in class Object
Returns:
a string representation

getFieldSubcomponents

public List<HL7FieldSubcomponent> getFieldSubcomponents()
Returns the underlying array list data structure containing HL7FieldSubcomponents.

Returns:
the underlying data structure

getFieldSubcomponent

public HL7FieldSubcomponent getFieldSubcomponent(int pos)
Returns a specific HL7FieldSubcomponent based off index

Parameters:
pos - the index to return
Returns:
the HL7FieldSubcomponent at specified index

addFieldSubcomponent

public boolean addFieldSubcomponent(HL7FieldSubcomponent fieldcomp)
Adds a HL7FieldSubcomponent to the underlying data structure for this HL7FieldComponent

Parameters:
fieldcomp - subcomponent to add
Returns:
success of the addition

addFieldSubcomponent

public void addFieldSubcomponent(int index,
                                 HL7FieldSubcomponent fieldsubcomp)
Adds a HL7FieldSubcomponent to the underlying data structure for this HL7FieldComponent at a specified index

Parameters:
index - the position to add
fieldsubcomp - the subcomponent to add

removeFieldSubcomponent

public HL7FieldSubcomponent removeFieldSubcomponent(int pos)
Removes the HL7FieldSubcomponent from the underlying data structure

Parameters:
pos - the position to remove from
Returns:
the removed HL7FieldSubcomponent

removeFieldSubcomponent

public boolean removeFieldSubcomponent(HL7FieldSubcomponent fieldcomp)
Removes the HL7FieldSubcomponent from the underlying data structure

Parameters:
fieldcomp - the HL7FieldSubcomponent to remove
Returns:
removal success

setFieldSubcomponent

public HL7FieldSubcomponent setFieldSubcomponent(int pos,
                                                 HL7FieldSubcomponent fieldsubcomp)
Replaces the HL7FieldSubcomponent at the specified position with the provied subcomponent

Parameters:
pos - the index to replace
fieldsubcomp - the subcomponent to replace with
Returns:
the previous subcomponent