Class TextDocument

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class TextDocument
    extends java.lang.Object
    implements java.lang.Cloneable
    A text document, consisting of one or more TextBlocks.
    • Field Detail

      • textBlocks

        final java.util.List<TextBlock> textBlocks
      • title

        java.lang.String title
    • Constructor Detail

      • TextDocument

        public TextDocument​(java.util.List<TextBlock> textBlocks)
        Creates a new TextDocument with given TextBlocks, and no title.
        Parameters:
        textBlocks - The text blocks of this document.
      • TextDocument

        public TextDocument​(java.lang.String title,
                            java.util.List<TextBlock> textBlocks)
        Creates a new TextDocument with given TextBlocks and given title.
        Parameters:
        title - The "main" title for this text document.
        textBlocks - The text blocks of this document.
    • Method Detail

      • getTextBlocks

        public java.util.List<TextBlock> getTextBlocks()
        Returns the TextBlocks of this document.
        Returns:
        A list of TextBlocks, in sequential order of appearance.
      • getTitle

        public java.lang.String getTitle()
        Returns the "main" title for this document, or null if no such title has ben set.
        Returns:
        The "main" title.
      • setTitle

        public void setTitle​(java.lang.String title)
        Updates the "main" title for this document.
        Parameters:
        title -
      • getContent

        public java.lang.String getContent()
        Returns the TextDocument's content.
        Returns:
        The content text.
      • getText

        public java.lang.String getText​(boolean includeContent,
                                        boolean includeNonContent)
        Returns the TextDocument's content, non-content or both
        Parameters:
        includeContent - Whether to include TextBlocks marked as "content".
        includeNonContent - Whether to include TextBlocks marked as "non-content".
        Returns:
        The text.
      • debugString

        public java.lang.String debugString()
        Returns detailed debugging information about the contained TextBlocks.
        Returns:
        Debug information.
      • clone

        public TextDocument clone()
        Overrides:
        clone in class java.lang.Object