java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.output.text.TextPartUtil |
Class containing utility methods to operate on parts of text documents.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | TextPartUtil.LineInfo | Information about a line of a text document's part. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
TextPartUtil() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static String |
buildRawTextFromPart(ITextDocumentPart part)
Build the textual representation of a part.
| ||||||||||
static String |
buildRawTextFromPartInterruptibly(ITextDocumentPart part)
Build the textual representation of a part.
| ||||||||||
static int |
coordinatesToLineIndex(ITextDocumentPart part, ICoordinates coord)
Compute the part-relative index of a line given its coordinates.
| ||||||||||
static IAnchor |
getAnchorAtLine(ITextDocumentPart part, int lineIndex)
Retrieve the document anchor at the provided line.
| ||||||||||
static IAnchor |
getAnchorById(ITextDocumentPart part, long anchorId)
Get the anchor that has the exact provided id.
| ||||||||||
static IAnchor |
getApproximateAnchorById(ITextDocumentPart part, long anchorId, int mode)
Get the anchor that has the provided id, or if none is found, one if its neighbor (not
necessarily the closest neighbor).
| ||||||||||
static IAnchor |
getFirstAnchor(ITextDocumentPart part)
Determine the first anchor of the provided part.
| ||||||||||
static long |
getFirstAnchorId(ITextDocumentPart part)
Determine the id of the first anchor of the provided part.
| ||||||||||
static ITextItem |
getItemAt(ILine line, int offset)
Get the item at the given offset of the given line.
| ||||||||||
static ITextItem |
getItemAt(ITextDocumentPart part, int lineIndex, int offset)
Get the item at the given offset of the given line.
| ||||||||||
static List<ITextItem> |
getItems(ITextDocumentPart part)
Retrieve all items of a part.
| ||||||||||
static IAnchor |
getLastAnchor(ITextDocumentPart part)
Determine the last inclusive anchor of the provided part.
| ||||||||||
static long |
getLastAnchorId(ITextDocumentPart part)
Determine the id of the last anchor of the provided part.
| ||||||||||
static ILine | getLineAt(ITextDocumentPart part, ICoordinates coord) | ||||||||||
static List<? extends ILine> |
getLinesOfAnchor(ITextDocumentPart part, long anchorId)
Get the lines that belong to a specific anchor of a text part.
| ||||||||||
static IAnchor |
getNearestAnchorById(ITextDocumentPart part, long anchorId)
Get the anchor that has the closest id to the requested id.
| ||||||||||
static long |
getNextAnchorId(ITextDocumentPart part)
Determine the id of the first anchor of the next (contiguous, possibly virtual) part.
| ||||||||||
static List<Object> |
getObjectsAt(ITextDocumentPart part, int lineIndex, int columnOffset)
Retrieve the list of objects whose representations fall onto the provided coordinates, within
a part.
| ||||||||||
static boolean | isAnchorDisplayed(ITextDocumentPart part, long anchorId) | ||||||||||
static boolean |
isInsidePart(ITextDocumentPart part, ICoordinates coord)
Determine if the provided coordinates are inside a document part.
| ||||||||||
static Iterable<TextPartUtil.LineInfo> |
iterateLines(ITextDocumentPart part)
Generate an
iterable object for easy iteration over the lines (and their associated
anchor id, and line numbers) of a part. | ||||||||||
static void |
verifyPart(ITextDocumentPart part)
Verify the partial correctness of a part.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Build the textual representation of a part.
part | the part |
---|
Build the textual representation of a part. This routine throws InterruptedException if the executing thread is interrupted.
part | the part |
---|
InterruptedException | if the executing thread is interrupted. |
---|
Compute the part-relative index of a line given its coordinates.
part | the part |
---|---|
coord | some coordinates |
Retrieve the document anchor at the provided line.
lineIndex | a line index within the part |
---|
Get the anchor that has the exact provided id.
part | the part |
---|---|
anchorId | the anchor identifier |
"anchor id"
, or null
Get the anchor that has the provided id, or if none is found, one if its neighbor (not necessarily the closest neighbor). The neighbor is determined by the `mode` parameter.
part | the part |
---|---|
anchorId | the requested anchor identifier |
mode | in effect only if no exact anchor was found - 0= nearest neighbor; 1= the right nearest neighbor; -1: the left nearest neighbor |
Determine the first anchor of the provided part.
part | a part |
---|
Determine the id of the first anchor of the provided part.
part | a part |
---|
Get the item at the given offset of the given line.
line | part line object |
---|---|
offset | an offset that belongs to the item |
Get the item at the given offset of the given line.
part | the part |
---|---|
lineIndex | a line index within the part |
offset | an offset that belongs to the item |
Determine the last inclusive anchor of the provided part. The returned anchor is guaranteed to reference lines that are in the document part.
part | a part |
---|
Determine the id of the last anchor of the provided part.
part | a part |
---|
Get the lines that belong to a specific anchor of a text part.
part | the part |
---|---|
anchorId | the anchor |
Get the anchor that has the closest id to the requested id.
Note: usual integer distance calculation takes place.
part | the part |
---|---|
anchorId | the requested anchor identifier |
Determine the id of the first anchor of the next (contiguous, possibly virtual) part.
part | the current part |
---|
Retrieve the list of objects whose representations fall onto the provided coordinates, within
a part.
Note that objects and their locations are provided by the optional method
getObjectLocations()
. This method will return an empty list if
nothing was provided in the first place.
Determine if the provided coordinates are inside a document part.
part | a part |
---|---|
coord | some text coordinates |
Generate an iterable
object for easy iteration over the lines (and their associated
anchor id, and line numbers) of a part. Easy to use in a for-loop.
part | a part |
---|
TextPartUtil.LineInfo
objects
Verify the partial correctness of a part. A correct part will pass this test; however, passing this test does not mean the part is correct.
part | the part to be tested |
---|