Public Member Functions | Package Functions | Static Package Attributes

alma.acs.algorithms.Vertex Class Reference

List of all members.

Public Member Functions

 Vertex (Object userObject)
void addAdjacentVertex (Vertex vertex)
Object getUserObject ()
boolean equals (Object obj)
int hashCode ()

Package Functions

int getColor ()
List< VertexgetAdjacencyList ()
void setColor (int color)

Static Package Attributes

static final int WHITE = 1
static final int GRAY = 2
static final int BLACK = 3

Detailed Description

A vertex of the graph that the TopologicalSort can work on.


Constructor & Destructor Documentation

alma.acs.algorithms.Vertex.Vertex ( Object  userObject  ) 

Constructor that wraps a node in the graph that has to be sorted.

The userObject must implement reasonable equals() and hashCode() methods.

Parameters:
userObject the application's graph node, to be retrieved later through getUserObject

Member Function Documentation

void alma.acs.algorithms.Vertex.addAdjacentVertex ( Vertex  vertex  ) 

Adds a dependent vertex to this vertex.

The direction of the graph is from "must occur first" to "may occur later". If node B depends on node A, then call vertexA.addAdjacentVertex(vertexB).

To use the example from Cormen, if you want to figure out in which order to put on your clothes, the vertex for socks must point to the vertex for shoes, stating that socks must be put on before you can put on your shoes, or in other words, that shoes depend on socks. So add the shoe vertex to the sock's adjacent vertex list.

Parameters:
vertex another vertex that depends on this vertex.
boolean alma.acs.algorithms.Vertex.equals ( Object  obj  ) 
List<Vertex> alma.acs.algorithms.Vertex.getAdjacencyList (  )  [package]
int alma.acs.algorithms.Vertex.getColor (  )  [package]
Object alma.acs.algorithms.Vertex.getUserObject (  ) 

Returns the application's graph node that was wrapped by this vertex.

int alma.acs.algorithms.Vertex.hashCode (  ) 
void alma.acs.algorithms.Vertex.setColor ( int  color  )  [package]

Member Data Documentation

final int alma.acs.algorithms.Vertex.BLACK = 3 [static, package]
final int alma.acs.algorithms.Vertex.GRAY = 2 [static, package]
final int alma.acs.algorithms.Vertex.WHITE = 1 [static, package]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties