Documentation of 'de.erichseifert.gral.data.DataTable' Java class
DataTable
de.erichseifert.gral.data

Class DataTable

    • Constructor Detail

      • DataTable

        public DataTable()
      • DataTable

        public DataTable(java.lang.Class<? extends java.lang.Comparable<?>>... types)
        Initializes a new instance with the specified number of columns and column types.
        Parameters:
        types - Type for each column
      • DataTable

        public DataTable(int cols,
                         java.lang.Class<? extends java.lang.Comparable<?>> type)
        Initializes a new instance with the specified number of columns and a single column type.
        Parameters:
        cols - Number of columns
        type - Data type for all columns
      • DataTable

        public DataTable(DataSource source)
        Initializes a new instance with the column types, and data of another data source.
        Parameters:
        source - Data source to clone.
      • DataTable

        public DataTable(Column... columns)
    • Method Detail

      • add

        public int add(java.lang.Comparable<?>... values)
        Adds a row with the specified comparable values to the table. The values are added in the order they are specified. If the types of the table columns and the values do not match, an IllegalArgumentException is thrown.
        Specified by:
        add in interface MutableDataSource
        Parameters:
        values - values to be added as a row
        Returns:
        Index of the row that has been added.
      • add

        public int add(java.util.List<? extends java.lang.Comparable<?>> values)
        Adds a row with the specified container's elements to the table. The values are added in the order they are specified. If the types of the table columns and the values do not match, an IllegalArgumentException is thrown.
        Specified by:
        add in interface MutableDataSource
        Parameters:
        values - values to be added as a row
        Returns:
        Index of the row that has been added.
      • add

        public int add(Row row)
        Adds the specified row to the table. The values are added in the order they are specified. If the types of the table columns and the values do not match, an IllegalArgumentException is thrown.
        Specified by:
        add in interface MutableDataSource
        Parameters:
        row - Row to be added
        Returns:
        Index of the row that has been added.
      • add

        public void add(Record row)
      • remove

        public void remove(int row)
        Removes a specified row from the table.
        Specified by:
        remove in interface MutableDataSource
        Parameters:
        row - Index of the row to remove
      • clear

        public void clear()
        Deletes all rows this table contains.
        Specified by:
        clear in interface MutableDataSource
      • get

        public java.lang.Comparable<?> get(int col,
                                           int row)
        Returns the row with the specified index.
        Specified by:
        get in interface DataSource
        Parameters:
        col - index of the column to return
        row - index of the row to return
        Returns:
        the specified value of the data cell
      • set

        public <T> java.lang.Comparable<T> set(int col,
                                               int row,
                                               java.lang.Comparable<T> value)
        Sets the value of a cell specified by its column and row indexes.
        Specified by:
        set in interface MutableDataSource
        Type Parameters:
        T - Data type of the cell.
        Parameters:
        col - Column of the cell to change.
        row - Row of the cell to change.
        value - New value to be set.
        Returns:
        Old value that was replaced.
      • getRowCount

        public int getRowCount()
        Returns the number of rows of the data source.
        Specified by:
        getRowCount in interface DataSource
        Returns:
        number of rows in the data source.
      • sort

        public void sort(DataComparator... comparators)
        Sorts the table rows with the specified DataComparators. The row values are compared in the way the comparators are specified.
        Specified by:
        sort in interface MutableDataSource
        Parameters:
        comparators - comparators used for sorting
      • setName

        public void setName(java.lang.String name)
        Description copied from interface: MutableDataSource
        Sets the name of this series.
        Specified by:
        setName in interface MutableDataSource
        Parameters:
        name - name to be set

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.