All Packages Class Hierarchy This Package Previous Next Index
Class tw.edu.ncnu.im.cnclab.Algor.Algorithm
java.lang.Object
|
+----tw.edu.ncnu.im.cnclab.Algor.Algorithm
- public abstract class Algorithm
- extends Object
The Algorithm class define the graph algorithm.
Algorithm class define the phototype of graph algorithm.
Developer must override setArg and algorImpl
- Version:
- 0.4 Jul 8, 1999
- Author:
- Ding-Yi Chen
-
args
- The arguments of the algorithm.
-
endNode
- End Vertex identity of the algorithm.
-
graph
- The graph to be processed by the algorithm.
-
legendColor
- Indicate the type of edges.
-
legendPrompt
- Indicate the type of edges.
-
outputMessage
- Algorithm output message.
-
showGraphWindow
- The Window for showing the result graph.
-
startNode
- Start Vertex identity of the algorithm.
-
Algorithm()
- Constructor of algorithm.
-
algorImpl()
- Algorithm implement here.
-
execute(Graph, Object[])
- Execute this algorithm.
-
getElapsedTime()
- Get the execution time of the algorithm.
-
getOutputMessage()
- Get the message of the algorithm.
-
getPreferredDialog(Graph, Frame)
- Get the preferred dialog.
-
init(Graph)
- Clean all special attribute of edges and vertices of the graph.
-
init(Graph, Color)
- Clean all special attribute of edges and vertices of the graph.
-
initEdges(Graph, Color)
- Clean all special attribute of edges.
-
initVertices(Graph)
- Clean all special attribute of vertices.
-
repaint()
- Repaint graph canvas at ShowGraphWindow.
-
setArg(Object[])
- Set arguments from the argument list.
-
show(JGAPFrame, Graph, Object[])
- Show the algorithm.
graph
protected Graph graph
- The graph to be processed by the algorithm.
args
protected Object args[]
- The arguments of the algorithm.
outputMessage
protected String outputMessage
- Algorithm output message.
legendPrompt
protected String legendPrompt[]
- Indicate the type of edges. String represention.
legendColor
protected Color legendColor[]
- Indicate the type of edges. Color represention.
showGraphWindow
protected ShowGraphWindow showGraphWindow
- The Window for showing the result graph.
startNode
protected int startNode
- Start Vertex identity of the algorithm.
Default: Vertex.NUL
endNode
protected int endNode
- End Vertex identity of the algorithm.
Default: Vertex.NUL
Algorithm
public Algorithm()
- Constructor of algorithm.
initVertices
protected void initVertices(Graph graph)
- Clean all special attribute of vertices.
- Parameters:
- graph - The graph to process.
- See Also:
- clean
initEdges
protected void initEdges(Graph graph,
Color initColor)
- Clean all special attribute of edges.
- Parameters:
- graph - The graph to process.
- edgeInitStatus - The initial color of edge.
- See Also:
- clean
init
protected void init(Graph graph)
- Clean all special attribute of edges and vertices of the graph.
- Parameters:
- graph - The graph to process.
- edgeInitStatus - The initial status of edge.
- See Also:
- initVertex, initEdge
init
protected void init(Graph graph,
Color initColor)
- Clean all special attribute of edges and vertices of the graph.
- Parameters:
- graph - The graph to process.
- initColor - The initial color of edge.
- See Also:
- initVertex, initEdge
setArg
protected abstract void setArg(Object args[]) throws IllegalArgumentException
- Set arguments from the argument list.
Developers must override this method to extract arguemts from the argument list.
- Parameters:
- args - The list of arguments.
- Throws: IllegalArgumentException
- Illegal argument defined.
execute
public Object execute(Graph graph,
Object args[]) throws IllegalArgumentException, InvalidGraphTypeException
- Execute this algorithm.
It will call setArg to set arguments. then call algorImpl to execute the algorithm.
- Parameters:
- graph - The graph to process.
- args - The list of arguments.
- Returns:
- the result of the algorithm.
- Throws: IllegalArgumentException
- Illegal argument defined.
- Throws: AlgorithmException
- Exception that throws by algorithm.
- Throws: NullPointerException
- thown if Null Pointer happen.
algorImpl
protected abstract Object algorImpl() throws AlgorithmException, InvalidGraphTypeException
- Algorithm implement here.
- Returns:
- the result of the algorithm.
- Throws: AlgorithmException
- Exception that throws by algorithm.
getOutputMessage
public String getOutputMessage()
- Get the message of the algorithm.
- Returns:
- The message of the algorithm.
getElapsedTime
public long getElapsedTime()
- Get the execution time of the algorithm.
- Returns:
- The execution time of the algorithm
show
public void show(JGAPFrame parent,
Graph graph,
Object args[])
- Show the algorithm.
- Parameters:
- parent - The main window of JGAP.
- graph - The graph to process.
- args - The arguments of the alogrithm.
repaint
public void repaint()
- Repaint graph canvas at ShowGraphWindow.
getPreferredDialog
public GenericDialog getPreferredDialog(Graph graph,
Frame fr)
- Get the preferred dialog.
While using algorithm loader, such as Algorithm -> Custom -> Execute.
Developer may assign the preferred dialog to get input.
Default is null (no dialog is needed.)
- Parameters:
- graph - The Graph.
- fr - The parent Frame.
- Returns:
- the preferred dialog.
All Packages Class Hierarchy This Package Previous Next Index