org.quilt.graph
Class Vertex

java.lang.Object
  |
  +--org.quilt.graph.Vertex
Direct Known Subclasses:
CodeVertex, Entry, Exit

public class Vertex
extends java.lang.Object

A vertex in a directed graph.

Author:
< a href="jddixon@users.sourceforge.net">Jim Dixon

Field Summary
protected  Connector connector
          Connects this vertex to one or more other vertices.
protected  Directed graph
          The graph this vertex belongs to.
protected  int index
          Unique non-negative assigned to the Vertex; -1 means 'unassigned'
protected  java.lang.String label_
          Optional label.
 
Constructor Summary
protected Vertex()
          Creates a vertex without an index and belonging to no graph.
  Vertex(Directed g)
          Creates a vertex belonging to a graph, assigns an index unique within this graph.
 
Method Summary
 boolean above(Directed g)
          Is the graph a parent, grandparent of this vertex?
static void checkForNull(java.lang.Object o, java.lang.String what)
          Throw an exception if the argument is null.
 Connector getConnector()
           
 Edge getEdge()
           
 Directed getGraph()
          Get the graph this vertex is in.
 int getIndex()
           
 java.lang.String getLabel()
           
 Vertex getTarget()
           
 Edge makeBinary()
          Convert the existing connector to a BinaryConnector.
 ComplexConnector makeComplex(int n)
          Convert the exiting connector to a ComplexConnector, using the existing Edge as seed.
 MultiConnector makeMulti(int n)
          Convert the exiting connector to a MultiConnector, using the existing Edge as seed.
 void setConnector(Connector c)
           
 void setLabel(java.lang.String s)
          Assign a label to the Vertex.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected int index
Unique non-negative assigned to the Vertex; -1 means 'unassigned'


graph

protected Directed graph
The graph this vertex belongs to.


connector

protected Connector connector
Connects this vertex to one or more other vertices.


label_

protected java.lang.String label_
Optional label.

Constructor Detail

Vertex

protected Vertex()
Creates a vertex without an index and belonging to no graph.


Vertex

public Vertex(Directed g)
Creates a vertex belonging to a graph, assigns an index unique within this graph.

Parameters:
g - The graph the vertex belongs to.
Method Detail

getConnector

public Connector getConnector()

setConnector

public void setConnector(Connector c)

getEdge

public Edge getEdge()

getTarget

public Vertex getTarget()

getGraph

public Directed getGraph()
Get the graph this vertex is in.


getIndex

public int getIndex()
Returns:
Vertex index, a non-negative integer.

getLabel

public java.lang.String getLabel()
Returns:
String label or null

setLabel

public void setLabel(java.lang.String s)
Assign a label to the Vertex.


makeBinary

public Edge makeBinary()
Convert the existing connector to a BinaryConnector.

Returns:
The 'other' edge created.

makeComplex

public ComplexConnector makeComplex(int n)
Convert the exiting connector to a ComplexConnector, using the existing Edge as seed.


makeMulti

public MultiConnector makeMulti(int n)
Convert the exiting connector to a MultiConnector, using the existing Edge as seed.


above

public boolean above(Directed g)
Is the graph a parent, grandparent of this vertex?

Parameters:
g - Candidate progenitor.
Returns:
True if match is found.

checkForNull

public static void checkForNull(java.lang.Object o,
                                java.lang.String what)
Throw an exception if the argument is null.

Parameters:
o - Argument being checked
what - What it is - for error message.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A String in parent-index:my-index form.


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.