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

Variable Index

 o args
The arguments of the algorithm.
 o endNode
End Vertex identity of the algorithm.
 o graph
The graph to be processed by the algorithm.
 o legendColor
Indicate the type of edges.
 o legendPrompt
Indicate the type of edges.
 o outputMessage
Algorithm output message.
 o showGraphWindow
The Window for showing the result graph.
 o startNode
Start Vertex identity of the algorithm.

Constructor Index

 o Algorithm()
Constructor of algorithm.

Method Index

 o algorImpl()
Algorithm implement here.
 o execute(Graph, Object[])
Execute this algorithm.
 o getElapsedTime()
Get the execution time of the algorithm.
 o getOutputMessage()
Get the message of the algorithm.
 o getPreferredDialog(Graph, Frame)
Get the preferred dialog.
 o init(Graph)
Clean all special attribute of edges and vertices of the graph.
 o init(Graph, Color)
Clean all special attribute of edges and vertices of the graph.
 o initEdges(Graph, Color)
Clean all special attribute of edges.
 o initVertices(Graph)
Clean all special attribute of vertices.
 o repaint()
Repaint graph canvas at ShowGraphWindow.
 o setArg(Object[])
Set arguments from the argument list.
 o show(JGAPFrame, Graph, Object[])
Show the algorithm.

Variables

 o graph
 protected Graph graph
The graph to be processed by the algorithm.

 o args
 protected Object args[]
The arguments of the algorithm.

 o outputMessage
 protected String outputMessage
Algorithm output message.

 o legendPrompt
 protected String legendPrompt[]
Indicate the type of edges. String represention.

 o legendColor
 protected Color legendColor[]
Indicate the type of edges. Color represention.

 o showGraphWindow
 protected ShowGraphWindow showGraphWindow
The Window for showing the result graph.

 o startNode
 protected int startNode
Start Vertex identity of the algorithm.

Default: Vertex.NUL

 o endNode
 protected int endNode
End Vertex identity of the algorithm.

Default: Vertex.NUL

Constructors

 o Algorithm
 public Algorithm()
Constructor of algorithm.

Methods

 o initVertices
 protected void initVertices(Graph graph)
Clean all special attribute of vertices.

Parameters:
graph - The graph to process.
See Also:
clean
 o 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
 o 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
 o 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
 o 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.
 o 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.
 o algorImpl
 protected abstract Object algorImpl() throws AlgorithmException, InvalidGraphTypeException
Algorithm implement here.

Returns:
the result of the algorithm.
Throws: AlgorithmException
Exception that throws by algorithm.
 o getOutputMessage
 public String getOutputMessage()
Get the message of the algorithm.

Returns:
The message of the algorithm.
 o getElapsedTime
 public long getElapsedTime()
Get the execution time of the algorithm.

Returns:
The execution time of the algorithm
 o 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.
 o repaint
 public void repaint()
Repaint graph canvas at ShowGraphWindow.

 o 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