Class RowIdentifier

  • All Implemented Interfaces:
    Serializable

    public class RowIdentifier
    extends Object
    implements Serializable
    Uses a range of columns to identify rows.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • RowIdentifier

        public RowIdentifier​(Range keys)
        Initializes the row identifier with the specified range of columns.
        Parameters:
        keys - the columns to use as key columns
    • Method Detail

      • generateKey

        protected String generateKey​(SpreadSheet sheet,
                                     int index,
                                     int[] indices)
        Generates a key for the specified row.
        Parameters:
        sheet - the spreadsheet to work on
        index - the index of the row to generate the key for
        indices - the column indices to use
        Returns:
        the generated key
      • identify

        public void identify​(SpreadSheet sheet)
        Configures the identifier with the specified sheet.
        Parameters:
        sheet - the sheet to use as basis
      • getColumns

        public Range getColumns()
        Returns the columns used as keys.
        Returns:
        the range
      • size

        public int size()
        Returns the number of generated keys.
        Returns:
        the number of keys
      • getKeys

        public List<String> getKeys()
        Returns the generated keys.
        Returns:
        the keys
      • getKey

        public String getKey​(int keyIndex)
        Returns the key at the specified location.
        Parameters:
        keyIndex - the position of the key
        Returns:
        the key
      • getRows

        public List<Integer> getRows​(int keyIndex)
        Returns the list of row indices.
        Returns:
        the associated list of rows, null if not available
      • getRows

        public List<Integer> getRows​(String key)
        Returns the list of row indices associated with the specified key.
        Returns:
        the associated list of rows, null if not available
      • toString

        public String toString()
        Returns a short description of the object.
        Overrides:
        toString in class Object
        Returns:
        the description