Class AbstractStringColumn<C extends AbstractColumn<C,String>>

java.lang.Object
tech.tablesaw.columns.AbstractColumn<C,String>
tech.tablesaw.columns.strings.AbstractStringColumn<C>
All Implemented Interfaces:
Iterable<String>, Comparator<String>, CategoricalColumn<String>, Column<String>, StringFilters, StringMapFunctions, StringReduceUtils, FilterSpec<Selection>, StringFilterSpec<Selection>
Direct Known Subclasses:
StringColumn, TextColumn

public abstract class AbstractStringColumn<C extends AbstractColumn<C,String>> extends AbstractColumn<C,String> implements CategoricalColumn<String>, StringFilters, StringMapFunctions, StringReduceUtils
Abstract super class for Text like columns.
  • Constructor Details

  • Method Details

    • setPrintFormatter

      public void setPrintFormatter(StringColumnFormatter formatter)
      Sets an StringColumnFormatter which will be used to format the display of data from this column when it is printed (using, for example, Table:print()) and optionally when written to a text file like a CSV.
    • getPrintFormatter

      public StringColumnFormatter getPrintFormatter()
      Returns the current StringColumnFormatter.
    • getString

      public String getString(int row)
      Returns a string representation of the value at the given row.
      Specified by:
      getString in interface Column<C extends AbstractColumn<C,String>>
      Parameters:
      row - The index of the row.
      Returns:
      value as String
    • getUnformattedString

      public String getUnformattedString(int row)
      Returns a String representation of the value at index r, without any formatting applied
      Specified by:
      getUnformattedString in interface Column<C extends AbstractColumn<C,String>>
    • top

      public List<String> top(int n)
      Returns the largest ("top") n values in the column
      Parameters:
      n - The maximum number of records to return. The actual number will be smaller if n is greater than the number of observations in the column
      Returns:
      A list, possibly empty, of the largest observations
    • bottom

      public List<String> bottom(int n)
      Returns the smallest ("bottom") n values in the column
      Parameters:
      n - The maximum number of records to return. The actual number will be smaller if n is greater than the number of observations in the column
      Returns:
      A list, possibly empty, of the smallest n observations
    • append

      public Column<String> append(Column<String> column, int row)
      Appends the value at the given row in the given column to the bottom of this column and return this column
      Specified by:
      append in interface Column<C extends AbstractColumn<C,String>>
    • set

      public Column<String> set(int row, Column<String> column, int sourceRow)
      Sets the value at row to the value at sourceRow in the given column and return this column
      Specified by:
      set in interface Column<C extends AbstractColumn<C,String>>
    • byteSize

      public int byteSize()
      Returns the width of a cell in this column, in bytes.
      Specified by:
      byteSize in interface Column<C extends AbstractColumn<C,String>>
      Returns:
      width in bytes
    • compare

      public int compare(String o1, String o2)
      Specified by:
      compare in interface Comparator<C extends AbstractColumn<C,String>>