public class RingGenerator extends AbstractGenerator
The RingGenerator
is a TopologyGenerator
used to create a ring.
The size of the generated ring is defined by its width (setWidth(double)
) and
height (setHeight(double)
).
absoluteCoords, dimensionsMap, directed, FIRST_DIMENSION_INDEX, nbNodesMap, nodeClass, SECOND_DIMENSION_INDEX, wired, wirelessEnabled, x, y
Constructor and Description |
---|
RingGenerator(int nbNodes)
Creates a
RingGenerator creating a ring of nbNodes Node s. |
Modifier and Type | Method and Description |
---|---|
protected void |
addLinks(Topology tp,
int nbNodes,
Node[] nodes) |
void |
generate(Topology topology)
Modifies the provided
Topology according to the implementation. |
protected Node[] |
generateNodes(Topology tp,
int nbNodes) |
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 RingGenerator(int nbNodes)
RingGenerator
creating a ring of nbNodes Node
s.nbNodes
- the number of Node
s to be added.public void generate(Topology topology)
TopologyGenerator
Topology
according to the implementation.topology
- the Topology
to be modified by the generationprotected Node[] generateNodes(Topology tp, int nbNodes) 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