Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/main/java/technology/tabula/Ruling.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,8 @@ public SortObject(SOType type, float position, Ruling ruling) {
}

List<SortObject> sos = new ArrayList<>();

TreeMap<Ruling, Boolean> tree = new TreeMap<>(new Comparator<Ruling>() {
@Override
public int compare(Ruling o1, Ruling o2) {
return java.lang.Double.compare(o1.getTop(), o2.getTop());
}});

TreeMap<Integer, Ruling> tree = new TreeMap();

TreeMap<Point2D, Ruling[]> rv = new TreeMap<>(new Comparator<Point2D>() {
@Override
Expand Down Expand Up @@ -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<Ruling, Boolean> h : tree.entrySet()) {
Point2D i = h.getKey().intersectionPoint(so.ruling);
for (Map.Entry<Integer, Ruling> 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;
}
}
Expand Down