|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Edge
This class represents a directed, labeled edge.
Constructor Summary | |
Edge(Edge e)
Copy Constructor. |
|
Edge(java.lang.String label,
int tail,
int head)
Constructs an Edge with given label going
from tail to head . |
Method Summary | |
java.lang.Object |
clone()
Returns a clone of this Edge. |
boolean |
connects(int node)
True if node is one of the nodes of this Edge. |
boolean |
equals(java.lang.Object obj)
Two Edges are equal iff they have the same label and the same endpoints. |
int |
head()
Returns the head of this Edge. |
void |
invert()
Reverses the direction of this Edge. |
java.lang.String |
label()
Returns the label of this Edge. |
int[] |
nodes()
Returns the nodes from this Edge as an array containing {tail,head} . |
int |
otherNode(int node)
Returns the node at the other side of node or -1
if the given node is no endpoint of this Edge. |
void |
setHead(int newhead)
Sets the head to newhead . |
void |
setLabel(java.lang.String newlabel)
Sets the label to newlabel . |
void |
setNodes(int[] newnodes)
Sets the tail from this Edge to newnodes[0]
and the head to newnodes[1] . |
void |
setNodes(int newtail,
int newhead)
Sets the tail from this Edge to newtail
and the head to newhead . |
void |
setTail(int newtail)
Sets the tail to newtail . |
int |
tail()
Returns the tail of this Edge. |
java.lang.String |
toString()
Returns a string representation of this Edge in the format label = (tail,head) . |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Edge(java.lang.String label, int tail, int head)
label
going
from tail
to head
.
label
- the label of the Edgetail
- the tail of the Edgehead
- the head of the Edgepublic Edge(Edge e)
e
- the Edge to be duplicatedMethod Detail |
public java.lang.String label()
public void setLabel(java.lang.String newlabel)
newlabel
.
newlabel
- the new label of this Edgepublic int head()
public void setHead(int newhead)
newhead
.
newhead
- the new head of this Edgepublic int tail()
public void setTail(int newtail)
newtail
.
newtail
- the new tail of this Edgepublic int[] nodes()
{tail,head}
.
public void setNodes(int newtail, int newhead)
newtail
and the head to newhead
.
newtail
- the new tail of this Edgenewhead
- the new head of this Edgepublic void setNodes(int[] newnodes)
newnodes[0]
and the head to newnodes[1]
.
newnodes
- the new nodes of this Edgepublic boolean connects(int node)
node
is one of the nodes of this Edge.
node
- the node to be checked
public int otherNode(int node)
node
or -1
if the given node is no endpoint of this Edge.
node
- the node for which the other endpoint has to be returned
public void invert()
public java.lang.String toString()
label = (tail,head)
.
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to be checke for equality
public java.lang.Object clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |