Class Algorithm

java.lang.Object
   |
   +----Algorithm

public abstract class Algorithm
extends Object

Algorithm.java

by Aaron Nall

Tue Jun 30 19:28:13 GMT 1998

This class is to serve as a superclass of all algorithms for Jedit 3.x. Any properly written subclass can be used in Jedit 3.1 or higher with a single line of code in the JeditAlgorithms.java file.


Variable Index

 o description
A Vector of strings that holds a descriptive paragraph for each algorithm.
 o type
A flag determining how the algorithm should be started by Jedit.

Constructor Index

 o Algorithm()
This constructor only does the equivalent work of the call succeeded(false);
 o Algorithm(JavaGraph, Vector, Vector)
The intended constructor for all algorithms in Jedit3.0, it is no longer called in Jedit3.1.
 o Algorithm(String)
This constructor only does the equivalent work of the calls succeeded(false); and setName(newName);

Method Index

 o callOwnConstructor(JavaGraph, Vector, Vector)
This method is called by Jedit for any algorithm it executes.
 o getDescription()
Returns the description of the Vector as it will appear in the description portion of the JeditAlgorithms menu.
 o getName()
Return the algorithm's name as specified during by the appropriate constructor or a call to the setName() method.
 o getType()
Returns the type of the algorithm.

See type.
 o setName(String)
Sets the algorithms name, as it will appear in the JeditAlgorithms menu, to newName.
 o succeeded()
Returns true if the Algorithm succeeded, otherwise returns false.
 o succeeded(boolean)
Use this to report a successful or unseccessful algorithm executions.

Variables

 o description
 protected Vector description
A Vector of strings that holds a descriptive paragraph for each algorithm. It must be instantiated in the subclasses' constructors.

 o type
 protected int type
A flag determining how the algorithm should be started by Jedit. The options are:

Constructors

 o Algorithm
 public Algorithm()
This constructor only does the equivalent work of the call succeeded(false);

 o Algorithm
 public Algorithm(String newName)
This constructor only does the equivalent work of the calls succeeded(false); and setName(newName);

 o Algorithm
 public Algorithm(JavaGraph jGraph,
                  Vector inputs,
                  Vector animation)
The intended constructor for all algorithms in Jedit3.0, it is no longer called in Jedit3.1.

Methods

 o succeeded
 public boolean succeeded()
Returns true if the Algorithm succeeded, otherwise returns false. Default is false.

 o succeeded
 public void succeeded(boolean newValue)
Use this to report a successful or unseccessful algorithm executions. If succeeded(true) is called, the algorithm's animation will be run.
A well-written algorithm will report success even for failed algorithms, producing an informative animation.

 o getName
 public String getName()
Return the algorithm's name as specified during by the appropriate constructor or a call to the setName() method.

 o setName
 public void setName(String newName)
Sets the algorithms name, as it will appear in the JeditAlgorithms menu, to newName.

 o getDescription
 public Vector getDescription()
Returns the description of the Vector as it will appear in the description portion of the JeditAlgorithms menu.

 o getType
 public int getType()
Returns the type of the algorithm.

See type.

 o callOwnConstructor
 public abstract void callOwnConstructor(JavaGraph jGraph,
                                         Vector inputs,
                                         Vector animation)
This method is called by Jedit for any algorithm it executes. This method must be used in any working algorithm. Obviously, the class can't call a constructor except from withing another constructor. The name is historical. In Jedit 3.0, the algorithms were launched from one of the constructors.