Class SparseDataRow

    • Constructor Detail

      • SparseDataRow

        public SparseDataRow()
        Default constructor for GOE only.
      • SparseDataRow

        public SparseDataRow​(SpreadSheet owner)
        Constructor that ties row to spreadsheet.
        Parameters:
        owner - the spreadsheet this row belongs to
    • Method Detail

      • getClone

        public DataRow getClone​(SpreadSheet owner)
        Returns a clone of itself.
        Specified by:
        getClone in interface DataRow
        Specified by:
        getClone in interface Row
        Parameters:
        owner - the new owner
        Returns:
        the clone
      • newCell

        public Cell newCell​(Row owner)
        Creates a new instance of a cell.
        Specified by:
        newCell in interface Row
        Parameters:
        owner - the owner
        Returns:
        the 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
      • hasCell

        public boolean hasCell​(int columnIndex)
        Returns whether the row alread contains the cell at the specified location.
        Specified by:
        hasCell in interface Row
        Parameters:
        columnIndex - the column index
        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
        Specified by:
        addCell in class AbstractRow
        Parameters:
        columnIndex - the index of the column to create
        Returns:
        the created cell or the already existing cell
      • 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
        Specified by:
        getCellKey in class AbstractRow
        Parameters:
        columnIndex - the index of the column
        Returns:
        the cell key, null if invalid index
      • cells

        public Collection<Cell> cells()
        Returns all cells.
        Specified by:
        cells in interface Row
        Returns:
        the cells (unsorted)
      • 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
        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.

        Assumes that this sheet's header has already been updated.
        Specified by:
        mergeWith in interface Mergeable<Row>
        Specified by:
        mergeWith in interface Row
        Parameters:
        other - the row to merge with
      • toString

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