Class Matrix<T>
- java.lang.Object
-
- com.axis.system.jenkins.plugins.downstream.tree.Matrix<T>
-
- Type Parameters:
T
- Data type of Entry payload.
public class Matrix<T> extends Object
An expandable and variable width matrix backed by ArrayLists.Every cell in the Matrix is backed by an Entry<T>.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Matrix.Arrow
static class
Matrix.Entry<T>
-
Constructor Summary
Constructors Constructor Description Matrix()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<List<Matrix.Entry<T>>>
get()
Returns the datastore.List<Matrix.Entry<T>>
get(int rowPos)
Returns the specified row.Matrix.Entry<T>
get(int rowPos, int colPos)
Fetches an Entry at the specified row and column position.Set<T>
getCellDataAsSet()
Fetches all cell data and returns as Setint
getMaxRowWidth()
long
getNumberOfCells()
boolean
isEmpty()
void
put(int rowPos, int colPos, Matrix.Entry<T> value)
Puts an Entry at the specified row and column position.
-
-
-
Method Detail
-
get
public List<List<Matrix.Entry<T>>> get()
Returns the datastore. I.e. a List (rows) of Lists (columns) of entries.- Returns:
- the complete matrix.
-
get
public List<Matrix.Entry<T>> get(int rowPos)
Returns the specified row.- Parameters:
rowPos
- row index.- Returns:
- a row (List of entries in each column).
-
get
public Matrix.Entry<T> get(int rowPos, int colPos)
Fetches an Entry at the specified row and column position.- Parameters:
rowPos
- row indexcolPos
- column index- Returns:
- Entry
-
getMaxRowWidth
public int getMaxRowWidth()
- Returns:
- the number of items in the row with largest size
-
isEmpty
public boolean isEmpty()
- Returns:
- if matrix is empty
-
getCellDataAsSet
public Set<T> getCellDataAsSet()
Fetches all cell data and returns as Set- Returns:
- Set of all cell data in the built Matrix. No null included in Set.
-
getNumberOfCells
public long getNumberOfCells()
- Returns:
- the total number of cell in the matrix including null cells
-
put
public void put(int rowPos, int colPos, @Nullable Matrix.Entry<T> value)
Puts an Entry at the specified row and column position.Rows and columns will expand to match the specified coordinates. Empty cells will be filled with nulls.
- Parameters:
rowPos
- row indexcolPos
- col indexvalue
- Entry to store
-
-