public class Vertex extends java.lang.Object implements java.lang.Comparable<Vertex>
A Vertex holds an Attributes
object which encapsulates
all properties of the vertex which are not necessary to know for
parsing a graph in a GraphProcessor
. Only the visited flag will
be manipulated during parsing.
A Vertex knows the head and tail vertices of all its outgoing
and incoming arcs. When a head vertex is added by the method
addOutgoingArcTo(classycle.graph.Vertex)
also the corresponding incoming arc is built
in the head vertex. The same is true the other way around. Note,
that multi-arcs are not possible. That is, adding an already added
head/tail vertex again as a head/tail vertex will be ignored.
Constructor and Description |
---|
Vertex(Attributes attributes)
Create a new instance for the specified attributes.
|
Modifier and Type | Method and Description |
---|---|
void |
addIncomingArcTo(Vertex tailVertex)
Adds an incoming arc to the specified vertex.
|
void |
addOutgoingArcTo(Vertex headVertex)
Adds an outgoing arc to the specified vertex.
|
int |
compareTo(Vertex object) |
Attributes |
getAttributes()
Returns the attributes.
|
Vertex |
getHeadVertex(int index)
Returns the head vertex of the specified outgoing arc.
|
int |
getNumberOfIncomingArcs()
Returns the number of incoming arcs.
|
int |
getNumberOfOutgoingArcs()
Returns the number of outgoing arcs.
|
Vertex |
getTailVertex(int index)
Returns the tail vertex of the specified outgoing arc.
|
boolean |
isVisited()
Returns the visited flag.
|
void |
reset()
Reset this vertex.
|
java.lang.String |
toString()
Returns toString() of the attributes and the number of
incoming and outgoing arcs.
|
void |
visit()
Marks this instance as visited.
|
public Vertex(Attributes attributes)
public Attributes getAttributes()
public int getNumberOfOutgoingArcs()
public Vertex getHeadVertex(int index)
public void addOutgoingArcTo(Vertex headVertex)
addIncomingArcTo(classycle.graph.Vertex)
for headVertex with this as
the argument. Does nothing if headVertex is the head
vertex of an already existing outgoing arc.headVertex
- Head vertex to be added to establish a new outgoing arc.
Null is not allowed.public int getNumberOfIncomingArcs()
public Vertex getTailVertex(int index)
public void addIncomingArcTo(Vertex tailVertex)
addOutgoingArcTo(classycle.graph.Vertex)
for tailVertex with this as
the argument. Does nothing if tailVertex is the
tail vertex of an already existing incoming arc.tailVertex
- Tail vertex to be added to establish a new incoming arc.
Null is not allowed.public void reset()
public void visit()
public boolean isVisited()
public java.lang.String toString()
toString
in class java.lang.Object