@@ -169,15 +169,17 @@ public X12Reader(FileType type, Reader reader) throws IOException {
169169 * @return the loop
170170 */
171171 private Loop getCurrentLoop () {
172- return (_dataLoops .isEmpty ()? null : _dataLoops .get (_dataLoops .size ()- 1 ));
172+ return (_dataLoops .isEmpty () ? null : _dataLoops .get (_dataLoops .size () - 1 ));
173173 }
174+
174175 /**
175176 * Return the resulting loops, this would possible if multiple ISA segments were included in one single file
176177 * @return the loop list
177178 */
178- public List <Loop > getLoops (){
179+ public List <Loop > getLoops () {
179180 return _dataLoops ;
180181 }
182+
181183 /**
182184 * Return the list of errors, if any
183185 * @return a list of errors
@@ -216,18 +218,18 @@ private void parse(FileType type, Reader reader) throws IOException {
216218 _errors = new ArrayList <>();
217219
218220 String line = scanner .next ().trim ();
219- while (scanner .hasNext () ) {
221+ while (scanner .hasNext ()) {
220222 // Determine if we have started a new loop
221223 loopId = getMatchedLoop (line .split (Pattern .quote (separators .getElement ().toString ())), previousLoopId );
222224 if (loopId != null ) {
223- if ( loopId .equals ( _definition .getLoop ().getXid () ) ) {
224- if ( currentLoopId != null ) {
225+ if ( loopId .equals (_definition .getLoop ().getXid ()) ) {
226+ if ( currentLoopId != null ) {
225227 storeData (previousLoopId , loopLines , currentLoopId , getCurrentLoop ().getSeparators ());
226228 loopLines = new ArrayList <>();
227229 }
228- previousLoopId = null ;
229- currentLoopId = null ;
230- _dataLoops .add (new Loop (null ) );
230+ previousLoopId = null ;
231+ currentLoopId = null ;
232+ _dataLoops .add (new Loop (null ));
231233 getCurrentLoop ().setSeparators (separators );
232234 }
233235 updateLoopCounts (loopId );
@@ -264,7 +266,8 @@ else if (getCurrentLoop().getId() != null) {
264266 break ;
265267 }
266268 }
267- if (!line .isEmpty () && !loopLines .contains (line )) loopLines .add (line );
269+ if (!line .isEmpty () && !loopLines .contains (line ))
270+ loopLines .add (line );
268271 storeData (previousLoopId , loopLines , currentLoopId , separators );
269272
270273 //checking the loop data to see if there any requirements violations
@@ -398,7 +401,8 @@ else if (getCurrentLoop().getId().equals(parentName)) {
398401 int index = getCurrentLoop ().getLoops ().size ();
399402 getCurrentLoop ().addLoop (index , newLoop );
400403 }
401- else if (getCurrentLoop ().getLoop (primaryIndex ).getLoops ().size () != 0 && !getCurrentLoop ().getLoop (primaryIndex ).getLoop (secondaryIndex ).hasLoop (parentName ) && !getCurrentLoop ().getLoop (primaryIndex ).getId ()
404+ else if (getCurrentLoop ().getLoop (primaryIndex ).getLoops ().size () != 0 && !getCurrentLoop ().getLoop (primaryIndex ).getLoop (secondaryIndex ).hasLoop (parentName ) && !getCurrentLoop ().getLoop (
405+ primaryIndex ).getId ()
402406 .equals (
403407 parentName )) { //if the parent loop for the current loop has not been stored---we need to create it. (Happens for loops with no segements!!!)
404408 String oldParentName = parentName ;
@@ -432,7 +436,8 @@ else if (getCurrentLoop().getLoop(primaryIndex).getLoops().size() != 0 && !getCu
432436 index = getCurrentLoop ().getLoop (primaryIndex ).getLoop (secondaryIndex ).getLoop (parentName , parentIndex ).getLoops ().size ();
433437 }
434438 //if the primary loop path has child loops and the first loop is NOT the parent loop
435- if (getCurrentLoop ().getLoop (primaryIndex ).getLoops ().size () != 0 && getCurrentLoop ().getLoop (primaryIndex ).getLoop (secondaryIndex ).getLoops ().size () != 0 && !getCurrentLoop ().getLoop (primaryIndex ).getId ()
439+ if (getCurrentLoop ().getLoop (primaryIndex ).getLoops ().size () != 0 && getCurrentLoop ().getLoop (primaryIndex ).getLoop (secondaryIndex ).getLoops ().size () != 0 && !getCurrentLoop ().getLoop (
440+ primaryIndex ).getId ()
436441 .equals (
437442 parentName ))
438443 getCurrentLoop ().getLoop (primaryIndex ).getLoop (secondaryIndex ).getLoop (parentName , parentIndex ).addLoop (index , newLoop );
0 commit comments