/**
 * 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 two output ports, 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 AnomalyDetectionFilter extends AbstractConsumerStage<StorableDetectionResult> {

	/**
	 * The output port delivering the normalyscore if it remains below
	 * the threshhold.
	 */
	private final OutputPort<StorableDetectionResult> outputPortNormal = this.createOutputPort();

	/**
	 * The output port delivering the annromalyscore if it exceeds the
	 * threshhold.
	 */
	private final OutputPort<StorableDetectionResult> outputPortAnnormal = this.createOutputPort();

	private final double threshold;

	public OutputPort<StorableDetectionResult> getOutputPortNormal() {
		return outputPortNormal;
	}

	public OutputPort<StorableDetectionResult> getOutputPortAnnormal() {
		return outputPortAnnormal;
	}

	public double getThreshold() {
		return threshold;
	}

	/**
	 *
	 * @param threshold
	 */
	public AnomalyDetectionFilter(final double threshold) {
		super();
		this.threshold = threshold;
	}

	@Override
	protected void execute(final StorableDetectionResult element) {
		if (element.getValue() >= threshold) {
			outputPortAnnormal.send(element);
		} else {
			outputPortNormal.send(element);
		}
	}
}

@@ -931,15 +931,8 @@
 ype 
-%7B@link 
 Stor
@@ -950,17 +950,16 @@
 onResult
-%7D
  and cha
@@ -1446,28 +1446,24 @@
 ult%3E %7B%0A%0A%09/**
-%0A%09 *
  The output 
@@ -1488,17 +1488,17 @@
 e normal
-y
+ 
 score if
@@ -1514,20 +1514,16 @@
 ns below
-%0A%09 *
  the thr
@@ -1521,31 +1521,28 @@
 w the thresh
-h
 old.
-%0A%09
  */%0A%09private
@@ -1633,20 +1633,16 @@
 );%0A%0A%09/**
-%0A%09 *
  The out
@@ -1670,16 +1670,16 @@
 he a
-nnromaly
+bnormal 
 scor
@@ -1701,26 +1701,19 @@
  the
-%0A%09 *
  thresh
-h
 old.
-%0A%09
  */%0A
@@ -2110,16 +2110,8 @@
 %09/**
-%0A%09 *%0A%09 *
  @pa
@@ -2123,18 +2123,16 @@
 hreshold
-%0A%09
  */%0A%09pub

fix jdoc