Loop¶
-
public class
Loop
implements Iterable<Segment>¶ The Loop class is the representation of an Loop in a ANSI X12 transaction. The building block of an X12 transaction is an element. Some elements may be made of sub elements. Elements combine to form segments. Segments are grouped as loops. And a set of loops form an X12 transaction.
Author: Prasad Balan
Constructors¶
Loop¶
-
public
Loop
(Context c, String name)¶ The constructor takes a context object.
Parameters: - c – a Context object
- name – a
java.lang.String
object.
Methods¶
addChild¶
addChild¶
addChild¶
-
public Loop
addChild
(int index, String name)¶ Creates an empty instance of
Loop
and inserts the loop as a child loop at the specified position. The returned instance can be used to add segments to the child loop.Parameters: - index – position at which to add the loop
- name – name of the loop
Returns: a new child
Loop
object
addSegment¶
addSegment¶
-
public Segment
addSegment
(String segment)¶ Takes a
java.lang.String
representation of segment, creates aSegment
object and adds the segment to the current Loop.Parameters: - segment –
java.lang.String
representation of the Segment.
Returns: a new Segment object
- segment –
addSegment¶
addSegment¶
addSegment¶
-
public Segment
addSegment
(int index, String segment)¶ Takes a
java.lang.String
representation of segment, creates aSegment
object and adds the segment at the specified position in the current Loop.Parameters: - index – position to add the segment.
- segment –
java.lang.String
representation of the segment.
Returns: a new Segment object
addSegment¶
childList¶
-
public List<Loop>
childList
()¶ Returns
java.util.List
of child LoopsReturns: java.util.List
<Loop
>
findLoop¶
findSegment¶
getContext¶
getLoop¶
getName¶
-
public String
getName
()¶ Returns the name of the current Loop.
Returns: java.lang.String
getSegment¶
getSegment¶
getSegments¶
-
public List<Segment>
getSegments
()¶ Returns the segments in the current loop.
Returns: java.util.List
hasLoop¶
iterator¶
-
public Iterator<Segment>
iterator
()¶ Returns and
java.util.Iterator
to the segments in the loop.Returns: java.util.Iterator
<Segment
>
removeLoop¶
removeSegment¶
setChild¶
setChild¶
setContext¶
setName¶
-
public void
setName
(String name)¶ Sets the name of the current Loop
Parameters: - name –
java.lang.String
- name –
setParent¶
setSegment¶
setSegment¶
-
public Segment
setSegment
(int index, String segment)¶ Takes a
java.lang.String
representation of segment, creates ajava.lang.String
object and replaces the segment at the specified position in the X12 transaction.Parameters: - index – position of the segment to be replaced.
- segment –
java.lang.String
representation of the Segment.
Returns: a new Segment object
setSegment¶
toString¶
-
public String
toString
()¶ Returns the Loop in X12
java.lang.String
format. This method is used to convert the X12 object into a X12 transaction.Returns: String
toString¶
-
public String
toString
(boolean bRemoveTrailingEmptyElements)¶ Returns the Loop in X12
java.lang.String
format. This method is used to convert the X12 object into a X12 transaction.Parameters: - bRemoveTrailingEmptyElements – a flag for whether or not empty trailing elements should be removed.
Returns: String representation of the loop.
toXML¶
-
public String
toXML
()¶ Returns the Loop in XML
java.lang.String
format. This method is used to convert the X12 object into a XML string.Returns: XML String
toXML¶
-
public String
toXML
(boolean bRemoveTrailingEmptyElements)¶ Returns the Loop in XML
java.lang.String
format. This method is used to convert the X12 object into a XML string.Parameters: - bRemoveTrailingEmptyElements – a flag for whether or not empty trailing elements should be removed.
Returns: String the loop in XML string format.