public class IncompleteGridGenerator extends BaseGenerator
SourceBase.ElementType
Modifier and Type | Field and Description |
---|---|
protected boolean |
cross
Connect nodes diagonally.
|
protected int |
currentHeight
Current height of the grid.
|
protected int |
currentWidth
Current width of the grid.
|
protected int |
holeMaxSize
Max size of holes.
|
protected float |
holeProbability
Probability of hole creation.
|
protected int |
holesPerStep
Number of attempt to create a hole by step.
|
protected HashSet<String> |
unbreakable
Id of nodes that were connected to a deleted node.
|
addEdgeLabels, addNodeLabels, directed, edgeAttributeRange, edgeAttributes, internalGraph, nodeAttributeRange, nodeAttributes, random, randomlyDirected
attrSinks, eltsSinks, eventProcessing, eventQueue, sourceId, sourceTime
Constructor and Description |
---|
IncompleteGridGenerator()
New generator.
|
IncompleteGridGenerator(boolean cross,
float holeProbability,
int holeMaxSize,
int holesPerStep)
New generator.
|
Modifier and Type | Method and Description |
---|---|
void |
begin()
Begin the graph generation.
|
protected void |
connectNode(int x,
int y)
Connect a node.
|
protected void |
disconnectNode(int x,
int y)
Disconnect a node.
|
void |
end()
End the graph generation by finalizing it.
|
protected String |
getEdgeId(String n1,
String n2) |
protected String |
getNodeId(int x,
int y) |
boolean |
nextEvents()
Grow the graph.
|
addEdge, addEdgeAttribute, addEdgeLabels, addNode, addNode, addNodeAttribute, addNodeLabels, clearKeptData, delEdge, delNode, isUsingInternalGraph, removeEdgeAttribute, removeNodeAttribute, setDirectedEdges, setEdgeAttributesRange, setNodeAttributesRange, setRandomSeed, setUseInternalGraph
addAttributeSink, addElementSink, addSink, attributeSinks, clearAttributeSinks, clearElementSinks, clearSinks, elementSinks, manageEvents, removeAttributeSink, removeElementSink, removeSink, sendAttributeChangedEvent, sendAttributeChangedEvent, sendEdgeAdded, sendEdgeAdded, sendEdgeAttributeAdded, sendEdgeAttributeAdded, sendEdgeAttributeChanged, sendEdgeAttributeChanged, sendEdgeAttributeRemoved, sendEdgeAttributeRemoved, sendEdgeRemoved, sendEdgeRemoved, sendGraphAttributeAdded, sendGraphAttributeAdded, sendGraphAttributeChanged, sendGraphAttributeChanged, sendGraphAttributeRemoved, sendGraphAttributeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, sendNodeAttributeAdded, sendNodeAttributeAdded, sendNodeAttributeChanged, sendNodeAttributeChanged, sendNodeAttributeRemoved, sendNodeAttributeRemoved, sendNodeRemoved, sendNodeRemoved, sendStepBegins, sendStepBegins
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttributeSink, addElementSink, addSink, clearAttributeSinks, clearElementSinks, clearSinks, removeAttributeSink, removeElementSink, removeSink
protected int currentWidth
protected int currentHeight
protected float holeProbability
protected int holeMaxSize
protected int holesPerStep
protected boolean cross
protected HashSet<String> unbreakable
public IncompleteGridGenerator()
public IncompleteGridGenerator(boolean cross, float holeProbability, int holeMaxSize, int holesPerStep)
cross
- connect nodes diagonallyholeProbability
- probability of an hole in the gridholeMaxSize
- max size of holesholesPerStep
- number of attempt to create a hole by stepprotected void connectNode(int x, int y)
x
- abscissa of the node to disconnecty
- ordina of the node to disconnectprotected void disconnectNode(int x, int y)
x
- abscissa of the node to disconnecty
- ordina of the node to disconnectpublic void begin()
Generator
Generator.nextEvents()
method to add elements to the graph.public boolean nextEvents()
Generator.nextEvents()
public void end()
BaseGenerator
Generator.nextEvents()
method returned false (or even if you stop before), this method must be
called to finish the graph.
In addition, BaseGenerator adds a "clear" operations that removes all the
kept edges and nodes identifiers and the associated data.end
in interface Generator
end
in class BaseGenerator
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses