Package technology.tabula
Class TextChunk
- All Implemented Interfaces:
Shape,Serializable,Cloneable,HasText
public class TextChunk extends RectangularTextContainer<TextElement>
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float -
Field Summary
Fields inherited from class technology.tabula.Rectangle
ILL_DEFINED_ORDER, VERTICAL_COMPARISON_THRESHOLD -
Constructor Summary
Constructors Constructor Description TextChunk(float top, float left, float width, float height)TextChunk(List<TextElement> textElements)TextChunk(TextElement textElement) -
Method Summary
Modifier and Type Method Description voidadd(List<TextElement> elements)voidadd(TextElement textElement)static booleanallSameChar(List<TextChunk> textChunks)booleanequals(Object obj)StringgetText()StringgetText(boolean useLineReturns)TextChunkgroupByDirectionality(Boolean isLtrDominant)Splits a TextChunk into N TextChunks, where each chunk is of a single directionality, and then reverse the RTL ones.static List<Line>groupByLines(List<TextChunk> textChunks)inthashCode()intisLtrDominant()booleanisSameChar(Character c)Returns true if text contained in this TextChunk is the same repeated characterbooleanisSameChar(Character[] c)TextChunkmerge(TextChunk other)TextChunk[]splitAt(int i)Splits a TextChunk in two, at the position of the i-th TextElementList<TextChunk>squeeze(Character c, int minRunLength)Removes runs of identical TextElements in this TextChunk For example, if the TextChunk contains this string of characters: "1234xxxxx56xx" and c == 'x' and minRunLength == 4, this method will return a list of TextChunk such that: ["1234", "56xx"]Methods inherited from class technology.tabula.RectangularTextContainer
getTextElements, merge, setTextElements, toStringMethods inherited from class technology.tabula.Rectangle
boundingBoxOf, compareTo, getArea, getBottom, getLeft, getPoints, getRight, getTop, horizontallyOverlaps, horizontalOverlap, merge, overlapRatio, setBottom, setLeft, setRight, setTop, verticallyOverlaps, verticalOverlap, verticalOverlapRatioMethods inherited from class java.awt.geom.Rectangle2D.Float
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, setRectMethods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, unionMethods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
-
Field Details
-
Constructor Details
-
Method Details
-
groupByDirectionality
Splits a TextChunk into N TextChunks, where each chunk is of a single directionality, and then reverse the RTL ones. what we're doing here is *reversing* the Unicode bidi algorithm in the language of that algorithm, each chunk is a (maximal) directional run. We attach whitespace to the beginning of non-RTL -
isLtrDominant
public int isLtrDominant()- Overrides:
isLtrDominantin classRectangle
-
merge
-
add
-
add
-
getText
- Specified by:
getTextin interfaceHasText- Overrides:
getTextin classRectangularTextContainer<TextElement>
-
getText
- Specified by:
getTextin interfaceHasText- Overrides:
getTextin classRectangularTextContainer<TextElement>
-
isSameChar
Returns true if text contained in this TextChunk is the same repeated character -
isSameChar
-
splitAt
Splits a TextChunk in two, at the position of the i-th TextElement -
squeeze
Removes runs of identical TextElements in this TextChunk For example, if the TextChunk contains this string of characters: "1234xxxxx56xx" and c == 'x' and minRunLength == 4, this method will return a list of TextChunk such that: ["1234", "56xx"] -
hashCode
public int hashCode()- Overrides:
hashCodein classRectangle2D
-
equals
- Overrides:
equalsin classRectangle2D
-
allSameChar
-
groupByLines
-