com.werken.blissed
Class Process

java.lang.Object
  |
  +--com.werken.blissed.Process
All Implemented Interfaces:
Described, org.apache.commons.graph.DirectedGraph, org.apache.commons.graph.Graph, Named

public class Process
extends java.lang.Object
implements Named, Described, org.apache.commons.graph.DirectedGraph

A graph of nodes and transitions in the form of a state machine.

Author:
bob mcwhirter

Constructor Summary
Process(java.lang.String name, java.lang.String description)
          Construct a new process.
 
Method Summary
protected  void addState(State state)
          Add a state to this process.
 State addState(java.lang.String name, java.lang.String description)
          Create a new state for this process.
 java.lang.String getDescription()
          Retrieve the description of this process.
 java.util.Set getEdges()
          Reteieve all edges (transitions).
 java.util.Set getEdges(org.apache.commons.graph.Vertex vertex)
          Retrieve all edges (transitions) from a given vertex (state).
 java.util.Set getInbound(org.apache.commons.graph.Vertex vertex)
          Retrieve all inbound edges (transitions) for a vertex (state).
 java.lang.String getName()
          Retrieve the name of this process.
 java.util.Set getOutbound(org.apache.commons.graph.Vertex vertex)
          Retrieve all outbound edges (transitions) for a vertex (state).
 org.apache.commons.graph.Vertex getSource(org.apache.commons.graph.Edge edge)
          Retrieve the source vertex (state) of an edge (transition).
 State getStartState()
          Retrieve the entry-point start state of this process.
 State getState(java.lang.String name)
          Retrieve a stae in this process, by name.
 org.apache.commons.graph.Vertex getTarget(org.apache.commons.graph.Edge edge)
          Retrieve the target vertex (state) of an edge (transition).
 State getTerminalState()
          Retrieve the terminal state.
 java.util.Set getVertices()
          Retrieve all vertices (states).
 java.util.Set getVertices(org.apache.commons.graph.Edge edge)
          Retrieve all vertices (states) connected by an edge (transition)
protected  boolean removeState(State state)
          Remove a state from this process.
 void setDescription(java.lang.String description)
          Set the description
 void setName(java.lang.String name)
          Set the name of this process.
 void setStartState(State startState)
          Set the start state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Process

public Process(java.lang.String name,
               java.lang.String description)
Construct a new process.
Parameters:
name - The name of the process.
description - A description of the process.
Method Detail

getStartState

public State getStartState()
Retrieve the entry-point start state of this process.
Returns:
The entry-point start state.

getTerminalState

public State getTerminalState()
Retrieve the terminal state.
Returns:
The terminal state.

setStartState

public void setStartState(State startState)
Set the start state.
Parameters:
startState - The start state, or null to remove the start state.

addState

protected void addState(State state)
Add a state to this process.
Parameters:
state - The state to add.

getState

public State getState(java.lang.String name)
Retrieve a stae in this process, by name.
Parameters:
name - The name of the stae to retrieve.
Returns:
The named stae, or null of no stae with the given name is known to this process.

removeState

protected boolean removeState(State state)
Remove a state from this process.
Parameters:
state - The state to remove.
Returns:
true if the state was removed, otherwise false.

addState

public State addState(java.lang.String name,
                      java.lang.String description)
               throws DuplicateStateException
Create a new state for this process.
Parameters:
name - The name of the state.
description - The description of the state.
Returns:
The newly added State.
Throws:
DuplicateStateException - If a state already exists within this process with the specified name.

getName

public java.lang.String getName()
Retrieve the name of this process.
Specified by:
getName in interface Named
Returns:
The name of this process.

setName

public void setName(java.lang.String name)
Set the name of this process.
Parameters:
name - The name of this process.

getDescription

public java.lang.String getDescription()
Retrieve the description of this process.
Specified by:
getDescription in interface Described
Returns:
The description of this process.

setDescription

public void setDescription(java.lang.String description)
Set the description
Specified by:
setDescription in interface Described
Parameters:
description - The description.

getVertices

public java.util.Set getVertices()
Retrieve all vertices (states).
Specified by:
getVertices in interface org.apache.commons.graph.Graph
Returns:
Set of all vertices (states).

getEdges

public java.util.Set getEdges(org.apache.commons.graph.Vertex vertex)
Retrieve all edges (transitions) from a given vertex (state).
Specified by:
getEdges in interface org.apache.commons.graph.Graph
Parameters:
vertex - The vertex (state).
Returns:
The set of all inbound and outbound edges (transitions) for the vertex.

getVertices

public java.util.Set getVertices(org.apache.commons.graph.Edge edge)
Retrieve all vertices (states) connected by an edge (transition)
Specified by:
getVertices in interface org.apache.commons.graph.Graph
Parameters:
edge - The edge (transition).
Returns:
The set of vertices (states) connected by the edge (transition).

getEdges

public java.util.Set getEdges()
Reteieve all edges (transitions).
Specified by:
getEdges in interface org.apache.commons.graph.Graph
Returns:
SEt of all edges (transitions).

getInbound

public java.util.Set getInbound(org.apache.commons.graph.Vertex vertex)
Retrieve all inbound edges (transitions) for a vertex (state).
Specified by:
getInbound in interface org.apache.commons.graph.DirectedGraph
Parameters:
vertex - The vertex (state).
Returns:
The set of all inbound edges (transitions).

getOutbound

public java.util.Set getOutbound(org.apache.commons.graph.Vertex vertex)
Retrieve all outbound edges (transitions) for a vertex (state).
Specified by:
getOutbound in interface org.apache.commons.graph.DirectedGraph
Parameters:
vertex - The vertex (state).
Returns:
The set of all outbound edges (transitions).

getSource

public org.apache.commons.graph.Vertex getSource(org.apache.commons.graph.Edge edge)
Retrieve the source vertex (state) of an edge (transition).
Specified by:
getSource in interface org.apache.commons.graph.DirectedGraph
Parameters:
edge - The edge (transition).
Returns:
The source vertex (state).

getTarget

public org.apache.commons.graph.Vertex getTarget(org.apache.commons.graph.Edge edge)
Retrieve the target vertex (state) of an edge (transition).
Specified by:
getTarget in interface org.apache.commons.graph.DirectedGraph
Parameters:
edge - The edge (transition).
Returns:
THe target vertex (state).


Copyright © 2002-2002 The Werken Company. All Rights Reserved.