49 lines
1.2 KiB
Java
49 lines
1.2 KiB
Java
package testApplication;
|
|
|
|
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 logging.Algorithm
|
|
* @author MSchäfer
|
|
* DHBW Stuttgart/Campus Horb AI2008<br>
|
|
* <br>
|
|
*/
|
|
public class TestAlgorithm extends Algorithm{
|
|
|
|
public TestAlgorithm() {
|
|
super();
|
|
}
|
|
/**
|
|
* Creates a sum up algorithm.
|
|
* @param parameterArea the sum up parameter area the algorithm gets its parameters from
|
|
*/
|
|
public TestAlgorithm(TestParameterArea parameterArea){
|
|
super(parameterArea,"Test algorithm");
|
|
}
|
|
|
|
/**
|
|
* 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<TestLogElement>logList = new LogElementList<TestLogElement>();
|
|
for(int i=1;i<=10;i++){
|
|
try{
|
|
|
|
logList.add(new TestLogElement(i, "Value", i));
|
|
}
|
|
catch(OutOfMemoryError e){
|
|
|
|
System.err.println("Out of memory");
|
|
}
|
|
}
|
|
return logList;
|
|
}
|
|
}
|