forked from tabulapdf/tabula-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangularTextContainer.java
More file actions
36 lines (27 loc) · 1007 Bytes
/
RectangularTextContainer.java
File metadata and controls
36 lines (27 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package technology.tabula;
import java.util.List;
@SuppressWarnings("serial")
public abstract class RectangularTextContainer<T extends HasText> extends Rectangle {
public RectangularTextContainer(float top, float left, float width, float height) {
super(top, left, width, height);
}
public RectangularTextContainer<T> merge(RectangularTextContainer<T> other) {
if (compareTo(other) < 0) {
this.getTextElements().addAll(other.getTextElements());
} else {
this.getTextElements().addAll(0, other.getTextElements());
}
super.merge(other);
return this;
}
public abstract String getText();
public abstract String getText(boolean useLineReturns);
public abstract List<T> getTextElements();
@Override public String toString() {
StringBuilder sb = new StringBuilder();
String s = super.toString();
sb.append(s.substring(0, s.length() - 1));
sb.append(String.format(",text=%s]", this.getText() == null ? "null" : "\"" + this.getText() + "\""));
return sb.toString();
}
}