public class LineGenerator extends AbstractGenerator
LineGenerator
is a TopologyGenerator
used to create horizontal or vertical lines.absoluteCoords, dimensionsMap, directed, FIRST_DIMENSION_INDEX, nbNodesMap, nodeClass, SECOND_DIMENSION_INDEX, wired, wirelessEnabled, x, y
Constructor and Description |
---|
LineGenerator(int nbNodes,
int size)
Creates a
LineGenerator creating an horizontal line of size size with nbNodes Node s. |
LineGenerator(int nbNodes,
int size,
boolean horizontal)
Creates a
LineGenerator creating a line of size size with nbNodes Node s. |
Modifier and Type | Method and Description |
---|---|
void |
generate(Topology topology)
Modifies the provided
Topology according to the implementation. |
int |
getNbNodes()
Gets the number of
Node s which should be created (1-dimension). |
double |
getSize()
Gets the one-dimension size of the generated pattern.
|
boolean |
isHorizontal()
Returns
true if the line should be horizontal, false otherwise. |
LineGenerator |
setHorizontal(boolean horizontal)
Sets the orientation state of the line.
|
LineGenerator |
setNbNodes(Object dimensionIndex,
int nbNodes)
Sets the number of
Node s which should be created in an arbitrary dimension. |
LineGenerator |
setSize(double size)
Sets the one-direction size of the generated pattern.
|
addNodeAtLocation, getAbsoluteHeight, getAbsoluteWidth, getAbsoluteX, getAbsoluteY, getDimension, getHeight, getNbNodes, getNodeClass, getWidth, getX, getY, isAbsoluteCoords, isDirected, isWired, isWirelessEnabled, setAbsoluteCoords, setDefaultWidthHeight, setDimension, setDirected, setHeight, setNbNodes, setNodeClass, setWidth, setWired, setWirelessEnabled, setX, setY
public LineGenerator(int nbNodes, int size)
LineGenerator
creating an horizontal line of size size with nbNodes Node
s.nbNodes
- the number of Node
s to be added.size
- the size of the linepublic LineGenerator(int nbNodes, int size, boolean horizontal)
LineGenerator
creating a line of size size with nbNodes Node
s.
The line orientation depends on the horizontal parameter.nbNodes
- the number of Node
s to be added.size
- the size of the linehorizontal
- true
if the line should be horizontal, false
if it should be vertical.public void generate(Topology topology)
TopologyGenerator
Topology
according to the implementation.topology
- the Topology
to be modified by the generationpublic LineGenerator setHorizontal(boolean horizontal)
horizontal
- true
if the line should be horizontal, false
otherwise.public boolean isHorizontal()
true
if the line should be horizontal, false
otherwise.true
if the line should be horizontal, false
otherwise.public double getSize()
AbstractGenerator
getSize
in class AbstractGenerator
public LineGenerator setSize(double size)
AbstractGenerator
setSize
in class AbstractGenerator
size
- the double representing of the generated pattern, as a double.public LineGenerator setNbNodes(Object dimensionIndex, int nbNodes)
AbstractGenerator
Node
s which should be created in an arbitrary dimension.setNbNodes
in class AbstractGenerator
dimensionIndex
- the dimension index; can be any type of object.nbNodes
- the number of Node
to be created.public int getNbNodes()
AbstractGenerator
Node
s which should be created (1-dimension).getNbNodes
in class AbstractGenerator
Node
to be created.