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
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 Summary
Constructors Constructor Description Grid()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
get(int row, int col)
Obtains the project placed at the specific position.abstract int
getColumns()
Width of the grid.int
getNextAvailableRow(int currentRow, int currentColumn)
Determines the next row of the grid that should be populated.abstract int
getRows()
Height of the grid.boolean
isEmpty()
Tests if the layout is empty.
-
-
-
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<=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
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 aProjectForm
when 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
-
-