Class MarkdownTableCell


  • public class MarkdownTableCell
    extends Object
    This class contains the contents of a table cell. It's used to help keep track of information about the table so the final table can be built with clean formatting.
    Author:
    Phil DeJarnett
    • Constructor Detail

      • MarkdownTableCell

        public MarkdownTableCell()
        Creates a new, empty MarkdownTableCell
      • MarkdownTableCell

        public MarkdownTableCell​(String contents)
        Creates a new MarkdownTableCell with only contents
        Parameters:
        contents - The contents of this cell
      • MarkdownTableCell

        public MarkdownTableCell​(String contents,
                                 MarkdownTable.Alignment alignment)
        Creates a new MarkdownTableCell with contents and alignment
        Parameters:
        contents - The contents of this cell
        alignment - The alignment of this cell (if specified)
      • MarkdownTableCell

        public MarkdownTableCell​(String contents,
                                 int colspan)
        Creates a new MarkdownTableCell with contents and a colspan
        Parameters:
        contents - The contents of this cell
        colspan - The number of columns this cell spans
      • MarkdownTableCell

        public MarkdownTableCell​(String contents,
                                 MarkdownTable.Alignment alignment,
                                 int colspan)
        Creates a new MarkdownTableCell with contents and a colspan
        Parameters:
        contents - The contents of this cell
        alignment - The alignment of this cell (if specified)
        colspan - The number of columns this cell spans
    • Method Detail

      • getAlignment

        public MarkdownTable.Alignment getAlignment()
        Gets the text-alignment of this cell
        Returns:
        The alignment of this cell
      • setAlignment

        public void setAlignment​(MarkdownTable.Alignment alignment)
        Sets the text-alignment. Note: the alignment cannot be null.
        Parameters:
        alignment - The new alignment
      • getContents

        public String getContents()
      • setContents

        public void setContents​(String contents)
        Sets the contents of this cell. If the contents contain any linebreaks, they will be replaced with spaces.
        Parameters:
        contents - The new cell contents
      • getColspan

        public int getColspan()
      • setColspan

        public void setColspan​(int colspan)
        Sets the number of columns this cell spans. If the colspan is less than 1, it is set to 1.
        Parameters:
        colspan - The new colspan
      • getWidth

        public int getWidth()
        Returns the number of characters needed to show this column. It adds two to the content width, so there is padding around the content.
        Returns:
        The width of this column in characters, plus 2 chars for spacing.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object