Programmieren_Projekt/logging/Algorithm.java

81 lines
2.3 KiB
Java

package logging;
import visualization.ParameterArea;
/**
* This class provides the basic algorithm.
* Use it in assoziation with packages logging and visualization.
* Extend it by the members you need and overwrite LogElementList<LOG>run() which contains the specific algorithmic procedures.
* Therein you should fill a LogElementList and return it.
* Parameters for algorithm processing are read from member parameterArea that ist part of the user interface.
* @see LogElement
* @see LogElementList
* @see visualization.HybridWindow
* @see visualization.ParameterArea
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>
* it2003<br></small>
*/
public abstract class Algorithm <PARAM extends ParameterArea,LOG extends LogElement> {
/**Algorithm title.*/
protected String title;
/**Algorithm parameter area from which the algorithm gets its parameters.*/
protected PARAM parameterArea;
/**Standard constructor.*/
public Algorithm() {
super();
// TODO Auto-generated constructor stub
}
/**Creates algorithm with specified title and parameter area.*/
public Algorithm(PARAM parameterArea,String title){
this.parameterArea=parameterArea;
this.title=title;
}
/**
* Runs the algorithm with parameters specified in parameterArea.
* Returns the LogElementList produced by the algorithm processing.
* To use this class you will have to overwrite this method.
* @return a LogElementList containing the algorithm processings single steps
*/
public abstract LogElementList<LOG>run();
//return new LogElementList<LOG>()
/**
* Returns the algorithm title.
* @return the algorithm title.
*/
public String getTitle(){
return title;
}
/**
* Sets the algorithm's title.
* @param title the algorithm's title
*/
public void setTitle(String title){
this.title=title;
}
/**
* Sets the algorithm's parameter area.
* @param parameterArea the algorithm's parameter area
*/
public void setParameterArea(PARAM parameterArea){
this.parameterArea=parameterArea;
}
/**
* Returns the algorithm's parameter area.
* @return the algorithm's parameter area
*/
public PARAM getParameterArea(){
return parameterArea;
}
}