alma::acs::algorithms::Vertex Class Reference

Collaboration diagram for alma::acs::algorithms::Vertex:
Collaboration graph
[legend]

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

Private Attributes

int m_color
List< Vertexm_adjacencyList
Object m_userObject

Detailed Description

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


Constructor & Destructor Documentation

alma::acs::algorithms::Vertex::Vertex ( Object  userObject  )  [inline]

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

References m_adjacencyList, and m_userObject.


Member Function Documentation

void alma::acs::algorithms::Vertex::addAdjacentVertex ( Vertex  vertex  )  [inline]

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.

References m_adjacencyList.

Referenced by alma::acs::algorithms::TopologicalSortTest::createGarmentVertices().

boolean alma::acs::algorithms::Vertex::equals ( Object  obj  )  [inline]

References m_userObject.

List<Vertex> alma::acs::algorithms::Vertex::getAdjacencyList (  )  [inline, package]
int alma::acs::algorithms::Vertex::getColor (  )  [inline, package]
Object alma::acs::algorithms::Vertex::getUserObject (  )  [inline]

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

References m_userObject.

Referenced by alma::acs::algorithms::TopologicalSortTest::testFailOnCyclicGraph(), and alma::acs::algorithms::TopologicalSortTest::testSortDirectedAcyclicGraph().

int alma::acs::algorithms::Vertex::hashCode (  )  [inline]

References m_userObject.

void alma::acs::algorithms::Vertex::setColor ( int  color  )  [inline, package]

Member Data Documentation

final int alma::acs::algorithms::Vertex::BLACK = 3 [static, package]

Referenced by setColor().

final int alma::acs::algorithms::Vertex::GRAY = 2 [static, package]

Referenced by setColor().

Referenced by getColor(), and setColor().

final int alma::acs::algorithms::Vertex::WHITE = 1 [static, package]

Referenced by setColor().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2