public class GridGenerator extends AbstractGenerator
absoluteCoords, dimensionsMap, directed, FIRST_DIMENSION_INDEX, nbNodesMap, nodeClass, SECOND_DIMENSION_INDEX, wired, wirelessEnabled, x, y
Constructor and Description |
---|
GridGenerator(int nbRows,
int nbColumns)
Creates a
GridGenerator creating a grid with nbRows rows and nbColumns columns. |
Modifier and Type | Method and Description |
---|---|
protected void |
addLinks(Topology tp,
int nbRows,
int nbColumns,
Node[][] nodes) |
void |
generate(Topology topology)
Modifies the provided
Topology according to the implementation. |
protected Node[][] |
generateGrid(Topology tp) |
double |
getHeight()
Gets the height of the generated pattern (2 dimensions).
|
double |
getWidth()
Gets the width of the generated pattern (2 dimensions).
|
AbstractGenerator |
setHeight(double height)
Sets the height of the generated pattern (2 dimensions).
|
AbstractGenerator |
setWidth(double width)
Sets the width of the generated pattern (2 dimensions).
|
addNodeAtLocation, getAbsoluteHeight, getAbsoluteWidth, getAbsoluteX, getAbsoluteY, getDimension, getNbNodes, getNbNodes, getNodeClass, getSize, getX, getY, isAbsoluteCoords, isDirected, isWired, isWirelessEnabled, setAbsoluteCoords, setDefaultWidthHeight, setDimension, setDirected, setNbNodes, setNbNodes, setNodeClass, setSize, setWired, setWirelessEnabled, setX, setY
public GridGenerator(int nbRows, int nbColumns)
GridGenerator
creating a grid with nbRows rows and nbColumns columns.nbRows
- the amount of desired rows.nbColumns
- the amount of desired columns.public void generate(Topology topology)
TopologyGenerator
Topology
according to the implementation.topology
- the Topology
to be modified by the generationprotected Node[][] generateGrid(Topology tp) throws ReflectiveOperationException
ReflectiveOperationException
public AbstractGenerator setWidth(double width)
AbstractGenerator
setWidth
in class AbstractGenerator
width
- the desired width, as a double.public AbstractGenerator setHeight(double height)
AbstractGenerator
setHeight
in class AbstractGenerator
height
- the desired height, as a double.public double getWidth()
AbstractGenerator
getWidth
in class AbstractGenerator
public double getHeight()
AbstractGenerator
getHeight
in class AbstractGenerator