|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.framework.DAG
A directed acyclic graph (DAG) is constructed leading from the module which implements the Board interface to the terminating module. Usually the terminating module implements the MoveGenerator interface, but it may be some other type of module since modules can get their own Scheduler object which contains its own DAG. For example, a module which implements the Joseki interface and calls getScheduler() would get a Scheduler object which contains a DAG object where the terminating module implements type Joseki.
The DAG can be traversed using the getFirst() and getNext() methods, while the state of each module is set using the clear() and setComplete() methods.
The DAG class does not do consistency checking on the module order, since this consistency checking is done by the ModuleCreator object before the DAG object is created.
Field Summary | |
private ModuleName |
first
The name of the Board module. |
private int |
modulesRemaining
A count of the number of modules which have not yet completed running. |
private HashMap |
nodes
Key is ModuleName, value is a DAGNode object. |
private ArrayList |
ready
The modules which are ready to be started. |
Constructor Summary | |
protected |
DAG(HashMap modules)
Construct the DAG object. |
Method Summary | |
protected void |
clear()
Set all the modules as not having been executed. |
Object |
clone()
Override the Object.clone() method. |
protected ModuleName[] |
getAllModuleNames()
Return all of the module names. |
protected ModuleName |
getFirst()
Get the first module name. |
protected ModuleName[] |
getNext()
Return the names of the modules to be run next. |
protected void |
setComplete(ModuleName name)
Mark a module as completed. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private HashMap nodes
private ModuleName first
private ArrayList ready
private int modulesRemaining
Constructor Detail |
protected DAG(HashMap modules) throws InternalErrorException
modules
- a HashMap where the key is the ModuleName, and the
value is the Module.
InternalErrorException
- Thrown if the operation fails for any reason.Method Detail |
protected void clear()
protected ModuleName[] getAllModuleNames()
protected ModuleName getFirst()
protected ModuleName[] getNext()
protected void setComplete(ModuleName name)
name
- The name of the module which is completed.public Object clone()
clone
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |