public class MarkBlock extends Object
Modifier and Type | Field and Description |
---|---|
static int |
AFTER
Tested block completely after THIS mark block.
|
static int |
BEFORE
Tested block completely before THIS mark block.
|
static int |
CONTINUE
Single bit value that means that the tested block doesn't
overlap with THIS block, but either its start position
is equal to end position of THIS block or its end position
is equal to the start position of THIS block.
|
static int |
CONTINUE_BEGIN
Tested block completely before THIS mark block but its
end position equals to the start position of THIS block.
|
static int |
CONTINUE_END
Tested block completely after THIS mark block but its
start position equals to the end position of THIS block.
|
protected BaseDocument |
doc |
static int |
EMPTY
Single bit value meaning that the tested block has zero size.
|
Mark |
endMark |
static int |
EXTEND
Two bit value meaning that the tested block fully
includes THIS block.
|
static int |
EXTEND_BEGIN
Start position of the tested block is lower than
the start position of THIS block and both end positions
are the same.
|
static int |
EXTEND_END
End position of the tested block is greater than
the end position of THIS block and both start positions
are the same.
|
static int |
IGNORE_EMPTY
This value can be used to clear the two bits saying
if the tested or THIS block are empty (The EMPTY and THIS_EMPTY are cleared).
|
static int |
INCLUDE
Tested block fully includes THIS block and extends it
by at least one character in both directions.
|
static int |
INNER
Tested block is fully inside THIS block and there
is at least one more character left in THIS block
after the end of the tested block in both directions.
|
static int |
INSIDE
Two bit value meaning that the tested block is fully
inside THIS block.
|
static int |
INSIDE_BEGIN
Tested block completely inside THIS block and its end
position is lower than end position of THIS block
and start positions are the same.
|
static int |
INSIDE_END
Tested block completely inside THIS block and its start
position is greater than THIS block start position and
end positions are the same.
|
static int |
INVALID
This value is not used directly in this class
but can be used by other classes to report that
the comparison of blocks has no sense for some reason.
|
protected MarkBlock |
next
Next block in the chain
|
static int |
OVERLAP
Single bit value that means that tested block
and THIS block partially or fully overlap.
|
static int |
OVERLAP_BEGIN
Tested block partly covers begining of THIS mark block.
|
static int |
OVERLAP_END
Tested block partly covers end of THIS mark block.
|
protected MarkBlock |
prev
Previous block in the chain
|
static int |
SAME
The blocks have exactly the same start and end positions.
|
Mark |
startMark |
static int |
THIS_EMPTY
Single bit value meaning that THIS block has zero size.
|
Constructor and Description |
---|
MarkBlock(BaseDocument doc,
int startPos,
int endPos)
Construct block with given marks
|
MarkBlock(BaseDocument doc,
Mark startMark,
Mark endMark) |
MarkBlock(BaseDocument doc,
Mark startMark,
Mark endMark,
int startPos,
int endPos)
Construct block from positions on some document
|
Modifier and Type | Method and Description |
---|---|
MarkBlock |
addChain(MarkBlock blk)
Add block after this one
|
boolean |
checkReverse() |
int |
compare(int startPos,
int endPos)
Compares the position of the given block against current block.
|
static String |
debugRelation(int rel) |
boolean |
extend(int startPos,
int endPos,
boolean concat)
Extend this mark block by start and end positions.
|
boolean |
extend(MarkBlock blk,
boolean concat)
Extend this mark block by some other block.
|
int |
extendEnd(int endPos)
Possibly move end mark if its position is above the given number.
|
int |
extendStart(int startPos)
Possibly move start mark if its position is above the given number.
|
protected void |
finalize()
Destroy the marks if necessary
|
Document |
getDocument() |
int |
getEndOffset() |
MarkBlock |
getNext() |
MarkBlock |
getPrev() |
int |
getStartOffset() |
MarkBlock |
insertChain(MarkBlock blk)
Insert block before this one
|
boolean |
isReverse() |
MarkBlock |
removeChain()
Remove this block from the chain
|
void |
reverse() |
void |
setNext(MarkBlock b) |
void |
setNextChain(MarkBlock b)
Set the next block of this one in the chain.
|
void |
setPrev(MarkBlock b) |
void |
setPrevChain(MarkBlock b)
Set the previous block of this one in the chain
|
int |
shrink(int startPos,
int endPos)
Shrink this mark block by the block specified.
|
String |
toString()
Debugs this mark block
|
String |
toStringChain()
Debug possibly whole chain of marks
|
public static final int INVALID
public static final int OVERLAP
public static final int CONTINUE
public static final int EMPTY
public static final int THIS_EMPTY
public static final int EXTEND
public static final int INSIDE
public static final int BEFORE
public static final int AFTER
public static final int CONTINUE_BEGIN
public static final int CONTINUE_END
public static final int OVERLAP_BEGIN
public static final int OVERLAP_END
public static final int EXTEND_BEGIN
public static final int EXTEND_END
public static final int INCLUDE
public static final int INSIDE_BEGIN
public static final int INSIDE_END
public static final int INNER
public static final int SAME
public static final int IGNORE_EMPTY
protected MarkBlock next
protected MarkBlock prev
public Mark startMark
public Mark endMark
protected BaseDocument doc
public MarkBlock(BaseDocument doc, Mark startMark, Mark endMark)
public MarkBlock(BaseDocument doc, int startPos, int endPos) throws BadLocationException
BadLocationException
public MarkBlock(BaseDocument doc, Mark startMark, Mark endMark, int startPos, int endPos) throws BadLocationException
BadLocationException
public MarkBlock insertChain(MarkBlock blk)
public MarkBlock removeChain()
public int compare(int startPos, int endPos)
startPos
- starting position of the compared blockendPos
- ending position of the compared block or it is the same
as startPos when testing just for insertpublic final MarkBlock getNext()
public final void setNext(MarkBlock b)
public void setNextChain(MarkBlock b)
public final MarkBlock getPrev()
public final void setPrev(MarkBlock b)
public void setPrevChain(MarkBlock b)
public boolean isReverse()
public void reverse()
public boolean checkReverse()
public int extendStart(int startPos) throws BadLocationException
BadLocationException
public int extendEnd(int endPos) throws BadLocationException
BadLocationException
public boolean extend(int startPos, int endPos, boolean concat) throws BadLocationException
BadLocationException
public boolean extend(MarkBlock blk, boolean concat)
public int shrink(int startPos, int endPos) throws BadLocationException
BadLocationException
public Document getDocument()
public int getStartOffset()
public int getEndOffset()
protected void finalize() throws Throwable
public String toStringChain()
public static String debugRelation(int rel)