Class HeaderRow

    • Field Detail

      • m_CellKeys

        protected ArrayList<String> m_CellKeys
        the cell keys of the row.
    • Constructor Detail

      • HeaderRow

        public HeaderRow​(SpreadSheet owner)
        default constructor.
        Parameters:
        owner - the spreadsheet this row belongs to
    • Method Detail

      • assign

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

        public HeaderRow getClone​(SpreadSheet owner)
        Returns a clone of itself.
        Parameters:
        owner - the new owner
        Returns:
        the clone
      • clear

        public void clear()
        Removes all cells.
        Specified by:
        clear in interface Row
        Overrides:
        clear in class AbstractRow
      • newCell

        public Cell newCell​(Row owner)
        Creates a new instance of a cell.
        Parameters:
        owner - the owner
        Returns:
        the cell
      • hasCell

        public boolean hasCell​(int columnIndex)
        Returns whether the row alread contains the cell at the specified location.
        Parameters:
        columnIndex - the column index
        Returns:
        true if the cell already exists
      • indexOf

        public int indexOf​(String cellKey)
        Returns the index of the specified key.
        Parameters:
        cellKey - the key to look for
        Returns:
        the index of the cell, -1 if not found
      • indexOfContent

        public int indexOfContent​(String content)
        Returns the index of the cell that has the specified content.
        Parameters:
        content - the content to look for
        Returns:
        the index of the cell, -1 if not found
      • 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
        Specified by:
        addCell in class AbstractRow
        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
        Specified by:
        addCell in class AbstractRow
        Parameters:
        cellKey - the key for the cell to create
        Returns:
        the created cell or the already existing cell
      • insertCell

        public Cell insertCell​(int columnIndex)
        Inserts a cell at the specified location.
        Parameters:
        columnIndex - the location of the new cell
        Returns:
        the created cell
      • removeCell

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

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

        public Collection<String> cellKeys()
        Returns a collection of all stored cell keys.
        Specified by:
        cellKeys in interface Row
        Specified by:
        cellKeys in class AbstractRow
        Returns:
        all cell keys (sorted according to columns)
      • cells

        public Collection<Cell> cells()
        Returns all cells.
        Returns:
        the cells (sorted)
      • indexOf

        public int indexOf​(Cell cell)
        Returns the column this particular cell is in (must belong to this row!).
        Parameters:
        cell - the cell to get the column index of
        Returns:
        the column index, -1 if not found
      • uniqueKey

        protected String uniqueKey​(String key)
        Ensures that the key is not yet present. In case the key is already used it is made unique.
        Parameters:
        key - the key to check
        Returns:
        the potentially updated key
      • mergeWith

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