Package adams.ml.data

Class InstancesHeaderRow

    • Field Detail

      • m_Data

        protected weka.core.Instances m_Data
        the underlying data.
    • Constructor Detail

      • InstancesHeaderRow

        public InstancesHeaderRow​(InstancesView owner)
        Initializes the header row.
        Parameters:
        owner - the owner
    • Method Detail

      • getData

        public weka.core.Instances getData()
        Returns the underlying Instance.
        Returns:
        the underlying data
      • cellKeyToIndex

        protected int cellKeyToIndex​(String cellKey)
        Turns the cellKey into a column index.
        Parameters:
        cellKey - the cellKey to convert
        Returns:
        the column index, -1 if failed to convert
      • setOwner

        public void setOwner​(SpreadSheet owner)
        Sets the spreadsheet this row belongs to.
        Specified by:
        setOwner in interface Row
        Overrides:
        setOwner in class AbstractRow
        Parameters:
        owner - the owner
      • clear

        public void clear()
        Removes all cells.
        Does nothing.
        Specified by:
        clear in interface Row
        Overrides:
        clear in class HeaderRow
      • assign

        public void assign​(Row row)
        Obtains copies of the cells from the other row, but not the owner.
        Does nothing.
        Specified by:
        assign in interface Row
        Overrides:
        assign in class HeaderRow
        Parameters:
        row - the row to get the cells from
      • newCell

        public Cell newCell​(Row owner)
        Creates a new instance of a cell.
        Specified by:
        newCell in interface Row
        Overrides:
        newCell in class HeaderRow
        Parameters:
        owner - the owner
        Returns:
        always null
      • hasCell

        public boolean hasCell​(int columnIndex)
        Returns whether the row alread contains the cell at the specified location.
        Specified by:
        hasCell in interface Row
        Overrides:
        hasCell in class HeaderRow
        Parameters:
        columnIndex - the column index
        Returns:
        true if the cell already exists
      • hasCell

        public boolean hasCell​(String cellKey)
        Returns whether the row alread contains the cell with the given key.
        Specified by:
        hasCell in interface Row
        Overrides:
        hasCell in class AbstractRow
        Parameters:
        cellKey - the key to look for
        Returns:
        true if the cell already exists
      • addCell

        public Cell addCell​(int columnIndex)
        Adds a cell with the key of the cell in the header at the specified location. If the cell already exists, it returns that instead of creating one.
        Specified by:
        addCell in interface Row
        Overrides:
        addCell in class HeaderRow
        Parameters:
        columnIndex - the index of the column to create
        Returns:
        the created cell or the already existing cell
      • addCell

        public Cell addCell​(String cellKey)
        Adds a cell with the given key to the list and returns the created object. If the cell already exists, then this cell is returned instead and no new object created.
        Specified by:
        addCell in interface Row
        Overrides:
        addCell in class HeaderRow
        Parameters:
        cellKey - the key for the cell to create
        Returns:
        the created cell or the already existing cell
      • removeCell

        public Cell removeCell​(int columnIndex)
        Removes the cell at the specified index.
        Specified by:
        removeCell in interface Row
        Overrides:
        removeCell in class AbstractRow
        Parameters:
        columnIndex - the index of the column
        Returns:
        the removed cell, null if not removed
      • removeCell

        public Cell removeCell​(String cellKey)
        Removes the cell at the specified index.
        Specified by:
        removeCell in interface Row
        Overrides:
        removeCell in class HeaderRow
        Parameters:
        cellKey - the key of the cell to remove
        Returns:
        the removed cell, null if non removed
      • getCell

        public Cell getCell​(String cellKey)
        Returns the cell with the given key, null if not found.
        Specified by:
        getCell in interface Row
        Overrides:
        getCell in class AbstractRow
        Parameters:
        cellKey - the cell to look for
        Returns:
        the cell or null if not found
      • getCell

        public Cell getCell​(int columnIndex)
        Returns the cell with the given index, null if not found.
        Specified by:
        getCell in interface Row
        Overrides:
        getCell in class AbstractRow
        Parameters:
        columnIndex - the index of the column
        Returns:
        the cell or null if not found
      • getContent

        public String getContent​(int columnIndex)
        Returns the cell content with the given index.
        Specified by:
        getContent in interface Row
        Overrides:
        getContent in class AbstractRow
        Parameters:
        columnIndex - the index of the column
        Returns:
        the content or null if not found
      • getCellKey

        public String getCellKey​(int columnIndex)
        Returns the cell key with the given column index.
        Specified by:
        getCellKey in interface Row
        Overrides:
        getCellKey in class HeaderRow
        Parameters:
        columnIndex - the index of the column
        Returns:
        the cell key, null if invalid index
      • getCellCount

        public int getCellCount()
        Returns the number of cells stored in the row.
        Specified by:
        getCellCount in interface Row
        Overrides:
        getCellCount in class AbstractRow
        Returns:
        the number of cells
      • removeMissing

        public boolean removeMissing()
        Removes all cells marked "missing".
        Specified by:
        removeMissing in interface Row
        Overrides:
        removeMissing in class AbstractRow
        Returns:
        true if any cell was removed
      • indexOf

        public int indexOf​(Cell cell)
        Returns the column this particular cell is in (must belong to this row!).
        Specified by:
        indexOf in interface Row
        Overrides:
        indexOf in class HeaderRow
        Parameters:
        cell - the cell to get the column index of
        Returns:
        the column index, -1 if not found
      • mergeWith

        public void mergeWith​(Row other)
        Merges its own data with the one provided by the specified row.

        Not implemented!
        Specified by:
        mergeWith in interface Mergeable<Row>
        Specified by:
        mergeWith in interface Row
        Overrides:
        mergeWith in class HeaderRow
        Parameters:
        other - the row to merge with
      • toString

        public String toString()
        Simply returns the internal hashtable of cells as string.
        Specified by:
        toString in interface Row
        Overrides:
        toString in class AbstractRow
        Returns:
        the values of the row