public class GraphicGraph extends AbstractElement implements Graph, StyleGroupListener
Warning: This class is NOT a general graph class, and it should NOT be used as it. This class is particularly dedicated to fast drawing of the graph and is internally arranged to be fast for this task only. It implements graph solely to be easily susceptible to be used as a sink and source for graph events. Some of the common methods of the Graph interface are not functional and will throw an exception if used (as documented in their respective JavaDoc).
The purpose of the graphic graph is to represent a graph with some often used graphic attributes (like position, label, etc.) stored as fields in the nodes and edges and most of the style stored in styles pertaining to a style sheet that tries to imitate the way CSS works. For example, the GraphicNode class defines a label, a position (x,y,z) and a style that is taken from the style sheet.
The style sheet is uploaded on the graph using an attribute correspondingly named "stylesheet" or "ui.stylesheet" (the second one is better). It can be a string that contains the whole style sheet, or an URL of the form :
url(name)
The graphic graph does not completely duplicate a graph, it only store things that are useful for drawing it. Although it implements "Graph", some methods are not implemented and will throw a runtime exception. These methods are mostly utility methods like write(), read(), and naturally display().
The graphic graph has the ability to store attributes like any other graph element, however the attributes stored by the graphic graph are restricted. There is a filter on the attribute adding methods that let pass only:
The implementation of this graph relies on the StyleGroupSet class and this is indeed its way to store its elements (grouped by style and Z level).
In addition to this, it provides, as all graphs do, the relational information for edges.
TODO : this graph cannot handle modification inside event listener methods !!
AbstractElement.AttributeChangeEvent| Modifier and Type | Field and Description |
|---|---|
boolean |
graphChanged
Set to true each time the graph was modified internally and a redraw is
needed.
|
double |
step
Memorize the step events.
|
StyleGroup |
style
The style of this graph.
|
| Constructor and Description |
|---|
GraphicGraph(java.lang.String id)
New empty graphic graph.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttributeSink(AttributeSink listener)
Add a sink for attribute events only.
|
Edge |
addEdge(java.lang.String id,
int index1,
int index2)
Like
Graph.addEdge(String, String, String) but the nodes are identified by
their indices. |
Edge |
addEdge(java.lang.String id,
int fromIndex,
int toIndex,
boolean directed)
Like
Graph.addEdge(String, String, String, boolean) but the nodes are
identified by their indices. |
Edge |
addEdge(java.lang.String id,
Node node1,
Node node2)
Like
Graph.addEdge(String, String, String) but the node references are
given instead of node identifiers. |
Edge |
addEdge(java.lang.String id,
Node from,
Node to,
boolean directed)
Like
Graph.addEdge(String, String, String, boolean) but the node
references are given instead of node identifiers. |
Edge |
addEdge(java.lang.String id,
java.lang.String from,
java.lang.String to,
boolean directed)
Like
Graph.addEdge(String, String, String), but this edge can be directed
between the two given nodes. |
void |
addElementSink(ElementSink listener)
Add a sink for elements events only.
|
Node |
addNode(java.lang.String id)
Add a node in the graph.
|
void |
addSink(Sink listener)
Add a sink for all graph events (attributes and graph elements) coming from
this source.
|
GraphicSprite |
addSprite(java.lang.String id) |
java.lang.Iterable<AttributeSink> |
attributeSinks()
Returns an "iterable" of
AttributeSink objects registered to this
graph. |
void |
clear()
Empty the graph completely by removing any references to nodes or edges.
|
void |
clearAttributeSinks()
Remove all listener attribute sinks.
|
void |
clearElementSinks()
Remove all listener element sinks.
|
void |
clearSinks()
Remove all listener sinks.
|
void |
computeBounds()
Compute the overall bounds of the graphic graph according to the nodes and
sprites positions.
|
Viewer |
display()
Utility method that creates a new graph viewer, and register the graph in it.
|
Viewer |
display(boolean autoLayout)
Utility method that creates a new graph viewer, and register the graph in it.
|
void |
edgeAdded(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String fromNodeId,
java.lang.String toNodeId,
boolean directed)
An edge was inserted in graph.
|
void |
edgeAttributeAdded(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String attribute,
java.lang.Object value)
A edge attribute was added.
|
void |
edgeAttributeChanged(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
A edge attribute was changed.
|
void |
edgeAttributeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String attribute)
A edge attribute was removed.
|
EdgeFactory<? extends Edge> |
edgeFactory()
The factory used to create edge instances.
|
void |
edgeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String edgeId)
An edge of graph was removed.The nodes the edge connects may already have
been removed from the graph.
|
java.util.stream.Stream<Edge> |
edges() |
java.lang.Iterable<ElementSink> |
elementSinks()
Returns an "iterable" of
ElementSink objects registered to this
graph. |
void |
elementStyleChanged(Element element,
StyleGroup oldStyle,
StyleGroup style)
The style of the element changed.
|
boolean |
feedbackXYZ()
Does the graphic graph publish via attribute changes the XYZ changes on nodes
and sprites when changed ?.
|
void |
feedbackXYZ(boolean on)
Should the graphic graph publish via attribute changes the XYZ changes on
nodes and sprites when changed ?.
|
Edge |
getEdge(int index)
Get an edge by its index.
|
Edge |
getEdge(java.lang.String id)
Get an edge by its identifier.
|
int |
getEdgeCount()
Number of edges in this graph.
|
Point3 |
getMaxPos()
The maximum position of a node or sprite.
|
Point3 |
getMinPos()
The minimum position of a node or sprite.
|
Node |
getNode(int index)
Get a node by its index.
|
Node |
getNode(java.lang.String id)
Get a node by its identifier.
|
int |
getNodeCount()
Number of nodes in this graph.
|
GraphicSprite |
getSprite(java.lang.String id) |
int |
getSpriteCount() |
double |
getStep()
The current step.
|
StyleGroup |
getStyle()
The graph style group.
|
StyleGroupSet |
getStyleGroups()
The complete set of style groups.
|
StyleSheet |
getStyleSheet()
The style sheet.
|
void |
graphAttributeAdded(java.lang.String sourceId,
long timeId,
java.lang.String attribute,
java.lang.Object value)
A graph attribute was added.
|
void |
graphAttributeChanged(java.lang.String sourceId,
long timeId,
java.lang.String attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
A graph attribute was changed.
|
void |
graphAttributeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String attribute)
A graph attribute was removed.
|
boolean |
graphChangedFlag()
True if the graph was edited or changed in any way since the last reset of
the "changed" flag.
|
void |
graphCleared(java.lang.String sourceId,
long timeId)
The whole graph was cleared.
|
boolean |
isAutoCreationEnabled()
Is the automatic creation of missing elements enabled?.
|
boolean |
isStrict()
Is strict checking enabled?
|
java.util.Iterator<Node> |
iterator() |
void |
nodeAdded(java.lang.String sourceId,
long timeId,
java.lang.String nodeId)
A node was inserted in the given graph.
|
void |
nodeAttributeAdded(java.lang.String sourceId,
long timeId,
java.lang.String nodeId,
java.lang.String attribute,
java.lang.Object value)
A node attribute was added.
|
void |
nodeAttributeChanged(java.lang.String sourceId,
long timeId,
java.lang.String nodeId,
java.lang.String attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
A node attribute was changed.
|
void |
nodeAttributeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String nodeId,
java.lang.String attribute)
A node attribute was removed.
|
NodeFactory<? extends Node> |
nodeFactory()
The factory used to create node instances.
|
void |
nodeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String nodeId)
A node was removed from the graph.
|
java.util.stream.Stream<Node> |
nodes() |
void |
printConnectivity()
Display the node/edge relations.
|
void |
read(FileSource input,
java.lang.String filename)
Utility method to read a graph using the given reader.
|
void |
read(java.lang.String filename)
Utility method to read a graph.
|
void |
removeAttributeSink(AttributeSink listener)
Remove an attribute sink.
|
Edge |
removeEdge(Edge edge)
Removes an edge.
|
Edge |
removeEdge(int index)
Removes an edge with a given index.
|
Edge |
removeEdge(int fromIndex,
int toIndex)
Removes an edge between two nodes.
|
Edge |
removeEdge(Node node1,
Node node2)
Removes an edge between two nodes.
|
Edge |
removeEdge(java.lang.String id)
Removes an edge knowing its identifier.
|
Edge |
removeEdge(java.lang.String from,
java.lang.String to)
Remove an edge given the identifiers of its two endpoints.
|
void |
removeElementSink(ElementSink listener)
Remove an element sink.
|
Node |
removeNode(int index)
Removes a node with a given index.
|
Node |
removeNode(Node node)
Removes a node.
|
Node |
removeNode(java.lang.String id)
Remove a node using its identifier.
|
void |
removeSink(Sink listener)
Remove a sink.
|
void |
removeSprite(java.lang.String id) |
void |
replay()
Replay all the elements of the graph and all attributes as new events to all
connected sinks.
|
void |
resetGraphChangedFlag()
Reset the "changed" flag.
|
void |
setAutoCreate(boolean on)
Enable or disable the automatic creation of missing elements.
|
void |
setEdgeFactory(EdgeFactory<? extends Edge> ef)
Set the edge factory used to create edges.
|
void |
setNodeFactory(NodeFactory<? extends Node> nf)
Set the node factory used to create nodes.
|
void |
setStrict(boolean on)
Enable or disable strict checking.
|
java.util.stream.Stream<GraphicSprite> |
sprites() |
void |
stepBegins(double step)
Since dynamic graphs are based on discrete event modifications, the notion of
step is defined to simulate elapsed time between events.
|
void |
stepBegins(java.lang.String sourceId,
long timeId,
double time)
Since dynamic graphs are based on discrete event modifications, the notion of
step is defined to simulate elapsed time between events.
|
void |
styleChanged(StyleGroup style) |
java.lang.String |
toString()
Override the Object method
|
void |
write(FileSink output,
java.lang.String filename)
Utility method to write a graph in the chosen format to a file.
|
void |
write(java.lang.String filename)
Utility method to write a graph in DGS format to a file.
|
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, setAttributeequals, getClass, hashCode, notify, notifyAll, wait, wait, waitattributeKeys, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, getLabel, getMap, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasLabel, hasMap, hasNumber, hasVector, removeAttribute, setAttribute, setAttributespublic StyleGroup style
public double step
public boolean graphChanged
public GraphicGraph(java.lang.String id)
A default style sheet is created, it then can be "cascaded" with other style sheets.
public boolean graphChangedFlag()
public void resetGraphChangedFlag()
graphChangedFlag()public StyleSheet getStyleSheet()
public StyleGroup getStyle()
public StyleGroupSet getStyleGroups()
public java.lang.String toString()
AbstractElementtoString in class AbstractElementpublic double getStep()
Graphpublic Point3 getMaxPos()
computeBounds() method is called.public Point3 getMinPos()
computeBounds() method is called.public boolean feedbackXYZ()
public void feedbackXYZ(boolean on)
public void computeBounds()
This operation will process each node and sprite and is therefore costly. However it does this computation again only when a node or sprite moved. Therefore it can be called several times, if nothing moved in the graph, the computation will not be redone.
getMaxPos(),
getMinPos()public Node getNode(java.lang.String id)
Graph
ExtendedNode node = graph.getNode("...");
the method will return an ExtendedNode node. If no left part exists, method will just return a Node.
public Edge getEdge(java.lang.String id)
Graph
ExtendedEdge edge = graph.getEdge("...");
the method will return an ExtendedEdge edge. If no left part exists, method will just return an Edge.
public GraphicSprite getSprite(java.lang.String id)
public void printConnectivity()
public void elementStyleChanged(Element element, StyleGroup oldStyle, StyleGroup style)
StyleGroupListenerelementStyleChanged in interface StyleGroupListenerelement - The element.oldStyle - The old style.style - The changed style or the new style of the element.public void styleChanged(StyleGroup style)
public java.util.stream.Stream<GraphicSprite> sprites()
public java.util.Iterator<Node> iterator()
iterator in interface java.lang.Iterable<Node>public void addSink(Sink listener)
Sourcepublic void removeSink(Sink listener)
SourceremoveSink in interface Sourcelistener - The sink to remove, if it does not exist, this is ignored
silently.public void addAttributeSink(AttributeSink listener)
SourceaddAttributeSink in interface Sourcelistener - The sink to register.public void removeAttributeSink(AttributeSink listener)
SourceremoveAttributeSink in interface Sourcelistener - The sink to remove, if it does not exist, this is ignored
silently.public void addElementSink(ElementSink listener)
SourceaddElementSink in interface Sourcelistener - The sink to register.public void removeElementSink(ElementSink listener)
SourceremoveElementSink in interface Sourcelistener - The sink to remove, if it does not exist, this is ignored
silently.public java.lang.Iterable<AttributeSink> attributeSinks()
GraphAttributeSink objects registered to this
graph.attributeSinks in interface GraphAttributeSink under the form of an iterable
object.public java.lang.Iterable<ElementSink> elementSinks()
GraphElementSink objects registered to this
graph.elementSinks in interface GraphElementSink under the form of an iterable object.public Edge addEdge(java.lang.String id, java.lang.String from, java.lang.String to, boolean directed) throws IdAlreadyInUseException, ElementNotFoundException
GraphGraph.addEdge(String, String, String), but this edge can be directed
between the two given nodes. If directed, the edge goes in the 'from' ->
'to' direction. An event is sent toward the listeners.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.from - The first node identifier.to - The second node identifier.directed - Is the edge directed?null (see the
detailed description in Graph.addEdge(String, String, String))IdAlreadyInUseException - If an edge with the same id already exists and strict checking is
enabled.ElementNotFoundException - If strict checking is enabled, and 'node1' or 'node2' are not
registered in the graph.Graph.addEdge(String, String, String)public Node addNode(java.lang.String id) throws IdAlreadyInUseException
Graph
This acts as a factory, creating the node instance automatically (and
eventually using the node factory provided). An event is generated toward the
listeners. If strict checking is enabled, and a node already exists with this
identifier, an IdAlreadyInUseException is
raised. Else the error is silently ignored and the already existing node is
returned.
This method is implicitly generic and returns something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.addNode("...");
the method will return an ExtendedNode. If no left part exists, method will just return a Node.
addNode in interface Graphid - Arbitrary and unique string identifying the node.IdAlreadyInUseException - If strict checking is enabled the identifier is already used.public void clear()
Graphclear in interface GraphSource.clearSinks()public Edge removeEdge(java.lang.String id) throws ElementNotFoundException
GraphElementNotFoundException is raised. Otherwise the error is silently
ignored and null is returned.
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.removeEdge("...");
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
removeEdge in interface Graphid - Identifier of the edge to remove.ElementNotFoundException - If no edge matches the identifier and strict checking is enabled.public Edge removeEdge(java.lang.String from, java.lang.String to) throws ElementNotFoundException
GraphIf the edge is directed it is removed only if its source and destination nodes are identified by 'from' and 'to' respectively. If the graph is a multi-graph and there are several edges between the two nodes, one of the edges at random is removed. An event is sent toward the listeners. If strict checking is enabled and at least one of the two given nodes does not exist or if they are not connected, a not found exception is raised. Else the error is silently ignored, and null is returned.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.removeEdge("...", "...");
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
removeEdge in interface Graphfrom - The origin node identifier to select the edge.to - The destination node identifier to select the edge.ElementNotFoundException - If the 'from' or 'to' node is not registered in the graph or not
connected and strict checking is enabled.public Node removeNode(java.lang.String id) throws ElementNotFoundException
GraphAn event is generated toward the listeners. Note that removing a node may remove all edges it is connected to. In this case corresponding events will also be generated toward the listeners.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.removeNode("...");
the method will return an ExtendedNode. If no left part exists, method will just return a Node.
removeNode in interface Graphid - The unique identifier of the node to remove.ElementNotFoundException - If no node matches the given identifier and strict checking is
enabled.public Viewer display()
Graphdisplay in interface GraphViewer,
Graph.display(boolean )public Viewer display(boolean autoLayout)
Graphdisplay in interface GraphautoLayout - If true a layout algorithm is launched in its own thread to
compute best node positions.Viewer,
Graph.display()public void stepBegins(double step)
GraphSince dynamic graphs are based on discrete event modifications, the notion of step is defined to simulate elapsed time between events. So a step is a event that occurs in the graph, it does not modify it but it gives a kind of timestamp that allows the tracking of the progress of the graph over the time.
This kind of event is useful for dynamic algorithms that listen to the dynamic graph and need to measure the time in the graph's evolution.
stepBegins in interface Graphstep - A numerical value that may give a timestamp to track the evolution
of the graph over the time.public EdgeFactory<? extends Edge> edgeFactory()
GraphedgeFactory in interface GraphGraph.setEdgeFactory(EdgeFactory),
Graph.nodeFactory()public int getEdgeCount()
StructuregetEdgeCount in interface Structurepublic int getNodeCount()
StructuregetNodeCount in interface Structurepublic int getSpriteCount()
public boolean isAutoCreationEnabled()
GraphisAutoCreationEnabled in interface Graphpublic NodeFactory<? extends Node> nodeFactory()
GraphnodeFactory in interface GraphGraph.setNodeFactory(NodeFactory),
Graph.edgeFactory()public void setAutoCreate(boolean on)
GraphsetAutoCreate in interface Graphon - True or false.Graph.isAutoCreationEnabled()public boolean isStrict()
Graphpublic void setStrict(boolean on)
GraphsetStrict in interface Graphon - True or false.Graph.isStrict()public void setEdgeFactory(EdgeFactory<? extends Edge> ef)
GraphsetEdgeFactory in interface Graphef - the new EdgeFactorypublic void setNodeFactory(NodeFactory<? extends Node> nf)
GraphsetNodeFactory in interface Graphnf - the new NodeFactorypublic void read(java.lang.String filename)
throws java.io.IOException
Graphpublic void read(FileSource input, java.lang.String filename) throws java.io.IOException
Graphpublic void write(FileSink output, java.lang.String filename) throws java.io.IOException
Graphpublic void write(java.lang.String filename)
throws java.io.IOException
Graphpublic void edgeAttributeAdded(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String attribute,
java.lang.Object value)
AttributeSinkedgeAttributeAdded in interface AttributeSinksourceId - Identifier of the graph where the change occurred.edgeId - Identifier of the edge whose attribute changed.attribute - The attribute name.value - The attribute new value.public void edgeAttributeChanged(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
AttributeSinkedgeAttributeChanged in interface AttributeSinksourceId - Identifier of the graph where the change occurred.edgeId - Identifier of the edge whose attribute changed.attribute - The attribute name.oldValue - The attribute old value.newValue - The attribute new value.public void edgeAttributeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String attribute)
AttributeSinkedgeAttributeRemoved in interface AttributeSinksourceId - Identifier of the graph where the attribute was removed.edgeId - Identifier of the edge whose attribute was removed.attribute - The removed attribute name.public void graphAttributeAdded(java.lang.String sourceId,
long timeId,
java.lang.String attribute,
java.lang.Object value)
AttributeSinkgraphAttributeAdded in interface AttributeSinksourceId - Identifier of the graph where the attribute changed.attribute - The attribute name.value - The attribute new value.public void graphAttributeChanged(java.lang.String sourceId,
long timeId,
java.lang.String attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
AttributeSinkgraphAttributeChanged in interface AttributeSinksourceId - Identifier of the graph where the attribute changed.attribute - The attribute name.oldValue - The attribute old value.newValue - The attribute new value.public void graphAttributeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String attribute)
AttributeSinkgraphAttributeRemoved in interface AttributeSinksourceId - Identifier of the graph where the attribute was removed.attribute - The removed attribute name.public void nodeAttributeAdded(java.lang.String sourceId,
long timeId,
java.lang.String nodeId,
java.lang.String attribute,
java.lang.Object value)
AttributeSinknodeAttributeAdded in interface AttributeSinksourceId - Identifier of the graph where the change occurred.nodeId - Identifier of the node whose attribute changed.attribute - The attribute name.value - The attribute new value.public void nodeAttributeChanged(java.lang.String sourceId,
long timeId,
java.lang.String nodeId,
java.lang.String attribute,
java.lang.Object oldValue,
java.lang.Object newValue)
AttributeSinknodeAttributeChanged in interface AttributeSinksourceId - Identifier of the graph where the change occurred.nodeId - Identifier of the node whose attribute changed.attribute - The attribute name.oldValue - The attribute old value.newValue - The attribute new value.public void nodeAttributeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String nodeId,
java.lang.String attribute)
AttributeSinknodeAttributeRemoved in interface AttributeSinksourceId - Identifier of the graph where the attribute was removed.nodeId - Identifier of the node whose attribute was removed.attribute - The removed attribute name.public void edgeAdded(java.lang.String sourceId,
long timeId,
java.lang.String edgeId,
java.lang.String fromNodeId,
java.lang.String toNodeId,
boolean directed)
ElementSinkedgeAdded in interface ElementSinksourceId - Identifier of the graph where the edge was added.edgeId - Identifier of the added edge.fromNodeId - Identifier of the first node of the edge.toNodeId - Identifier of the second node of the edge.directed - If true, the edge is directed.public void edgeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String edgeId)
ElementSinkedgeRemoved in interface ElementSinksourceId - The graph where the edge will be removed.edgeId - The edge that will be removed.public void graphCleared(java.lang.String sourceId,
long timeId)
ElementSinkgraphCleared in interface ElementSinksourceId - The graph cleared.public void nodeAdded(java.lang.String sourceId,
long timeId,
java.lang.String nodeId)
ElementSinknodeAdded in interface ElementSinksourceId - Identifier of the graph where the node was added.nodeId - Identifier of the added node.public void nodeRemoved(java.lang.String sourceId,
long timeId,
java.lang.String nodeId)
ElementSinknodeRemoved in interface ElementSinksourceId - Identifier of the graph where the node will be removed.nodeId - Identifier of the removed node.public void stepBegins(java.lang.String sourceId,
long timeId,
double time)
ElementSinkSince dynamic graphs are based on discrete event modifications, the notion of step is defined to simulate elapsed time between events. So a step is a event that occurs in the graph, it does not modify it but it gives a kind of timestamp that allow the tracking of the progress of the graph over the time.
This kind of event is useful for dynamic algorithms that listen to the dynamic graph and need to measure the time in the graph's evolution.
stepBegins in interface ElementSinksourceId - Identifier of the graph where the step starts.timeId - A numerical value that may give a timestamp to track the evolution
of the graph over the time.public GraphicSprite addSprite(java.lang.String id)
public void removeSprite(java.lang.String id)
public void clearAttributeSinks()
SourceclearAttributeSinks in interface Sourcepublic void clearElementSinks()
SourceclearElementSinks in interface Sourcepublic void clearSinks()
SourceclearSinks in interface Sourcepublic Edge addEdge(java.lang.String id, int index1, int index2)
GraphGraph.addEdge(String, String, String) but the nodes are identified by
their indices.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.index1 - The first node indexindex2 - The second node indexnullGraph.addEdge(String, String, String)public Edge addEdge(java.lang.String id, int fromIndex, int toIndex, boolean directed)
GraphGraph.addEdge(String, String, String, boolean) but the nodes are
identified by their indices.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.fromIndex - The second node indextoIndex - The first node indexdirected - Is the edge directed?nullGraph.addEdge(String, String, String)public Edge addEdge(java.lang.String id, Node node1, Node node2)
GraphGraph.addEdge(String, String, String) but the node references are
given instead of node identifiers.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.node1 - The first nodenode2 - The second nodenullGraph.addEdge(String, String, String)public Edge addEdge(java.lang.String id, Node from, Node to, boolean directed)
GraphGraph.addEdge(String, String, String, boolean) but the node
references are given instead of node identifiers.addEdge in interface Graphid - Unique and arbitrary string identifying the edge.from - The first nodeto - The second nodedirected - Is the edge directed?nullGraph.addEdge(String, String, String)public Edge getEdge(int index) throws java.lang.IndexOutOfBoundsException
Graph
ExtendedEdge edge = graph.getEdge(index);
the method will return an ExtendedEdge edge. If no left part exists, method will just return an Edge.
public Node getNode(int index) throws java.lang.IndexOutOfBoundsException
Graph
ExtendedNode node = graph.getNode(index);
the method will return an ExtendedNode node. If no left part exists, method will just return a Node.
public Edge removeEdge(int index)
Graph
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge edge = graph.removeEdge(i);
the method will return an ExtendedEdge edge. If no left part exists, method will just return an Edge.
removeEdge in interface Graphindex - The index of the edge to be removed.public Edge removeEdge(int fromIndex, int toIndex)
GraphGraph.removeEdge(String, String)
but the nodes are identified by their indices.removeEdge in interface GraphfromIndex - the index of the source nodetoIndex - the index of the target nodenull if no edge is removedGraph.removeEdge(String, String)public Edge removeEdge(Node node1, Node node2)
GraphGraph.removeEdge(String, String)
but node references are given instead of node identifiers.removeEdge in interface Graphnode1 - the first nodenode2 - the second nodenull if no edge is removedGraph.removeEdge(String, String)public Edge removeEdge(Edge edge)
GraphThis method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = graph.removeEdge(...);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
removeEdge in interface Graphedge - The edge to be removedpublic Node removeNode(int index)
GraphAn event is generated toward the listeners. Note that removing a node may remove all edges it is connected to. In this case corresponding events will also be generated toward the listeners.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.removeNode(index);
the method will return an ExtendedNode. If no left part exists, method will just return a Node.
removeNode in interface Graphindex - The index of the node to be removedpublic Node removeNode(Node node)
GraphAn event is generated toward the listeners. Note that removing a node may remove all edges it is connected to. In this case corresponding events will also be generated toward the listeners.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = graph.removeNode(...);
the method will return an ExtendedNode. If no left part exists, method will just return a Node.
removeNode in interface Graphnode - The node to be removedpublic void replay()
Be very careful with this method, it introduces new events in the event stream and some sinks may therefore receive them twice !! Graph replay is always dangerous !