public class Grid
extends java.lang.Object
Constructor and Description |
---|
Grid()
initialises an empty grid
|
Modifier and Type | Method and Description |
---|---|
void |
addCol(int colIdx)
adds columns up to colIdx
|
void |
addRow(int rowIdx)
adds a new row at the given index.
|
void |
applyCoordinates(int xUL,
int yUL,
boolean vertical)
applies specific x,y coordinates to the underlying objects (wrapped FlowObjects)
|
void |
calculatePositions(int xOffset,
int yOffset)
calculates x,y position for all grid-cells.
|
void |
calculateSizes()
calculates width,height for all grid-cells.
|
int |
getColCount()
returns the current number of columns.
|
int |
getColSize(int col) |
int |
getGridHeight()
gets the total height of this grid (sum of all rows)
|
int |
getGridWidth()
gets the total width of this grid (sum of all cols)
|
int |
getGridXOffset() |
int |
getGridYOffset() |
FlowObjectWrapper |
getObject(int row,
int col) |
int |
getRowCount() |
int |
getRowSize(int row) |
int |
getX(int col) |
int |
getY(int row) |
void |
interleave()
performs the interleaving (elimination of unnecessary rows)
|
void |
printToConsole() |
void |
setColSize(int col,
int value) |
void |
setObject(int rowIdx,
int colIdx,
FlowObjectWrapper obj)
places an Object at the given position and informs the object of
that position change.
|
void |
setRowSize(int row,
int value) |
public void addRow(int rowIdx)
rowIdx
- public int getColCount()
public void addCol(int colIdx)
colIdx
- public void setObject(int rowIdx, int colIdx, FlowObjectWrapper obj)
rowIdx
- colIdx
- obj
- public void calculateSizes()
public void calculatePositions(int xOffset, int yOffset)
public int getGridHeight()
public int getGridWidth()
public void applyCoordinates(int xUL, int yUL, boolean vertical)
vertical
- invert x and y coordinates relative to the center of the grid (e.g. for vertical Pools)public void interleave()
public FlowObjectWrapper getObject(int row, int col)
public int getRowCount()
public void printToConsole()
public int getGridXOffset()
public int getGridYOffset()
public int getColSize(int col)
public int getRowSize(int row)
public void setColSize(int col, int value)
public void setRowSize(int row, int value)
public int getX(int col)
public int getY(int row)