public abstract class Block extends Processor implements java.lang.Cloneable
Cloneable
for the template design pattern.builder, markupLanguage, parser, state
Constructor and Description |
---|
Block() |
Modifier and Type | Method and Description |
---|---|
boolean |
beginNesting()
Indicate if block nesting should begin.
|
boolean |
canResume(java.lang.String line,
int lineOffset)
Indicates if the block can resume with the given markup line at the provided offset.
|
abstract boolean |
canStart(java.lang.String line,
int lineOffset)
Indicate if the block can start with the given markup line at the provided offset.
|
Block |
clone()
Clone the block including its state.
|
int |
findCloseOffset(java.lang.String line,
int lineOffset)
Indicate if the block can close on the given line at the given offset.
|
boolean |
isClosed()
Indicate if the current block is closed
|
int |
processLine(java.lang.String line,
int offset)
Process the given line of markup starting at the provided offset.
|
protected abstract int |
processLineContent(java.lang.String line,
int offset)
Process the given line of markup starting at the provided offset.
|
void |
setClosed(boolean closed)
Cause the block to be closed.
|
getBuilder, getMarkupLanguage, getParser, getState, setParser, setState
public int processLine(java.lang.String line, int offset)
line
- the markup line to processoffset
- the offset at which to start processingprotected abstract int processLineContent(java.lang.String line, int offset)
line
- the markup line to processoffset
- the offset at which to start processingpublic abstract boolean canStart(java.lang.String line, int lineOffset)
cloning
and consumed in
#processLine(String, int, int)
. Calling this method must cause any previous state to be reset. Note that
it is valid for block implementations to refuse to start at non-zero offsets. Implementations must be able to
handle this method without having the processor state
initialized.line
- the line of markup to testlineOffset
- the offset at which the block should start processingpublic boolean beginNesting()
processLineContent(String, int)
.findCloseOffset(String, int)
,
canResume(String, int)
public int findCloseOffset(java.lang.String line, int lineOffset)
line
- the line of contentlineOffset
- the 0-based offset into the linebeginNesting()
,
canResume(String, int)
public boolean canResume(java.lang.String line, int lineOffset)
line
- the line of contentlineOffset
- the 0-based offset into the linetrue
if the block can resume false
if nested block needs to handle the content
further.beginNesting()
,
findCloseOffset(String, int)
public boolean isClosed()
public void setClosed(boolean closed)
builder
if necessary.closed
- public Block clone()
canStart(String, int)
method is
called in order to implement the Template design pattern.Copyright © 2007, 2013 David Green and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html