Skip to content

Commit

Permalink
Allgemeiner Satz der Satzarten 210, 211, 220, 221 wird als 02xx.000 a…
Browse files Browse the repository at this point in the history
…ngezeigt
  • Loading branch information
Oli B committed Jun 14, 2021
1 parent 0cda213 commit 67ef451
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 12 additions & 4 deletions lib/src/main/java/gdv/xport/util/SatzTyp.java
Expand Up @@ -118,9 +118,6 @@ private static short[] createArray(int[] args) {
array[i] = (short) args[i];
}
int satzart = array[0];
if (((satzart == 210 ) || (satzart == 211 ) || (satzart == 220 )|| (satzart == 221)) && (args.length < 2)) {
array = ArrayUtils.add(array, (short) 0);
}
if ((array.length == 2) && (satzart == 220) && (array[1] == 10)) {
array = ArrayUtils.add(array, (short) 0);
}
Expand All @@ -130,6 +127,14 @@ private static short[] createArray(int[] args) {
return array;
}

private static boolean isAllgemeineSatzart(int satzart) {
return (satzart == 210) || (satzart == 211) || (satzart == 220) || (satzart == 221);
}

private boolean isAllgemeineSatzart() {
return isAllgemeineSatzart(getSatzart());
}

/**
* Gets the satzart.
*
Expand Down Expand Up @@ -310,7 +315,8 @@ public boolean hasSparte() {
}

public boolean hasParent() {
return StringUtils.countMatches(this.toString(), '.') > 0;
//return StringUtils.countMatches(this.toString(), '.') > 0;
return teil.length > 1;
}

public SatzTyp getParent() {
Expand Down Expand Up @@ -396,6 +402,8 @@ public String toString() {
buf.append(".");
buf.append(this.getTeildatensatzNummer());
}
} else if (isAllgemeineSatzart()) {
buf.append(".000");
}
return buf.toString();
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/test/java/gdv/xport/util/SatzTypTest.java
Expand Up @@ -255,10 +255,10 @@ public void testAllgemeinerSatz() {
assertEquals(SatzTyp.of("0211.000"), SatzTyp.of("0211"));
assertEquals(SatzTyp.of("0220.000"), SatzTyp.of("0220"));
assertEquals(SatzTyp.of("0221.000"), SatzTyp.of("0221"));
// assertEquals(SatzTyp.of("0210.000").toString(), "0210.000");
// assertEquals(SatzTyp.of("0211.000").toString(), "0211.000");
// assertEquals(SatzTyp.of("0220.000").toString(), "0220.000");
// assertEquals(SatzTyp.of("0221.000").toString(), "0221.000");
assertEquals("0210.000", SatzTyp.of("0210.000").toString());
assertEquals("0211.000", SatzTyp.of("0211.000").toString());
assertEquals("0220.000", SatzTyp.of("0220.000").toString());
assertEquals("0221.000", SatzTyp.of("0221.000").toString());
}

/**
Expand Down

0 comments on commit 67ef451

Please sign in to comment.