public abstract class AbstractGenerator extends Object implements TopologyGenerator
AbstractGenerator
holds common fields and methods for the different implementations of the
TopologyGenerator
interface.Modifier and Type | Field and Description |
---|---|
protected boolean |
absoluteCoords |
protected Map<Object,Double> |
dimensionsMap |
protected boolean |
directed |
protected static int |
FIRST_DIMENSION_INDEX |
protected Map<Object,Integer> |
nbNodesMap |
protected Class<? extends Node> |
nodeClass |
protected static int |
SECOND_DIMENSION_INDEX |
protected boolean |
wired |
protected boolean |
wirelessEnabled |
protected double |
x |
protected double |
y |
Constructor and Description |
---|
AbstractGenerator() |
Modifier and Type | Method and Description |
---|---|
protected Node |
addNodeAtLocation(Topology tp,
double x0,
double y0,
double cr) |
protected double |
getAbsoluteHeight(Topology tp)
Gets the absolute height of the generated pattern (2 dimensions).
|
protected double |
getAbsoluteWidth(Topology tp)
Gets the absolute width of the generated pattern (2 dimensions).
|
double |
getAbsoluteX(Topology tp)
Returns the absolute X coordinate, depending on
getX() and isAbsoluteCoords() . |
double |
getAbsoluteY(Topology tp)
Returns the absolute Y coordinate, depending on
getY() and isAbsoluteCoords() . |
protected double |
getDimension(Object dimensionIndex)
Gets the size of the generated pattern for the provided dimension.
|
protected double |
getHeight()
Gets the height of the generated pattern (2 dimensions).
|
protected int |
getNbNodes()
Gets the number of
Node s which should be created (1-dimension). |
protected int |
getNbNodes(Object dimensionIndex)
Gets the number of
Node s which should be created in an arbitrary dimension. |
Class<? extends Node> |
getNodeClass()
|
protected double |
getSize()
Gets the one-dimension size of the generated pattern.
|
protected double |
getWidth()
Gets the width of the generated pattern (2 dimensions).
|
double |
getX()
Gets the X coordinate.
|
double |
getY()
Gets the Y coordinate.
|
boolean |
isAbsoluteCoords()
Returns the absolute coordinates state.
|
boolean |
isDirected()
Returns
true if the graph should be directed; false otherwise. |
boolean |
isWired()
Returns
true if the links should be wired; false otherwise. |
boolean |
isWirelessEnabled()
Returns
true if the wireless links should be enabled; false otherwise. |
AbstractGenerator |
setAbsoluteCoords(boolean absoluteCoords)
Sets the absolute coordinates state.
|
protected void |
setDefaultWidthHeight() |
protected AbstractGenerator |
setDimension(Object dimensionIndex,
double value)
Sets the size of the generated pattern for an arbitrary dimension.
|
AbstractGenerator |
setDirected(boolean directed)
Sets the graph direction state.
|
protected AbstractGenerator |
setHeight(double height)
Sets the height of the generated pattern (2 dimensions).
|
protected AbstractGenerator |
setNbNodes(int nbNodes)
Sets the number of
Node s which should be created (1-dimension). |
protected AbstractGenerator |
setNbNodes(Object dimensionIndex,
int nbNodes)
Sets the number of
Node s which should be created in an arbitrary dimension. |
AbstractGenerator |
setNodeClass(Class<? extends Node> nodeClass)
|
protected AbstractGenerator |
setSize(double size)
Sets the one-direction size of the generated pattern.
|
protected AbstractGenerator |
setWidth(double width)
Sets the width of the generated pattern (2 dimensions).
|
AbstractGenerator |
setWired(boolean wired)
Sets the links' wiring state.
|
AbstractGenerator |
setWirelessEnabled(boolean wirelessEnabled)
Sets the links' wireless state.
|
AbstractGenerator |
setX(double x)
Sets the X coordinate.
|
AbstractGenerator |
setY(double y)
Sets the Y coordinate.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generate
protected static final int FIRST_DIMENSION_INDEX
protected static final int SECOND_DIMENSION_INDEX
protected boolean directed
protected boolean wired
protected boolean wirelessEnabled
protected double x
protected double y
protected boolean absoluteCoords
public boolean isAbsoluteCoords()
true
if the provided coordinates are meant to be absolutefalse
if the provided coordinates are meant to be in [0:1]public AbstractGenerator setAbsoluteCoords(boolean absoluteCoords)
true
if the provided coordinates are meant to be absolutefalse
if the provided coordinates are meant to be in [0:1]absoluteCoords
- the new absolute coordinates state.public boolean isDirected()
true
if the graph should be directed; false
otherwise.true
if the graph should be directed; false
otherwise.public AbstractGenerator setDirected(boolean directed)
directed
- true
if the graph should be directed; false
otherwise.public boolean isWired()
true
if the links should be wired; false
otherwise.true
if the links should be wired; false
otherwise.public AbstractGenerator setWired(boolean wired)
wired
- true
if the links should be wired; false
otherwise.public boolean isWirelessEnabled()
true
if the wireless links should be enabled; false
otherwise.true
if the wireless links should be enabled; false
otherwise.public AbstractGenerator setWirelessEnabled(boolean wirelessEnabled)
wirelessEnabled
- true
if the wireless links should be enabled; false
otherwise.public double getX()
public AbstractGenerator setX(double x)
x
- the X coordinate, as a double.public double getAbsoluteX(Topology tp)
getX()
and isAbsoluteCoords()
.tp
- the related Topology
objectpublic double getY()
public AbstractGenerator setY(double y)
y
- the Y coordinate, as a double.public double getAbsoluteY(Topology tp)
getY()
and isAbsoluteCoords()
.tp
- the related Topology
objectprotected AbstractGenerator setDimension(Object dimensionIndex, double value)
dimensionIndex
- the dimension index; can be any type of object.value
- the value of the provided dimension.protected double getDimension(Object dimensionIndex)
dimensionIndex
- the dimension index; can be any type of object.protected double getWidth()
protected AbstractGenerator setWidth(double width)
width
- the desired width, as a double.protected double getAbsoluteWidth(Topology tp)
tp
- the related Topology
objectprotected double getHeight()
protected AbstractGenerator setHeight(double height)
height
- the desired height, as a double.protected double getAbsoluteHeight(Topology tp)
tp
- the related Topology
objectprotected void setDefaultWidthHeight()
protected double getSize()
protected AbstractGenerator setSize(double size)
size
- the double representing of the generated pattern, as a double.public AbstractGenerator setNodeClass(Class<? extends Node> nodeClass)
nodeClass
- the instantiated Node
type.protected AbstractGenerator setNbNodes(Object dimensionIndex, int nbNodes)
Node
s which should be created in an arbitrary dimension.dimensionIndex
- the dimension index; can be any type of object.nbNodes
- the number of Node
to be created.protected int getNbNodes(Object dimensionIndex)
Node
s which should be created in an arbitrary dimension.dimensionIndex
- the dimension index; can be any type of object.Node
to be created.protected int getNbNodes()
Node
s which should be created (1-dimension).Node
to be created.protected AbstractGenerator setNbNodes(int nbNodes)
Node
s which should be created (1-dimension).nbNodes
- the number of Node
to be created.protected Node addNodeAtLocation(Topology tp, double x0, double y0, double cr) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException