Skip to content

Commit d9314d7

Browse files
committed
Prepare for release
1 parent b7a9259 commit d9314d7

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Download [the latest JAR][1] or grab via Maven:
2525
<dependency>
2626
<groupId>com.imsweb</groupId>
2727
<artifactId>x12-parser</artifactId>
28-
<version>1.4</version>
28+
<version>1.5</version>
2929
</dependency>
3030
```
3131

3232
or via Gradle:
3333

3434
```groovy
35-
compile 'com.imsweb.com:x12-parser:1.4'
35+
compile 'com.imsweb.com:x12-parser:1.5'
3636
```
3737

3838
[1]: http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.imsweb&a=x12-parser&v=LATEST

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = 'com.imsweb'
11-
version = '1.5-SNAPSHOT'
11+
version = '1.5'
1212
description = 'Java client library for parsing x12 files'
1313

1414
// fail the build if there are compiler warnings

src/main/java/com/imsweb/x12/Element.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public String getValue() {
6666
}
6767

6868
public void setValue(String value) {
69-
String values[] = value.split(Pattern.quote(_separators.getCompositeElement().toString()));
69+
String[] values = value.split(Pattern.quote(_separators.getCompositeElement().toString()));
7070
if (values.length >= 1)
7171
_subValues.addAll(Arrays.asList(values));
7272

src/main/java/com/imsweb/x12/reader/X12Reader.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

src/test/java/com/imsweb/x12/reader/X12ReaderTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void testMultipleGSLoops() throws Exception {
5050
URL url = this.getClass().getResource("/837_5010/x12_multiple_gs.txt");
5151
X12Reader reader = new X12Reader(FileType.ANSI837_5010_X222, new File(url.getFile()));
5252
validateMultipleGSLoops(reader.getLoops().get(0));
53-
53+
5454
}
5555

5656
@Test
@@ -67,7 +67,7 @@ public void testMultipleSTLoops() throws Exception {
6767

6868
validateMultipleSTLoops(reader.getLoops().get(0));
6969
}
70-
70+
7171
@Test
7272
public void testMarkingFiles() throws Exception {
7373
URL url = this.getClass().getResource("/837_5010/x12_valid.txt");
@@ -493,9 +493,9 @@ private void validateMultipleGSLoops(Loop loop) {
493493
}
494494

495495
private void validateMultipleISALoops(List<Loop> loops) {
496-
assertEquals(2,loops.size());
497-
for( Loop loop:loops ) {
498-
assertEquals("ISA_LOOP",loop.getId());
496+
assertEquals(2, loops.size());
497+
for (Loop loop : loops) {
498+
assertEquals("ISA_LOOP", loop.getId());
499499
assertEquals(1, loop.getLoops().size());
500500
assertEquals(1, loop.getLoop("GS_LOOP", 0).getLoops().size());
501501
assertEquals(2, loop.getLoop("ST_LOOP").getLoops().size());
@@ -519,10 +519,10 @@ private void validateMultipleISALoops(List<Loop> loops) {
519519
assertEquals(0, loop.getLoop("2010BB", 1).getLoops().size());
520520
assertEquals(0, loop.getLoop("2300", 0).getLoop("2400", 0).getLoops().size());
521521
assertEquals("20050314-20050325", loop.getLoop("2300").getLoop("2400", 0).getSegment("DTP").getElementValue("DTP03"));
522-
assertEquals("20050322-20050325", loop.getLoop("2300",1).getLoop("2400", 0).getSegment("DTP").getElementValue("DTP03"));
522+
assertEquals("20050322-20050325", loop.getLoop("2300", 1).getLoop("2400", 0).getSegment("DTP").getElementValue("DTP03"));
523523
assertEquals("GREENBELT", loop.getLoop(0).getLoop("2010AB").getSegment("N4").getElementValue("N401"));
524524
assertEquals("DAVID ANGELASZEK", loop.getLoop(0).getLoop("1000A").getSegment("PER").getElementValue("PER02"));
525-
assertNotNull( loop.getLoop("2300",1).getLoop("2400",0).getSegment("IEA")); // test to ensure the final segment is included!
525+
assertNotNull(loop.getLoop("2300", 1).getLoop("2400", 0).getSegment("IEA")); // test to ensure the final segment is included!
526526
}
527527
}
528528

0 commit comments

Comments
 (0)