Class GraphicNode
public class GraphicNode extends GraphicElement implements Node
A graphic node defines a position (x,y,z), a string label, and a style from the style sheet.
- See Also:
GraphicGraph
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.ui.graphicGraph.GraphicElement
GraphicElement.SwingElementRendererNested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
AbstractElement.AttributeChangeEvent -
Field Summary
Fields Modifier and Type Field Description booleanpositionneddoublexThe position of the node.doubleyThe position of the node.doublezThe position of the node.Fields inherited from class org.graphstream.ui.graphicGraph.GraphicElement
component, hidden, label, style -
Constructor Summary
Constructors Constructor Description GraphicNode(GraphicGraph graph, String id, HashMap<String,Object> attributes)New graphic node. -
Method Summary
Modifier and Type Method Description Stream<Edge>edges()Stream over all entering and leaving edges.Iterator<Node>getBreadthFirstIterator()Not implemented.Iterator<Node>getBreadthFirstIterator(boolean directed)Not implemented.intgetDegree()Total number of relations with other nodes or this node.Iterator<Node>getDepthFirstIterator()Not implemented.Iterator<Node>getDepthFirstIterator(boolean directed)Not implemented.EdgegetEdge(int i)I-th edge.EdgegetEdgeBetween(int index)Retrieves an edge between this node and the node with index i if one exists.EdgegetEdgeBetween(String id)Retrieve an edge between this node and the node 'id', if it exits.EdgegetEdgeBetween(Node Node)Retrieves an edge between this node and and another node if one exists.EdgegetEdgeFrom(int index)Retrieves an edge that leaves node with given index toward this node.EdgegetEdgeFrom(String id)Retrieve an edge that leaves node 'id' toward this node.EdgegetEdgeFrom(Node Node)Retrieves an edge that leaves given node toward this node.EdgegetEdgeToward(int index)Retrieves an edge that leaves this node toward the node with given index.EdgegetEdgeToward(String id)Retrieve an edge that leaves this node toward 'id'.EdgegetEdgeToward(Node Node)Retrieves an edge that leaves this node toward another node.EdgegetEnteringEdge(int i)I-th entering edge.GraphgetGraph()Parent graph.StringgetGraphName()StringgetHost()intgetInDegree()Number of entering edges.EdgegetLeavingEdge(int i)I-th leaving edge.intgetOutDegree()Number of leaving edges.Selector.TypegetSelectorType()Type of selector for the graphic element (Node, Edge, Sprite ?).doublegetX()Abscissa of the element, always in GU (graph units).doublegetY()Ordinate of the element, always in GU (graph units).doublegetZ()Depth of the element, always in GU (graph units).booleanhasEdgeBetween(String id)True if an edge exists between this node and node 'id'.booleanhasEdgeFrom(String id)True if an edge enters this node from node 'id'.booleanhasEdgeToward(String id)True if an edge leaves this node toward node 'id'.booleanisDistributed()Iterator<Edge>iterator()voidmove(double x, double y, double z)Try to force the element to move at the give location in graph units (GU).voidsetGraph(Graph graph)voidsetGraphName(String newHost)voidsetHost(String newHost)Methods inherited from class org.graphstream.ui.graphicGraph.GraphicElement
getComponent, getLabel, getStyle, myGraph, setAttribute, setComponentMethods inherited from class org.graphstream.graph.implementations.AbstractElement
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graphstream.graph.Element
attributeKeys, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, getLabel, getMap, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasLabel, hasMap, hasNumber, hasVector, removeAttribute, setAttribute, setAttributesMethods inherited from interface org.graphstream.graph.Node
enteringEdges, hasEdgeBetween, hasEdgeBetween, hasEdgeFrom, hasEdgeFrom, hasEdgeToward, hasEdgeToward, leavingEdges, neighborNodes, toString
-
Field Details
-
x
public double xThe position of the node. In graph units. -
y
public double yThe position of the node. In graph units. -
z
public double zThe position of the node. In graph units. -
positionned
public boolean positionned
-
-
Constructor Details
-
GraphicNode
New graphic node.- Parameters:
id- The node identifier.attributes- The node attribute set (can be null).
-
-
Method Details
-
getSelectorType
Description copied from class:GraphicElementType of selector for the graphic element (Node, Edge, Sprite ?).- Specified by:
getSelectorTypein classGraphicElement
-
getX
public double getX()Description copied from class:GraphicElementAbscissa of the element, always in GU (graph units). For edges this is the X of the "from" node.- Specified by:
getXin classGraphicElement
-
getY
public double getY()Description copied from class:GraphicElementOrdinate of the element, always in GU (graph units). For edges this is the Y of the "from" node.- Specified by:
getYin classGraphicElement
-
getZ
public double getZ()Description copied from class:GraphicElementDepth of the element, always in GU (graph units). For edges this is the Z of the "from" node.- Specified by:
getZin classGraphicElement
-
move
public void move(double x, double y, double z)Description copied from class:GraphicElementTry to force the element to move at the give location in graph units (GU). For edges, this may move the two attached nodes.- Specified by:
movein classGraphicElement- Parameters:
x- The new X.y- The new Y.z- the new Z.
-
getBreadthFirstIterator
Not implemented.- Specified by:
getBreadthFirstIteratorin interfaceNode- Returns:
- An iterator able to explore the graph in a breadth first way starting at this node.
-
getBreadthFirstIterator
Not implemented.- Specified by:
getBreadthFirstIteratorin interfaceNode- Parameters:
directed- If false, the iterator will ignore edge orientation (the default is "True").- Returns:
- An iterator able to explore the graph in a breadth first way starting at this node.
-
getDepthFirstIterator
Not implemented.- Specified by:
getDepthFirstIteratorin interfaceNode- Returns:
- An iterator able to explore the graph in a depth first way starting at this node.
-
getDepthFirstIterator
Not implemented.- Specified by:
getDepthFirstIteratorin interfaceNode- Parameters:
directed- If false, the iterator will ignore edge orientation (the default is "True").- Returns:
- An iterator able to explore the graph in a depth first way starting at this node.
-
getDegree
public int getDegree()Description copied from interface:NodeTotal number of relations with other nodes or this node. -
getEdge
Description copied from interface:NodeI-th edge. Edges are stored in no given order.However this method allows to iterate very quickly on all edges, or to choose a given edge with direct access.
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 = node.getEdge(i);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge. -
getEdgeBetween
Description copied from interface:NodeRetrieve an edge between this node and the node 'id', if it exits.This method selects directed or undirected edges. If the edge is directed, its direction is not important and leaving or entering edges will be selected.
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 = node.getEdgeBetween("...");the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeBetweenin interfaceNode- Parameters:
id- Identifier of the opposite node.- Returns:
- Edge between node 'id' and this node if it exists, else null.
-
getEdgeFrom
Description copied from interface:NodeRetrieve an edge that leaves node 'id' toward this node.This method selects only edges leaving node 'id' an pointing at this node (this also selects undirected edges).
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 = node.getEdgeFrom("...");the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeFromin interfaceNode- Parameters:
id- Identifier of the source node.- Returns:
- Directed edge going from node 'id' to this node, or undirected edge if it exists, else null.
-
edges
Description copied from interface:NodeStream over all entering and leaving edges. -
iterator
-
getEdgeToward
Description copied from interface:NodeRetrieve an edge that leaves this node toward 'id'.This method selects only edges leaving this node an pointing at node 'id' (this also selects undirected edges).
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 = node.getEdgeToward("...");the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeTowardin interfaceNode- Parameters:
id- Identifier of the target node.- Returns:
- Directed edge going from this node to 'id', or undirected edge if it exists, else null.
-
getGraph
Description copied from interface:NodeParent graph. Some elements are not able to give their parent graph. -
getGraphName
-
getHost
-
getInDegree
public int getInDegree()Description copied from interface:NodeNumber of entering edges.- Specified by:
getInDegreein interfaceNode- Returns:
- the count of edges that only enter this node plus all undirected edges.
-
getOutDegree
public int getOutDegree()Description copied from interface:NodeNumber of leaving edges.- Specified by:
getOutDegreein interfaceNode- Returns:
- the count of edges that only leave this node plus all undirected edges.
-
hasEdgeBetween
Description copied from interface:NodeTrue if an edge exists between this node and node 'id'.- Specified by:
hasEdgeBetweenin interfaceNode- Parameters:
id- Identifier of another node.- Returns:
- True if a edge exists between this node and node 'id'.
-
hasEdgeFrom
Description copied from interface:NodeTrue if an edge enters this node from node 'id'.- Specified by:
hasEdgeFromin interfaceNode- Parameters:
id- Identifier of the source node.- Returns:
- True if a directed edge goes from this node to 'id' or if an undirected edge exists.
-
hasEdgeToward
Description copied from interface:NodeTrue if an edge leaves this node toward node 'id'.- Specified by:
hasEdgeTowardin interfaceNode- Parameters:
id- Identifier of the target node.- Returns:
- True if a directed edge goes from this node to 'id' or if an undirected edge exists.
-
isDistributed
public boolean isDistributed() -
setGraph
-
setGraphName
-
setHost
-
getEdgeBetween
Description copied from interface:NodeRetrieves an edge between this node and and another node if one exists.This method selects directed or undirected edges. If the edge is directed, its direction is not important and leaving or entering edges will be selected.
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 = node.getEdgeBetween(...);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeBetweenin interfaceNode- Parameters:
Node- The opposite node.- Returns:
- Edge between this node and the parameter node if it exists, else null.
-
getEdgeBetween
Description copied from interface:NodeRetrieves an edge between this node and the node with index i if one exists.This method selects directed or undirected edges. If the edge is directed, its direction is not important and leaving or entering edges will be selected.
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 = node.getEdgeBetween(...);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeBetweenin interfaceNode- Parameters:
index- The index of the opposite node.- Returns:
- Edge between node with index i and this node if it exists, else null.
-
getEdgeFrom
Description copied from interface:NodeRetrieves an edge that leaves given node toward this node.This method selects only edges leaving the other node an pointing at this node (this also selects undirected edges).
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 = node.getEdgeFrom(...);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeFromin interfaceNode- Parameters:
Node- The source node.- Returns:
- Directed edge going from the parameter node to this node, or undirected edge if it exists, else null.
-
getEdgeFrom
Description copied from interface:NodeRetrieves an edge that leaves node with given index toward this node.This method selects only edges leaving the other node an pointing at this node (this also selects undirected edges).
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 = node.getEdgeFrom("...");the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeFromin interfaceNode- Parameters:
index- Index of the source node.- Returns:
- Directed edge going from the parameter node to this node, or undirected edge if it exists, else null.
-
getEdgeToward
Description copied from interface:NodeRetrieves an edge that leaves this node toward another node.This method selects only edges leaving this node an pointing at the parameter node (this also selects undirected edges).
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 = node.getEdgeToward(...);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeTowardin interfaceNode- Parameters:
Node- The target node.- Returns:
- Directed edge going from this node to the parameter node, or undirected edge if it exists, else null.
-
getEdgeToward
Description copied from interface:NodeRetrieves an edge that leaves this node toward the node with given index.This method selects only edges leaving this node an pointing at the parameter node (this also selects undirected edges).
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 = node.getEdgeToward(...);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEdgeTowardin interfaceNode- Parameters:
index- Index of the target node.- Returns:
- Directed edge going from this node to the parameter node, or undirected edge if it exists, else null.
-
getEnteringEdge
Description copied from interface:NodeI-th entering edge. Edges are stored in no given order.However this method allows to iterate very quickly on all entering edges, or to choose a given entering edge with direct access.
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 = node.getEnteringEdge(i);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getEnteringEdgein interfaceNode- Parameters:
i- Index of the edge.- Returns:
- The i-th entering edge.
-
getLeavingEdge
Description copied from interface:NodeI-th leaving edge. Edges are stored in no given order.However this method allows to iterate very quickly on all leaving edges, or to choose a given leaving edge with direct access.
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 = node.getLeavingEdge(i);
the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.- Specified by:
getLeavingEdgein interfaceNode- Parameters:
i- Index of the edge.- Returns:
- The i-th leaving edge.
-