Class Grid<T>

  • Type Parameters:
    T - The type of the data that gets placed in a two dimensional table.
    Direct Known Subclasses:
    BuildGrid, ProjectGrid

    public abstract class Grid<T>
    extends Object
    Two-dimensional finite sparse placement of things (such as projects and builds) into a grid/matrix layout.
    Author:
    Kohsuke Kawaguchi
    • Constructor Detail

      • Grid

        public Grid()
    • Method Detail

      • getRows

        public abstract int getRows()
        Height of the grid. Total number of rows.
        Returns:
        positive integer
      • getColumns

        public abstract int getColumns()
        Width of the grid. Total number of columns.
        Returns:
        positive integer
      • get

        public abstract T get​(int row,
                              int col)
        Obtains the project placed at the specific position.
        Parameters:
        row - 0&lt;=row&lt;getRows()
        col - 0&lt;=col&lt;getColumns()
        Returns:
        null if there's nothing placed in that position.
      • isEmpty

        public boolean isEmpty()
        Tests if the layout is empty.
        Returns:
        true if this grid contains no ProjectForm at all.
      • getNextAvailableRow

        public int getNextAvailableRow​(int currentRow,
                                       int currentColumn)
        Determines the next row of the grid that should be populated. Given (currentRow,currentColumn), find a row R>=currentRow such that the row R contains no project to any column to the right of current column. That is, find the row in which we can place a sibling of the project placed in (currentRow,currentColumn). This method is useful for determining the position to insert a ProjectForm when the layout is tree-like.
        Parameters:
        currentRow - - The current row of the grid being used
        currentColumn - - The current column of the grid being used
        Returns:
        - The row number to be used