diff --git a/src/main/java/technology/tabula/Ruling.java b/src/main/java/technology/tabula/Ruling.java index 213ce87f..61637259 100644 --- a/src/main/java/technology/tabula/Ruling.java +++ b/src/main/java/technology/tabula/Ruling.java @@ -316,12 +316,8 @@ public SortObject(SOType type, float position, Ruling ruling) { } List sos = new ArrayList<>(); - - TreeMap tree = new TreeMap<>(new Comparator() { - @Override - public int compare(Ruling o1, Ruling o2) { - return java.lang.Double.compare(o1.getTop(), o2.getTop()); - }}); + + TreeMap tree = new TreeMap(); TreeMap rv = new TreeMap<>(new Comparator() { @Override @@ -374,21 +370,21 @@ else if (a.type == SOType.HRIGHT && b.type == SOType.VERTICAL) { for (SortObject so : sos) { switch(so.type) { case VERTICAL: - for (Map.Entry h : tree.entrySet()) { - Point2D i = h.getKey().intersectionPoint(so.ruling); + for (Map.Entry h : tree.entrySet()) { + Point2D i = h.getValue().intersectionPoint(so.ruling); if (i == null) { continue; } rv.put(i, - new Ruling[] { h.getKey().expand(PERPENDICULAR_PIXEL_EXPAND_AMOUNT), + new Ruling[] { h.getValue().expand(PERPENDICULAR_PIXEL_EXPAND_AMOUNT), so.ruling.expand(PERPENDICULAR_PIXEL_EXPAND_AMOUNT) }); } break; case HRIGHT: - tree.remove(so.ruling); + tree.remove(so.ruling.hashCode()); break; case HLEFT: - tree.put(so.ruling, true); + tree.put(so.ruling.hashCode(), so.ruling); break; } }