Package org.commonmark.internal
Class Delimiter
- java.lang.Object
-
- org.commonmark.internal.Delimiter
-
- All Implemented Interfaces:
DelimiterRun
public class Delimiter extends java.lang.Object implements DelimiterRun
Delimiter (emphasis, strong emphasis or custom emphasis).
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
canClose
private boolean
canOpen
java.util.List<Text>
characters
char
delimiterChar
Delimiter
next
private int
originalLength
Delimiter
previous
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canClose()
boolean
canOpen()
Text
getCloser()
java.lang.Iterable<Text>
getClosers(int length)
Get the closing delimiter nodes for the specified length of delimiters.Text
getOpener()
java.lang.Iterable<Text>
getOpeners(int length)
Get the opening delimiter nodes for the specified length of delimiters.int
length()
int
originalLength()
-
-
-
Field Detail
-
characters
public final java.util.List<Text> characters
-
delimiterChar
public final char delimiterChar
-
originalLength
private final int originalLength
-
canOpen
private final boolean canOpen
-
canClose
private final boolean canClose
-
previous
public Delimiter previous
-
next
public Delimiter next
-
-
Method Detail
-
canOpen
public boolean canOpen()
- Specified by:
canOpen
in interfaceDelimiterRun
- Returns:
- whether this can open a delimiter
-
canClose
public boolean canClose()
- Specified by:
canClose
in interfaceDelimiterRun
- Returns:
- whether this can close a delimiter
-
length
public int length()
- Specified by:
length
in interfaceDelimiterRun
- Returns:
- the number of characters in this delimiter run (that are left for processing)
-
originalLength
public int originalLength()
- Specified by:
originalLength
in interfaceDelimiterRun
- Returns:
- the number of characters originally in this delimiter run; at the start of processing, this is the same
as {
DelimiterRun.length()
}
-
getOpener
public Text getOpener()
- Specified by:
getOpener
in interfaceDelimiterRun
- Returns:
- the innermost opening delimiter, e.g. for
***
this is the last*
-
getCloser
public Text getCloser()
- Specified by:
getCloser
in interfaceDelimiterRun
- Returns:
- the innermost closing delimiter, e.g. for
***
this is the first*
-
getOpeners
public java.lang.Iterable<Text> getOpeners(int length)
Description copied from interface:DelimiterRun
Get the opening delimiter nodes for the specified length of delimiters. Length must be between 1 andDelimiterRun.length()
.For example, for a delimiter run
***
, calling this with 1 would return the last*
. Calling it with 2 would return the second last*
and the last*
.- Specified by:
getOpeners
in interfaceDelimiterRun
-
getClosers
public java.lang.Iterable<Text> getClosers(int length)
Description copied from interface:DelimiterRun
Get the closing delimiter nodes for the specified length of delimiters. Length must be between 1 andDelimiterRun.length()
.For example, for a delimiter run
***
, calling this with 1 would return the first*
. Calling it with 2 would return the first*
and the second*
.- Specified by:
getClosers
in interfaceDelimiterRun
-
-