Class ColumnModelDataFrame

  • All Implemented Interfaces:
    DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>, MutableDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>

    public class ColumnModelDataFrame
    extends AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
    implements MutableDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
    Converts a TableModel into a DataFrame.
    • Constructor Detail

      • ColumnModelDataFrame

        public ColumnModelDataFrame​(java.lang.String columnName,
                                    com.macrofocus.data.column.ColumnModel tableModel)
    • Method Detail

      • getRowClass

        public java.lang.Class getRowClass​(java.lang.Integer row)
        Description copied from interface: DataFrame
        Returns the most specific superclass for all cell values in a row.
        Specified by:
        getRowClass in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        row - the key of the row
        Returns:
        the common ancestor class of the object values in the row.
      • getColumnClass

        public java.lang.Class getColumnClass​(java.lang.String column)
        Description copied from interface: DataFrame
        Returns the most specific superclass for all cell values in a column
        Specified by:
        getColumnClass in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        column - the key of the column
        Returns:
        the common ancestor class of the object values in the column.
      • getValueAt

        public java.lang.Object getValueAt​(java.lang.Integer row,
                                           java.lang.String column)
        Description copied from interface: DataFrame
        Returns the value for the cell at the intersection of the column key and row key.
        Specified by:
        getValueAt in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        row - the row key whose value is to be queried
        column - the column key whose value is to be queried
        Returns:
        the value Object at the specified cell
      • setValueAt

        public void setValueAt​(java.lang.Integer row,
                               java.lang.String column,
                               java.lang.Object value)
        Description copied from interface: MutableDataFrame
        Sets the value for the cell at the intersection of the column key and row key.
        Specified by:
        setValueAt in interface MutableDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        row - the row key whose value is to be changed
        column - the column key whose value is to be changed
        value - the new value at the specified cell
      • getRow

        public Series<java.lang.String,​?> getRow​(java.lang.Integer row)
        Description copied from interface: DataFrame
        Returns a series of all the values of a given row.
        Specified by:
        getRow in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        row - the row key
        Returns:
        a Series object
      • getColumn

        public Series<java.lang.Integer,​java.lang.Object> getColumn​(java.lang.String column)
        Description copied from interface: DataFrame
        Returns a series of all the values of a given column.
        Specified by:
        getColumn in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getColumn in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        column - the row key
        Returns:
        a Series object
      • rows

        public java.lang.Iterable<java.lang.Integer> rows()
        Description copied from interface: DataFrame
        Returns the row keys.
        Specified by:
        rows in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        rows in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Returns:
        the row keys
      • columns

        public java.lang.Iterable<java.lang.String> columns()
        Description copied from interface: DataFrame
        Returns the column keys.
        Specified by:
        columns in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        columns in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Returns:
        the column keys
      • getRowKey

        public java.lang.Integer getRowKey​(int index)
        Description copied from interface: DataFrame
        Returns the row key at the specified absolute index. This is the inverse of DataFrame.getRowAddress(Object).
        Specified by:
        getRowKey in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getRowKey in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        index - the index
        Returns:
        the row key
      • getColumnKey

        public java.lang.String getColumnKey​(int index)
        Description copied from interface: DataFrame
        Returns the column key at the specified absolute index. This is the inverse of DataFrame.getColumnAddress(Object).
        Specified by:
        getColumnKey in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getColumnKey in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        index - the index
        Returns:
        the column key
      • getRowAddress

        public int getRowAddress​(java.lang.Integer row)
        Description copied from interface: DataFrame
        Returns the absolute index for the specified row key. This is the inverse of DataFrame.getRowKey(int).
        Specified by:
        getRowAddress in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getRowAddress in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        row - the row key
        Returns:
        the absolute index of the specified key.
      • getColumnAddress

        public int getColumnAddress​(java.lang.String column)
        Description copied from interface: DataFrame
        Returns the absolute index for the specified column key. This is the inverse of DataFrame.getColumnKey(int).
        Specified by:
        getColumnAddress in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getColumnAddress in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        column - the column key
        Returns:
        the absolute index of the specified key.
      • getRowCount

        public int getRowCount()
        Description copied from interface: DataFrame
        Returns the number of rows contained by the this data frame.
        Specified by:
        getRowCount in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getRowCount in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Returns:
        the number of rows.
      • getColumnCount

        public int getColumnCount()
        Description copied from interface: DataFrame
        Returns the number of columns contained by this data frame.
        Specified by:
        getColumnCount in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        getColumnCount in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Returns:
        the number of columns.
      • reindexRows

        public MutableDataFrame<MultiKey,​java.lang.String,​java.lang.Object> reindexRows​(java.lang.String... rows)
        Description copied from interface: DataFrame
        Returns a new data frame reindexed using the values coming from the specified rows.
        Specified by:
        reindexRows in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Specified by:
        reindexRows in interface MutableDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Overrides:
        reindexRows in class AbstractDataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Parameters:
        rows - the columns to use for the label values
        Returns:
        the reindexed data frame.
      • join

        public DataFrame join​(Series series,
                              java.lang.String[] columns)
        Specified by:
        join in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
      • getRowIndex

        public UniqueIndex<java.lang.Integer> getRowIndex()
        Description copied from interface: DataFrame
        Gets the index used to access the rows.
        Specified by:
        getRowIndex in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Returns:
        the row index
      • getColumnIndex

        public UniqueIndex<java.lang.String> getColumnIndex()
        Description copied from interface: DataFrame
        Gets the index used to access the columns.
        Specified by:
        getColumnIndex in interface DataFrame<java.lang.Integer,​java.lang.String,​java.lang.Object>
        Returns:
        the column index