Interface DataTable

  • All Superinterfaces:
    DataEntry

    public interface DataTable
    extends DataEntry
    A DataTable is an entry in a DataFolder that contains rows of objects that are java primitives (String, Double, Boolean, Integer,Null). A DataTable does not have any structural or type rules. Rows do not have to have uniform size and columns do not have to be the same data type. The DataTable provides methods for row wise scanning of columns for sets of rows that contain the same column value. DataTable row indexes are 0 based with the last element index=size()-1.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Class<DataTable> TYPE  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(java.lang.Object... data)
      Add an array of values and increment the size of the table.
      DataRow get​(int index)
      Access the row at the given index (0 based).
      void put​(int row, java.lang.Object... data)
      Add an array of values and increment the size of the table.
      DataRow[] rows()
      Return the array of all rows in data entry order.
      DataRow[] rows​(int from)
      Return the array of rows after and including the provided row index.
      DataRow[] scan​(int column, java.lang.Object key)
      Scan the indicated column index and return the rows that match the key value.
      int size()
      The size of this table.
    • Field Detail

      • TYPE

        static final java.lang.Class<DataTable> TYPE
    • Method Detail

      • scan

        DataRow[] scan​(int column,
                       java.lang.Object key)
        Scan the indicated column index and return the rows that match the key value. Uses the java equality method [row,column].equals(key)
        Parameters:
        column - The column to scan, row wise.
        key - The key to use.
        Returns:
        The array of matched rows, or an empty array of length 0.
      • add

        void add​(java.lang.Object... data)
        Add an array of values and increment the size of the table. This method will accept data with no checks. It's up to the user to know what they put in and what DataRow
        Parameters:
        row - The row of objects
      • put

        void put​(int row,
                 java.lang.Object... data)
        Add an array of values and increment the size of the table. This method will accept data with no checks. It's up to the user to know what they put in and what DataRow
        Parameters:
        row - The row of objects
      • get

        DataRow get​(int index)
        Access the row at the given index (0 based).
        Parameters:
        index -
        Returns:
        The row or null if the index is out of bounds.
      • size

        int size()
        The size of this table.
        Returns:
        The number of rows in this table.
      • rows

        DataRow[] rows()
        Return the array of all rows in data entry order.
        Returns:
        The rows.
      • rows

        DataRow[] rows​(int from)
        Return the array of rows after and including the provided row index. This is useful for ignoring header rows loaded from CSV files. Eg. rows(1) will return all rows from index 1, and ignore row 0.
        Parameters:
        from - the from row
        Returns:
        The rows.