Skip to content

Commit 7ce6e36

Browse files
committed
Starting work on tabulapdf#81
1 parent 4178d40 commit 7ce6e36

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/main/java/technology/tabula/Ruling.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ public static List<Ruling> collapseOrientedRulings(List<Ruling> lines, int expan
399399
if (lines.size() == 0) {
400400
return rv;
401401
}
402-
Collections.sort(lines, new Comparator<Ruling>() {
402+
403+
QuickSort.sort(lines, new Comparator<Ruling>() {
403404
@Override
404405
public int compare(Ruling a, Ruling b) {
405406
return (int) (!Utils.feq(a.getPosition(), b.getPosition()) ? a.getPosition() - b.getPosition() : a.getStart() - b.getStart());

src/test/java/technology/tabula/TestSpreadsheetExtractor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,18 @@ public void testRealLifeRTL() throws IOException {
576576
// these (commented-out) tests reflect the theoretical correct answer,
577577
// which is not currently possible because of the two problems listed above
578578
// assertEquals("مرحباً", table.getRows().get(0).get(0).getText()); // really ought to be ً, but this is forgiveable for now
579-
579+
}
580+
581+
@Test
582+
public void testStableSort() throws IOException {
583+
Page page = UtilsForTesting.getPage("src/test/resources/technology/tabula/rulings_sort.pdf", 1);
584+
SpreadsheetExtractionAlgorithm sea = new SpreadsheetExtractionAlgorithm();
585+
List<Table> tables = (List<Table>) sea.extract(page);
586+
// assertEquals(1, tables.size());
587+
Table table = tables.get(0);
588+
589+
System.out.println(table);
590+
580591
}
581592

582593
}
51 KB
Binary file not shown.

0 commit comments

Comments
 (0)