From d44f9dd887aa2bcea77b570dba927bb3d2a48fc0 Mon Sep 17 00:00:00 2001
From: as <asalveter@gmail.com>
Date: Wed, 11 Mar 2015 10:54:50 +0100
Subject: [PATCH] split the AnomalyDetectionFilter: to an
 AnomalyDetectionFilter and NoAnomalyDetectionFilter

---
 .../opad/filter/AnomalyDetectionFilter.java   | 19 ++----
 .../opad/filter/NoAnomalyDetectionFilter.java | 65 +++++++++++++++++++
 2 files changed, 70 insertions(+), 14 deletions(-)
 create mode 100644 src/main/java/teetime/stage/opad/filter/NoAnomalyDetectionFilter.java

diff --git a/src/main/java/teetime/stage/opad/filter/AnomalyDetectionFilter.java b/src/main/java/teetime/stage/opad/filter/AnomalyDetectionFilter.java
index 3efa6342..081d044b 100644
--- a/src/main/java/teetime/stage/opad/filter/AnomalyDetectionFilter.java
+++ b/src/main/java/teetime/stage/opad/filter/AnomalyDetectionFilter.java
@@ -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);
 		}
 	}
 
diff --git a/src/main/java/teetime/stage/opad/filter/NoAnomalyDetectionFilter.java b/src/main/java/teetime/stage/opad/filter/NoAnomalyDetectionFilter.java
new file mode 100644
index 00000000..30f7cc34
--- /dev/null
+++ b/src/main/java/teetime/stage/opad/filter/NoAnomalyDetectionFilter.java
@@ -0,0 +1,65 @@
+/**
+ * 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);
+		}
+	}
+
+}
-- 
GitLab