Commit 62ee09f2 authored by Sören Henning's avatar Sören Henning

refactored PrinterStage

parent 3b6d6154
package anomalydetection;
import java.io.PrintStream;
import java.util.Formatter;
import anomalydetection.measurement.AnomalyScoredMeasurement;
import teetime.framework.AbstractConsumerStage;
public class PrinterStage extends AbstractConsumerStage<AnomalyScoredMeasurement> {
private final PrintStream stream;
public PrinterStage() {
this.stream = System.out;
}
public PrinterStage(final PrintStream stream) {
this.stream = stream;
}
@Override
protected void execute(final AnomalyScoredMeasurement measurement) {
System.out.println(measurement.getTime() + "::" + measurement.getValue()
+ "::" + measurement.getPrediction() + "::" + measurement.getAnomalyScore());
Formatter formatter = new Formatter();
formatter.format("T: %s | M: %6f | P: %6f | S: %6f", measurement.getTime(), measurement.getValue(), measurement.getPrediction(),
measurement.getAnomalyScore());
this.stream.println(formatter.toString());
formatter.close();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment