Class MarkdownTable

java.lang.Object
com.vladsch.flexmark.util.format.MarkdownTable

public class MarkdownTable extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • getTableChars

      public CharSequence getTableChars()
    • getCaptionCell

      public TableCell getCaptionCell()
    • getFormatTableIndentPrefix

      public CharSequence getFormatTableIndentPrefix()
    • setFormatTableIndentPrefix

      public void setFormatTableIndentPrefix(CharSequence formatTableIndentPrefix)
    • setCaptionCell

      public void setCaptionCell(TableCell captionCell)
    • getCaption

      public BasedSequence getCaption()
    • setCaption

      public void setCaption(CharSequence caption)
    • setCaptionWithMarkers

      public void setCaptionWithMarkers(Node tableCellNode, CharSequence captionOpen, CharSequence caption, CharSequence captionClose)
    • getHeadingRowCount

      public int getHeadingRowCount()
    • getSeparatorRowCount

      public int getSeparatorRowCount()
    • getBodyRowCount

      public int getBodyRowCount()
    • getCaptionRowCount

      public int getCaptionRowCount()
    • getMaxHeadingColumns

      public int getMaxHeadingColumns()
    • getMaxSeparatorColumns

      public int getMaxSeparatorColumns()
    • getMaxBodyColumns

      public int getMaxBodyColumns()
    • getHaveCaption

      public boolean getHaveCaption()
    • getMinColumns

      public int getMinColumns()
    • getMaxColumns

      public int getMaxColumns()
    • getMinColumnsWithoutColumns

      public int getMinColumnsWithoutColumns(boolean withSeparator, int... skipColumns)
    • getMaxColumnsWithoutColumns

      public int getMaxColumnsWithoutColumns(boolean withSeparator, int... skipColumns)
    • getMinColumnsWithoutRows

      public int getMinColumnsWithoutRows(boolean withSeparator, int... skipRows)
    • getMaxColumnsWithoutRows

      public int getMaxColumnsWithoutRows(boolean withSeparator, int... skipRows)
    • getTrackedOffsets

      @NotNull public @NotNull List<TrackedOffset> getTrackedOffsets()
    • findTrackedOffset

      @Nullable private @Nullable TrackedOffset findTrackedOffset(int offset)
    • getTrackedOffset

      @Nullable public @Nullable TrackedOffset getTrackedOffset(int offset)
    • getTrackedOffsetIndex

      public int getTrackedOffsetIndex(int offset)
    • getTableStartOffset

      public int getTableStartOffset()
    • getCellOffsetInfo

      public TableCellOffsetInfo getCellOffsetInfo(int offset)
    • addTrackedOffset

      @Deprecated public boolean addTrackedOffset(int offset)
      Deprecated.
      Use addTrackedOffset(TrackedOffset) To create: TrackedOffset.track(offset)
    • addTrackedOffset

      @Deprecated public boolean addTrackedOffset(int offset, boolean afterSpace)
      Deprecated.
      Use addTrackedOffset(TrackedOffset) To create: TrackedOffset.track(offset, afterSpace)
    • addTrackedOffset

      @Deprecated public boolean addTrackedOffset(int offset, boolean afterSpace, boolean afterDelete)
      Deprecated.
      Use addTrackedOffset(TrackedOffset) To create: TrackedOffset.track(offset, afterSpace, afterDelete)
    • addTrackedOffset

      @Deprecated public boolean addTrackedOffset(int offset, Character c, boolean afterDelete)
      Deprecated.
      Use addTrackedOffset(TrackedOffset) To create: TrackedOffset.track(offset, c, afterDelete)
    • addTrackedOffset

      public boolean addTrackedOffset(@NotNull @NotNull TrackedOffset trackedOffset)
    • getAllRows

      public List<TableRow> getAllRows()
    • getAllContentRows

      public List<TableRow> getAllContentRows()
    • getAllSectionRows

      public List<TableRow> getAllSectionRows()
    • getAllSectionsRows

      private List<TableRow> getAllSectionsRows(TableSection... sections)
    • isAllRowsSeparator

      public boolean isAllRowsSeparator(int index)
    • getAllRowsSection

      public TableSection getAllRowsSection(int index)
    • getAllRowsCount

      public int getAllRowsCount()
    • getAllContentRowsCount

      public int getAllContentRowsCount()
    • getAllSectionsRowsCount

      public int getAllSectionsRowsCount()
    • forAllRows

      public void forAllRows(TableRowManipulator manipulator)
    • forAllRows

      public void forAllRows(int startIndex, TableRowManipulator manipulator)
    • forAllRows

      public void forAllRows(int startIndex, int count, TableRowManipulator manipulator)
    • forAllContentRows

      public void forAllContentRows(TableRowManipulator manipulator)
    • forAllContentRows

      public void forAllContentRows(int startIndex, TableRowManipulator manipulator)
    • forAllContentRows

      public void forAllContentRows(int startIndex, int count, TableRowManipulator manipulator)
    • forAllSectionRows

      public void forAllSectionRows(TableRowManipulator manipulator)
    • forAllSectionRows

      public void forAllSectionRows(int startIndex, TableRowManipulator manipulator)
    • forAllSectionRows

      public void forAllSectionRows(int startIndex, int count, TableRowManipulator manipulator)
    • forAllHeaderRows

      public void forAllHeaderRows(TableRowManipulator manipulator)
    • forAllHeaderRows

      public void forAllHeaderRows(int startIndex, TableRowManipulator manipulator)
    • forAllHeaderRows

      public void forAllHeaderRows(int startIndex, int count, TableRowManipulator manipulator)
    • forAllBodyRows

      public void forAllBodyRows(TableRowManipulator manipulator)
    • forAllBodyRows

      public void forAllBodyRows(int startIndex, TableRowManipulator manipulator)
    • forAllBodyRows

      public void forAllBodyRows(int startIndex, int count, TableRowManipulator manipulator)
    • deleteRows

      public void deleteRows(int rowIndex, int count)
    • insertRows

      public void insertRows(int rowIndex, int count)
    • insertRows

      private void insertRows(ArrayList<TableRow> rows, int index, int count, int maxColumns)
    • insertColumns

      public void insertColumns(int column, int count)
    • deleteColumns

      public void deleteColumns(int column, int count)
    • moveColumn

      public void moveColumn(int fromColumn, int toColumn)
    • isEmptyColumn

      public boolean isEmptyColumn(int column)
      Test all rows for having given column empty. All columns after row's max column are empty
      Parameters:
      column - index in allRows list
      Returns:
      true if column is empty for all rows, separator row excluded
    • isAllRowsEmptyAt

      public boolean isAllRowsEmptyAt(int rowIndex)
      Test a row for having all empty columns
      Parameters:
      rowIndex - index in allRows list
      Returns:
      true if row is empty or is a separator row
    • isContentRowsEmptyAt

      public boolean isContentRowsEmptyAt(int rowIndex)
      Test a row for having all empty columns
      Parameters:
      rowIndex - index in allRows list
      Returns:
      true if row is empty or is a separator row
    • isEmptyRowAt

      private boolean isEmptyRowAt(int rowIndex, TableSection[] sections)
      Test a row for having all empty columns
      Parameters:
      rowIndex - index in allRows list
      sections - sections to use for rows array generation
      Returns:
      true if row is empty or is a separator row
    • getHeader

      public boolean getHeader()
    • setHeader

      public void setHeader(boolean header)
    • isSeparator

      public boolean isSeparator()
    • setSeparator

      public void setSeparator(boolean separator)
    • setHeader

      public void setHeader()
    • setSeparator

      public void setSeparator()
    • setBody

      public void setBody()
    • nextRow

      public void nextRow()
    • addCell

      public void addCell(@NotNull @NotNull TableCell cell)
      Parameters:
      cell - cell to add
    • normalize

      public void normalize()
    • finalizeTable

      public void finalizeTable()
    • fillMissingColumns

      public void fillMissingColumns()
    • fillMissingColumns

      public void fillMissingColumns(Integer minColumn)
    • setTrackedOffsetIndex

      private boolean setTrackedOffsetIndex(int offset, int index)
    • transposed

      public MarkdownTable transposed(int columnHeaders)
      Transpose table
      Parameters:
      columnHeaders - number of first columns to use as header rows, 0..maxColumns
      Returns:
      transposed table
    • sorted

      public MarkdownTable sorted(ColumnSort[] columnSorts, int textCollectionFlags, @Nullable @Nullable NumericSuffixPredicate numericSuffixTester)
      Sort table
      Parameters:
      columnSorts - column sort information
      textCollectionFlags - collection flags to use for collecting cell text
      numericSuffixTester - predicate to test non-numeric suffix of numeric column content, return true if suffix is acceptable, null will result in all suffixes being accepted
      Returns:
      sorted table
    • appendDashes

      int appendDashes(LineAppendable out, int dashCount, BasedSequence sepDashes, int dashOffset)
    • appendTable

      public void appendTable(LineAppendable out)
    • appendFormattedCaption

      public static void appendFormattedCaption(LineAppendable out, BasedSequence caption, TableFormatOptions options)
    • formattedCaption

      public static String formattedCaption(BasedSequence caption, TableFormatOptions options)
    • pipeNeedsSpaceBefore

      private boolean pipeNeedsSpaceBefore(TableCell cell)
    • pipeNeedsSpaceAfter

      private boolean pipeNeedsSpaceAfter(TableCell cell)
    • appendRows

      private void appendRows(LineAppendable out, List<TableRow> rows, boolean isHeader, CharSequence linePrefix)
    • appendColumnSpan

      private void appendColumnSpan(LineAppendable out, int span, int cellInsideEndOffset, int trackedSpanOffset)
    • cellText

      private BasedSequence cellText(List<TableCell> cells, int index, boolean withTrackedOffset, boolean isHeader, int width, CellAlignment alignment, Ref<Integer> delta)
    • spanWidth

      private int spanWidth(int col, int columnSpan)
    • spanFixedWidth

      private int spanFixedWidth(BitSet unfixedColumns, int col, int columnSpan)
    • adjustCellAlignment

      private CellAlignment adjustCellAlignment(CellAlignment alignment)
    • aggregateTotalColumnsWithoutColumns

      private int aggregateTotalColumnsWithoutColumns(TableSection[] sections, BiFunction<Integer,Integer,Integer> aggregator, int... skipColumns)
    • aggregateTotalColumnsWithoutRows

      private int aggregateTotalColumnsWithoutRows(TableSection[] sections, BiFunction<Integer,Integer,Integer> aggregator, int... skipRows)
    • forAllSectionsRows

      private void forAllSectionsRows(int startIndex, int count, TableSection[] sections, TableRowManipulator manipulator)
    • toString

      public String toString()
      Overrides:
      toString in class Object