Skip to content

Commit d6fe44a

Browse files
committed
Fixed table init parsing issue.
Cells with a trailing "-" in them but not ranges (like "p0I-") were being parsed incorrectly by stripping the dash. This does not affect CS but was causing issues with the upcoming TNM algorithm.
1 parent 3f56ca1 commit d6fe44a

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

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.6.1'
11+
version = '1.6.2'
1212
description = 'Java client library for staging calculations'
1313

1414
println "Starting build using ${Jvm.current()}"

src/main/java/com/imsweb/staging/StagingDataProvider.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,7 @@ public static List<StagingStringRange> splitValues(String values) {
309309
// The problem is that if something is entered incorrectly and was supposed to be a range, we will not process it correctly. We
310310
// may need to revisit this issue later.
311311
String[] parts = range.split("-");
312-
if (parts.length == 1)
313-
convertedRanges.add(new StagingStringRange(parts[0].trim(), parts[0].trim()));
314-
else if (parts.length == 2) {
312+
if (parts.length == 2) {
315313
// don't worry about length differences if one of the parts is a context variable
316314
if (parts[0].trim().length() != parts[1].trim().length() && !DecisionEngine.isReferenceVariable(parts[0].trim()) && !DecisionEngine.isReferenceVariable(parts[1].trim()))
317315
convertedRanges.add(new StagingStringRange(range.trim(), range.trim()));

src/test/java/com/imsweb/staging/StagingDataProviderTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@ public void testSplitValues() {
8686
Assert.assertEquals(5, ranges.size());
8787
Assert.assertEquals("", ranges.get(4).getLow());
8888
Assert.assertEquals("", ranges.get(4).getHigh());
89+
90+
ranges = StagingDataProvider.splitValues("p0I-");
91+
Assert.assertEquals(1, ranges.size());
92+
Assert.assertEquals("p0I-", ranges.get(0).getLow());
93+
Assert.assertEquals("p0I-", ranges.get(0).getHigh());
94+
95+
ranges = StagingDataProvider.splitValues("N0(mol-)");
96+
Assert.assertEquals(1, ranges.size());
97+
Assert.assertEquals("N0(mol-)", ranges.get(0).getLow());
98+
Assert.assertEquals("N0(mol-)", ranges.get(0).getHigh());
99+
100+
ranges = StagingDataProvider.splitValues("1-21");
101+
Assert.assertEquals(1, ranges.size());
102+
Assert.assertEquals("1-21", ranges.get(0).getLow());
103+
Assert.assertEquals("1-21", ranges.get(0).getHigh());
104+
105+
ranges = StagingDataProvider.splitValues("21-111");
106+
Assert.assertEquals(1, ranges.size());
107+
Assert.assertEquals("21-111", ranges.get(0).getLow());
108+
Assert.assertEquals("21-111", ranges.get(0).getHigh());
89109
}
90110

91111
@Test

0 commit comments

Comments
 (0)