|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.graphs.Edge
public class Edge
An edge is a component of a graph that represents the flow of control from one node to another. Every edge maintains the IDs of its source and sink nodes.
Graph
,
Node
Field Summary | |
---|---|
protected int |
edgeID
The edge's ID. |
protected java.lang.String |
label
The edge's label. |
protected int |
predNodeID
ID of the node from which this edge originates. |
protected int |
succNodeID
ID of the node on which this edge is incident. |
static Edge[] |
ZL_ARRAY
Zero-length edge array useful for specifying array cast types to methods such Graph.getEdges(Node,Node,Edge[]) . |
Constructor Summary | |
---|---|
Edge()
Creates an edge with ID zero, an empty label, and the successor and predecessor nodes set to zero. |
|
Edge(int id,
int s,
int p,
java.lang.String label)
Creates an edge with the given label, ID, successor, and predecessor nodes. |
Method Summary | |
---|---|
int |
getID()
Gets the ID of this edge. |
java.lang.String |
getLabel()
Gets the label for this edge. |
int |
getPredNodeID()
Gets the predecessor node of this edge. |
int |
getSuccNodeID()
Gets the successor node of this edge. |
static void |
main(java.lang.String[] args)
Test driver for the Edge class. |
void |
setID(int id)
Sets the ID of this edge. |
void |
setLabel(java.lang.String s)
Sets the label for this edge. |
void |
setPredNodeID(int p)
Sets the predecessor node of this edge. |
void |
setSuccNodeID(int s)
Sets the successor node of this edge. |
java.lang.String |
toString()
Returns a string representation of this edge in the form: label: sourceNodeID -> sinkNodeID . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int edgeID
protected int succNodeID
protected int predNodeID
protected java.lang.String label
public static final Edge[] ZL_ARRAY
Graph.getEdges(Node,Node,Edge[])
.
Constructor Detail |
---|
public Edge()
public Edge(int id, int s, int p, java.lang.String label)
id
- ID of the new edge.s
- ID of the new edge's successor node.p
- ID of the new edge's predecessor node.label
- Label to be assigned to the new edge.Method Detail |
---|
public void setID(int id)
id
- New ID to assign to this edge.public int getID()
public void setSuccNodeID(int s)
s
- ID of the node that is to be the new successor of this edge.public int getSuccNodeID()
public void setPredNodeID(int p)
p
- ID of the node that is to be the new predecessor node of this
edge.public int getPredNodeID()
public void setLabel(java.lang.String s)
Assigning version-dependent values to this field should be avoided.
s
- New label to be assigned to this edge.public java.lang.String getLabel()
public java.lang.String toString()
label: sourceNodeID -> sinkNodeID
.
If the edge is unlabeled, the special token "(nl)
" is
used for the label.
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |