|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.module.YModule
This abstract class provides a skeleton for algorithms on graphs. It defines an interface for the caller of the the algorithm and provides an mechanism for parameter passing. Modules can be run either in a separate thread or in the actual thread.
Tips how to write your own module:
To write your own graph algorithm you have to overwrite the following
methods:
Field Summary | |
static short |
FAILED
Exit state constant. |
static short |
PRECONDITION_VIOLATED
Exit state constant. |
static short |
SUCCESS
Exit state constant. |
Constructor Summary | |
YModule(String moduleName,
String authorName,
String description)
Instantiates a YModule. |
Method Summary | |
protected OptionHandler |
createOptionHandler()
Creates an option handler for this class. |
protected void |
dispose()
Disposition code performed after the execution of YModule.mainrun()
was finished. |
protected void |
fitGraph2DView()
Fits the content if the current view is of type Graph2DView . |
String |
getAuthor()
Returns the name of this module's author |
String |
getDescription()
Returns a short description of what this module does |
short |
getExitStatus()
Ask how the the module succeeded. |
protected Graph2D |
getGraph2D()
Grants access to the graph2D acted upon. |
protected Graph2DView |
getGraph2DView()
Grants access to the current view this module acts upon. |
String |
getModuleName()
Returns the name of this module. |
OptionHandler |
getOptionHandler()
Returns the option handler of this module. |
protected Timer |
getTimer()
Grants access to a timer object associated with this module. |
protected View |
getView()
Grants access to the current view this module acts upon. |
protected void |
init()
Initialisation code performed before calling YModule.mainrun() . |
boolean |
isAbortable()
Returns whether or not this module is abortable. |
protected abstract void |
mainrun()
Main execution code to be implemented by any subclassed module. |
protected void |
run()
Calls the canonic module execution sequence: YModule.init() - YModule.mainrun() - YModule.dispose() . |
protected void |
setExitStatus(short status)
Sets the exit status of this module. |
void |
setGraph2D(Graph2D graph)
Sets the graph being acted upon. |
void |
setModuleName(String name)
Sets name of this module. |
void |
setOptionHandler(OptionHandler oh)
Sets the option handler for this method. |
void |
start(Graph2D graph)
Main module startup routine. |
void |
startAsThread(Graph2D graph)
Starts this module as a thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short SUCCESS
public static final short FAILED
public static final short PRECONDITION_VIOLATED
Constructor Detail |
public YModule(String moduleName, String authorName, String description)
Method Detail |
public String getModuleName()
public void setModuleName(String name)
public String getAuthor()
public String getDescription()
protected Timer getTimer()
public void setGraph2D(Graph2D graph)
protected Graph2D getGraph2D()
protected View getView()
protected Graph2DView getGraph2DView()
null
if the current view is not of type
Graph2DView
.
protected void fitGraph2DView()
Graph2DView
.
public OptionHandler getOptionHandler()
createOptionHandler
.
If this module does not provide an option handler null
is returned.
protected OptionHandler createOptionHandler()
null
by default.public void setOptionHandler(OptionHandler oh)
public void start(Graph2D graph)
graph
- the graph being acted uponpublic void startAsThread(Graph2D graph)
graph
- the graph being acted upon.public boolean isAbortable()
public short getExitStatus()
YModule.SUCCESS
, YModule.FAILED
,
or YModule.PRECONDITION_VIOLATED
protected void setExitStatus(short status)
status
- One of the values SUCCESS, FAILED AND PRECONDITION_VIOLATED.protected void init()
YModule.mainrun()
.
protected abstract void mainrun()
protected void dispose()
YModule.mainrun()
was finished.
protected void run()
YModule.init()
- YModule.mainrun()
- YModule.dispose()
.
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |