org.urhl7.igor
Class HL7StructureHelper

java.lang.Object
  extended by org.urhl7.igor.HL7StructureHelper

public class HL7StructureHelper
extends Object

Helper class that has methods that help move around the underlying data structure.


Constructor Summary
HL7StructureHelper(HL7Structure structure)
          Create a HL7StructureHelper that is bound to the provided HL7Structure
 
Method Summary
 DataField get(LocationSpecification loc)
          Retrieves the first data field at a specified location.
 DataField get(LocationSpecification loc, boolean neverReturnNull)
          Retrieves the first data field at a specified location.
 DataField get(String descriptor)
          Retrieves the first data field at a specified location.
 DataField get(String descriptor, boolean neverReturnNull)
          Retrieves the first data field at a specified location.
 List<DataField> getAll(LocationSpecification loc)
          Retrieves the all data fields matching a specified location, left to right, top to bottom.
 List<DataField> getAll(String descriptor)
          Retrieves the all data fields matching a specified location, left to right, top to bottom.
 List<HL7Segment> getAllSegments(LocationSpecification loc)
          Retrieves all segments that match the LocationSpecification (from top to bottom)
 List<HL7Segment> getAllSegments(String descriptor)
          Retrieves all segments that match the descriptor (from top to bottom)
 HL7Segment getSegment(LocationSpecification loc)
          Retrieves the first HL7Segment that matches the LocationSpecification (top to bottom)
 HL7Segment getSegment(String descriptor)
          Retrieves the first HL7Segment that matches the descriptor (top to bottom)
 boolean has(LocationSpecification loc)
          Determine if this structure has a particular data field or segment
 boolean has(String descriptor)
          Determine if this structure has a particular data field or segment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HL7StructureHelper

public HL7StructureHelper(HL7Structure structure)
Create a HL7StructureHelper that is bound to the provided HL7Structure

Parameters:
structure - the HL7Structure to bind to
Method Detail

has

public boolean has(String descriptor)
Determine if this structure has a particular data field or segment

Parameters:
descriptor - string descriptor of the location of the data field or segment
Returns:
if the data field or segment exists

has

public boolean has(LocationSpecification loc)
Determine if this structure has a particular data field or segment

Parameters:
loc - the LocationSpecification of the data field
Returns:
if the data field or segment exists

get

public DataField get(String descriptor)
Retrieves the first data field at a specified location. If the data field does not exist, rather than erroring, it will return an EmptyField with no data.

Parameters:
descriptor - String description of location
Returns:
the first DataField that matches the descriptor

get

public DataField get(String descriptor,
                     boolean neverReturnNull)
Retrieves the first data field at a specified location.

Parameters:
descriptor - String description of location
neverReturnNull - flag to return a null object on a not found object (false) or an EmptyField (true)
Returns:
the first DataField that matches the descriptor

get

public DataField get(LocationSpecification loc)
Retrieves the first data field at a specified location. If the data field does not exist, rather than erroring, it will return an EmptyField with no data.

Parameters:
loc - the LocationSpecification of the data field
Returns:
the first DataField that matches the descriptor

get

public DataField get(LocationSpecification loc,
                     boolean neverReturnNull)
Retrieves the first data field at a specified location.

Parameters:
loc - the LocationSpecification of the data field
neverReturnNull - flag to return a null object on a not found object (false) or an EmptyField (true)
Returns:
the first DataField that matches the descriptor

getAll

public List<DataField> getAll(String descriptor)
Retrieves the all data fields matching a specified location, left to right, top to bottom. If the data field does not exist, rather than erroring, it will return an empty list.

Parameters:
descriptor - String description of location
Returns:
all DataField object that match the descriptor, or an empty list if none do

getAll

public List<DataField> getAll(LocationSpecification loc)
Retrieves the all data fields matching a specified location, left to right, top to bottom. If the data field does not exist, rather than erroring, it will return an empty list.

Parameters:
loc - the LocationSpecification of the data field
Returns:
all DataField object that match the location, or an empty list if none do

getSegment

public HL7Segment getSegment(String descriptor)
Retrieves the first HL7Segment that matches the descriptor (top to bottom)

Parameters:
descriptor - String description of location
Returns:
the first HL7Segment that matches the descriptor

getSegment

public HL7Segment getSegment(LocationSpecification loc)
Retrieves the first HL7Segment that matches the LocationSpecification (top to bottom)

Parameters:
loc - the LocationSpecification of the segment
Returns:
the first HL7Segment that matches the LocationSpecification

getAllSegments

public List<HL7Segment> getAllSegments(String descriptor)
Retrieves all segments that match the descriptor (from top to bottom)

Parameters:
descriptor - String description of location
Returns:
all HL7Segments that match the descriptor

getAllSegments

public List<HL7Segment> getAllSegments(LocationSpecification loc)
Retrieves all segments that match the LocationSpecification (from top to bottom)

Parameters:
loc - the LocationSpecification of the segments
Returns:
all HL7Segments that match the specification