public class MarkBlockChain extends Object
Modifier and Type | Field and Description |
---|---|
protected MarkBlock |
chain
Chain of all blocks
|
protected MarkBlock |
currentBlock
Current block to make checks faster
|
protected BaseDocument |
doc
Document for this block
|
static String |
PROP_BLOCKS_CHANGED |
Constructor and Description |
---|
MarkBlockChain(BaseDocument doc)
Construct chain using regular base marks
|
Modifier and Type | Method and Description |
---|---|
void |
addBlock(int startPos,
int endPos,
boolean concat)
Add non-empty block to the chain of blocks
|
void |
addPropertyChangeListener(PropertyChangeListener l) |
int |
adjustToBlockEnd(int pos) |
int |
adjustToNextBlockStart(int pos)
Return the position adjusted to the start of the next mark-block.
|
protected MarkBlock |
checkedRemove(MarkBlock blk)
Removes mark block and possibly updates the chain.
|
int |
compareBlock(int startPos,
int endPos)
Tests whether the position range is partly or fully inside
some mark block from the chain.
|
protected MarkBlock |
createBlock(int startPos,
int endPos) |
protected Mark |
createBlockEndMark() |
protected Mark |
createBlockStartMark() |
MarkBlock |
getChain() |
void |
removeBlock(int startPos,
int endPos)
Remove non-empty block from area covered by blocks from chain
|
void |
removeEmptyBlocks() |
void |
removePropertyChangeListener(PropertyChangeListener l) |
String |
toString() |
public static final String PROP_BLOCKS_CHANGED
protected MarkBlock chain
protected MarkBlock currentBlock
protected BaseDocument doc
public MarkBlockChain(BaseDocument doc)
public void addPropertyChangeListener(PropertyChangeListener l)
public void removePropertyChangeListener(PropertyChangeListener l)
public final MarkBlock getChain()
public int compareBlock(int startPos, int endPos)
startPos
- starting position of tested areaendPos
- ending position of tested area for removal or same
as startPos when insert is madepublic void removeEmptyBlocks()
protected MarkBlock createBlock(int startPos, int endPos) throws BadLocationException
BadLocationException
protected Mark createBlockStartMark()
protected Mark createBlockEndMark()
public void addBlock(int startPos, int endPos, boolean concat)
concat
- whether concatenate adjacent blockspublic void removeBlock(int startPos, int endPos)
protected MarkBlock checkedRemove(MarkBlock blk)
public int adjustToBlockEnd(int pos)
public int adjustToNextBlockStart(int pos)