49 lines
1.2 KiB
Java
49 lines
1.2 KiB
Java
package OurApplication;
|
||
|
||
import logging.Algorithm;
|
||
import logging.LogElementList;
|
||
|
||
/**
|
||
* This class provides an example for using logging.Algorithm.
|
||
* It sums up integer number starting with 0 up to the maximum value specified in the parameter area.
|
||
* @see Algorithm
|
||
* @author MSch<63>fer
|
||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||
* <br>
|
||
*/
|
||
public class OurAlgorithm extends Algorithm{
|
||
|
||
public OurAlgorithm() {
|
||
super();
|
||
}
|
||
/**
|
||
* Creates a sum up algorithm.
|
||
* @param parameterArea the sum up parameter area the algorithm gets its parameters from
|
||
*/
|
||
public OurAlgorithm(OurParameterArea parameterArea){
|
||
super(parameterArea,"GraphAlgorithm");
|
||
}
|
||
|
||
/**
|
||
* Overwritten from super class.
|
||
* Runs the algorithm..
|
||
* Returns the LogElementList produced by the algorithm processing.
|
||
* Adds integer number starting with 0 up to the maximum value.
|
||
* @return a LogElementList containing the algorithm processing single steps
|
||
*/
|
||
public LogElementList run(){
|
||
LogElementList<OurLogElement>logList = new LogElementList<OurLogElement>();
|
||
for(int i=1;i<=10;i++){
|
||
try{
|
||
|
||
logList.add(new OurLogElement(i, "Value", i));
|
||
}
|
||
catch(OutOfMemoryError e){
|
||
|
||
System.err.println("Out of memory");
|
||
}
|
||
}
|
||
return logList;
|
||
}
|
||
}
|