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.
GraphicGraph
GraphicElement.SwingElementRenderer
AbstractElement.AttributeChangeEvent
Modifier and Type | Field and Description |
---|---|
boolean |
positionned |
double |
x
The position of the node.
|
double |
y
The position of the node.
|
double |
z
The position of the node.
|
component, hidden, label, style
Constructor and Description |
---|
GraphicNode(GraphicGraph graph,
java.lang.String id,
java.util.HashMap<java.lang.String,java.lang.Object> attributes)
New graphic node.
|
Modifier and Type | Method and Description |
---|---|
java.util.stream.Stream<Edge> |
edges()
Stream over all entering and leaving edges.
|
java.util.Iterator<Node> |
getBreadthFirstIterator()
Not implemented.
|
java.util.Iterator<Node> |
getBreadthFirstIterator(boolean directed)
Not implemented.
|
int |
getDegree()
Total number of relations with other nodes or this node.
|
java.util.Iterator<Node> |
getDepthFirstIterator()
Not implemented.
|
java.util.Iterator<Node> |
getDepthFirstIterator(boolean directed)
Not implemented.
|
Edge |
getEdge(int i)
I-th edge.
|
Edge |
getEdgeBetween(int index)
Retrieves an edge between this node and the node with index i if one exists.
|
Edge |
getEdgeBetween(Node Node)
Retrieves an edge between this node and and another node if one exists.
|
Edge |
getEdgeBetween(java.lang.String id)
Retrieve an edge between this node and the node 'id', if it exits.
|
Edge |
getEdgeFrom(int index)
Retrieves an edge that leaves node with given index toward this node.
|
Edge |
getEdgeFrom(Node Node)
Retrieves an edge that leaves given node toward this node.
|
Edge |
getEdgeFrom(java.lang.String id)
Retrieve an edge that leaves node 'id' toward this node.
|
Edge |
getEdgeToward(int index)
Retrieves an edge that leaves this node toward the node with given index.
|
Edge |
getEdgeToward(Node Node)
Retrieves an edge that leaves this node toward another node.
|
Edge |
getEdgeToward(java.lang.String id)
Retrieve an edge that leaves this node toward 'id'.
|
Edge |
getEnteringEdge(int i)
I-th entering edge.
|
Graph |
getGraph()
Parent graph.
|
java.lang.String |
getGraphName() |
java.lang.String |
getHost() |
int |
getInDegree()
Number of entering edges.
|
Edge |
getLeavingEdge(int i)
I-th leaving edge.
|
int |
getOutDegree()
Number of leaving edges.
|
Selector.Type |
getSelectorType()
Type of selector for the graphic element (Node, Edge, Sprite ?).
|
double |
getX()
Abscissa of the element, always in GU (graph units).
|
double |
getY()
Ordinate of the element, always in GU (graph units).
|
double |
getZ()
Depth of the element, always in GU (graph units).
|
boolean |
hasEdgeBetween(java.lang.String id)
True if an edge exists between this node and node 'id'.
|
boolean |
hasEdgeFrom(java.lang.String id)
True if an edge enters this node from node 'id'.
|
boolean |
hasEdgeToward(java.lang.String id)
True if an edge leaves this node toward node 'id'.
|
boolean |
isDistributed() |
java.util.Iterator<Edge> |
iterator() |
void |
move(double x,
double y,
double z)
Try to force the element to move at the give location in graph units (GU).
|
void |
setGraph(Graph graph) |
void |
setGraphName(java.lang.String newHost) |
void |
setHost(java.lang.String newHost) |
getComponent, getLabel, getStyle, myGraph, setAttribute, setComponent
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, toString
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
enteringEdges, hasEdgeBetween, hasEdgeBetween, hasEdgeFrom, hasEdgeFrom, hasEdgeToward, hasEdgeToward, leavingEdges, neighborNodes, toString
attributeKeys, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, getLabel, getMap, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasLabel, hasMap, hasNumber, hasVector, removeAttribute, setAttribute, setAttributes
public double x
public double y
public double z
public boolean positionned
public GraphicNode(GraphicGraph graph, java.lang.String id, java.util.HashMap<java.lang.String,java.lang.Object> attributes)
id
- The node identifier.attributes
- The node attribute set (can be null).public Selector.Type getSelectorType()
GraphicElement
getSelectorType
in class GraphicElement
public double getX()
GraphicElement
getX
in class GraphicElement
public double getY()
GraphicElement
getY
in class GraphicElement
public double getZ()
GraphicElement
getZ
in class GraphicElement
public void move(double x, double y, double z)
GraphicElement
move
in class GraphicElement
x
- The new X.y
- The new Y.z
- the new Z.public java.util.Iterator<Node> getBreadthFirstIterator()
getBreadthFirstIterator
in interface Node
public java.util.Iterator<Node> getBreadthFirstIterator(boolean directed)
getBreadthFirstIterator
in interface Node
directed
- If false, the iterator will ignore edge orientation (the default
is "True").public java.util.Iterator<Node> getDepthFirstIterator()
getDepthFirstIterator
in interface Node
public java.util.Iterator<Node> getDepthFirstIterator(boolean directed)
getDepthFirstIterator
in interface Node
directed
- If false, the iterator will ignore edge orientation (the default
is "True").public int getDegree()
Node
public Edge getEdge(int i)
Node
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.
public Edge getEdgeBetween(java.lang.String id)
Node
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.
getEdgeBetween
in interface Node
id
- Identifier of the opposite node.public Edge getEdgeFrom(java.lang.String id)
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.
getEdgeFrom
in interface Node
id
- Identifier of the source node.public java.util.stream.Stream<Edge> edges()
Node
public java.util.Iterator<Edge> iterator()
public Edge getEdgeToward(java.lang.String id)
Node
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.
getEdgeToward
in interface Node
id
- Identifier of the target node.public Graph getGraph()
Node
public java.lang.String getGraphName()
public java.lang.String getHost()
public int getInDegree()
Node
getInDegree
in interface Node
public int getOutDegree()
Node
getOutDegree
in interface Node
public boolean hasEdgeBetween(java.lang.String id)
Node
hasEdgeBetween
in interface Node
id
- Identifier of another node.public boolean hasEdgeFrom(java.lang.String id)
Node
hasEdgeFrom
in interface Node
id
- Identifier of the source node.public boolean hasEdgeToward(java.lang.String id)
Node
hasEdgeToward
in interface Node
id
- Identifier of the target node.public boolean isDistributed()
public void setGraph(Graph graph)
public void setGraphName(java.lang.String newHost)
public void setHost(java.lang.String newHost)
public Edge getEdgeBetween(Node Node)
Node
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.
getEdgeBetween
in interface Node
Node
- The opposite node.public Edge getEdgeBetween(int index)
Node
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.
getEdgeBetween
in interface Node
index
- The index of the opposite node.public Edge getEdgeFrom(Node Node)
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.
getEdgeFrom
in interface Node
Node
- The source node.public Edge getEdgeFrom(int index)
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.
getEdgeFrom
in interface Node
index
- Index of the source node.public Edge getEdgeToward(Node Node)
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.
getEdgeToward
in interface Node
Node
- The target node.public Edge getEdgeToward(int index)
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.
getEdgeToward
in interface Node
index
- Index of the target node.public Edge getEnteringEdge(int i)
Node
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.
getEnteringEdge
in interface Node
i
- Index of the edge.public Edge getLeavingEdge(int i)
Node
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.
getLeavingEdge
in interface Node
i
- Index of the edge.