Class Grid<T>
java.lang.Object
au.com.centrumsystems.hudson.plugin.buildpipeline.Grid<T>
- Type Parameters:
T- The type of the data that gets placed in a two dimensional table.
- Direct Known Subclasses:
BuildGrid,ProjectGrid
Two-dimensional finite sparse placement of things (such as projects and builds) into a grid/matrix layout.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Tget(int row, int col) Obtains the project placed at the specific position.abstract intWidth of the grid.intgetNextAvailableRow(int currentRow, int currentColumn) Determines the next row of the grid that should be populated.abstract intgetRows()Height of the grid.booleanisEmpty()Tests if the layout is empty.
-
Constructor Details
-
Grid
public Grid()
-
-
Method Details
-
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
Obtains the project placed at the specific position.- Parameters:
row-0<=row<getRows()col-0<=col<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
ProjectFormat 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 aProjectFormwhen the layout is tree-like.- Parameters:
currentRow- - The current row of the grid being usedcurrentColumn- - The current column of the grid being used- Returns:
- - The row number to be used
-