Skip to content
Snippets Groups Projects
Commit d44f9dd8 authored by as's avatar as
Browse files

split the AnomalyDetectionFilter: to an AnomalyDetectionFilter and NoAnomalyDetectionFilter

parent 24e95192
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ import kieker.tools.opad.record.StorableDetectionResult;
/**
*
* This filter separates input values by their reach of a certain threshold (parameter). It takes events of type {@link StorableDetectionResult} and channels them
* into two output ports, depending on whether the threshold was reached or not. This filter has configuration properties for the (critical) threshold. Although the
* into the output port, depending on whether the threshold was reached or not. This filter has configuration properties for the (critical) threshold. Although the
* configuration of the critical threshold is possible, the value is currently not used by the filter.
*
* @author Tillmann Carlos Bielefeld, Thomas Duellmann, Tobias Rudolph, Arne Jan Salveter
......@@ -33,23 +33,16 @@ import kieker.tools.opad.record.StorableDetectionResult;
*/
public class AnomalyDetectionFilter extends AbstractConsumerStage<StorableDetectionResult> {
/** The output port delivering the normal score if it remains below the threshold. */
private final OutputPort<StorableDetectionResult> outputPortNormal = this.createOutputPort();
/** The output port delivering the abnormal score if it exceeds or equals the threshold. */
private final OutputPort<StorableDetectionResult> outputPortAnnormal = this.createOutputPort();
private final OutputPort<StorableDetectionResult> outputPort = this.createOutputPort();
/** Name of the property determining the threshold. */
public static final String CONFIG_PROPERTY_NAME_THRESHOLD = "threshold";
private final double threshold;
public OutputPort<StorableDetectionResult> getOutputPortNormal() {
return outputPortNormal;
}
public OutputPort<StorableDetectionResult> getOutputPortAnnormal() {
return outputPortAnnormal;
public OutputPort<StorableDetectionResult> getOutputPort() {
return outputPort;
}
public double getThreshold() {
......@@ -65,9 +58,7 @@ public class AnomalyDetectionFilter extends AbstractConsumerStage<StorableDetect
@Override
protected void execute(final StorableDetectionResult element) {
if (element.getValue() >= threshold) {
outputPortAnnormal.send(element);
} else {
outputPortNormal.send(element);
outputPort.send(element);
}
}
......
/**
* Copyright (C) 2015 TeeTime (http://teetime.sourceforge.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package teetime.stage.opad.filter;
import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort;
import kieker.tools.opad.record.StorableDetectionResult;
/**
*
* This filter separates input values by their reach of a certain threshold (parameter). It takes events of type {@link StorableDetectionResult} and channels them
* into the output port, depending on whether the threshold was reached or not. This filter has configuration properties for the (critical) threshold. Although the
* configuration of the critical threshold is possible, the value is currently not used by the filter.
*
* @author Tillmann Carlos Bielefeld, Thomas Duellmann, Tobias Rudolph, Arne Jan Salveter
* @since 1.10
*
*/
public class NoAnomalyDetectionFilter extends AbstractConsumerStage<StorableDetectionResult> {
/** The output port delivering the normal score if it remains below the threshold. */
private final OutputPort<StorableDetectionResult> outputPort = this.createOutputPort();
/** Name of the property determining the threshold. */
public static final String CONFIG_PROPERTY_NAME_THRESHOLD = "threshold";
private final double threshold;
public OutputPort<StorableDetectionResult> getOutputPort() {
return outputPort;
}
public double getThreshold() {
return threshold;
}
/** @param threshold */
public NoAnomalyDetectionFilter(final double threshold) {
super();
this.threshold = threshold;
}
@Override
protected void execute(final StorableDetectionResult element) {
if (element.getValue() < threshold) {
outputPort.send(element);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment