Class Delimiter

java.lang.Object
org.commonmark.internal.Delimiter
All Implemented Interfaces:
DelimiterRun

public class Delimiter extends Object implements DelimiterRun
Delimiter (emphasis, strong emphasis or custom emphasis).
  • Field Details

    • characters

      public final 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
  • Constructor Details

    • Delimiter

      public Delimiter(List<Text> characters, char delimiterChar, boolean canOpen, boolean canClose, Delimiter previous)
  • Method Details

    • canOpen

      public boolean canOpen()
      Specified by:
      canOpen in interface DelimiterRun
      Returns:
      whether this can open a delimiter
    • canClose

      public boolean canClose()
      Specified by:
      canClose in interface DelimiterRun
      Returns:
      whether this can close a delimiter
    • length

      public int length()
      Specified by:
      length in interface DelimiterRun
      Returns:
      the number of characters in this delimiter run (that are left for processing)
    • originalLength

      public int originalLength()
      Specified by:
      originalLength in interface DelimiterRun
      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 interface DelimiterRun
      Returns:
      the innermost opening delimiter, e.g. for *** this is the last *
    • getCloser

      public Text getCloser()
      Specified by:
      getCloser in interface DelimiterRun
      Returns:
      the innermost closing delimiter, e.g. for *** this is the first *
    • getOpeners

      public 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 and DelimiterRun.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 interface DelimiterRun
    • getClosers

      public 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 and DelimiterRun.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 interface DelimiterRun