Commit c133d655 authored by Sören Henning's avatar Sören Henning

refactored configuration

parent bf2d4afb
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/performancetest/java"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="conf"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/performancetest/java"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="conf">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
This diff is collapsed.
package anomalydetection;
import kieker.analysis.util.AbstractBiCombinerStage;
import anomalydetection.measurement.ForecastedMeassurement;
import anomalydetection.measurement.Measurement;
import anomalydetection.util.AbstractBiCombinerStage;
import teetime.framework.OutputPort;
public class MeasurementForecastDecorationStage extends AbstractBiCombinerStage<Double, Measurement> {
......
package anomalydetection.kieker;
import kieker.analysis.stage.tracediagnosis.Filter;
import anomalydetection.util.Filter;
import teetime.framework.CompositeStage;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
......
package anomalydetection.util;
import java.util.LinkedList;
import java.util.Queue;
import teetime.framework.AbstractStage;
import teetime.framework.InputPort;
public abstract class AbstractBiCombinerStage<I, J> extends AbstractStage {
protected final InputPort<I> inputPort1 = this.createInputPort();
protected final InputPort<J> inputPort2 = this.createInputPort();
private final Queue<I> elements1 = new LinkedList<>();
private final Queue<J> elements2 = new LinkedList<>();
public final InputPort<I> getInputPort1() {
return this.inputPort1;
}
public final InputPort<J> getInputPort2() {
return this.inputPort2;
}
@Override
protected void execute() {
final I element1 = this.getInputPort1().receive();
if (element1 != null) {
elements1.add(element1);
}
final J element2 = this.getInputPort2().receive();
if (element2 != null) {
elements2.add(element2);
}
if (elements1.size() > 0 && elements2.size() > 0) {
this.combine(elements1.poll(), elements2.poll());
}
}
protected abstract void combine(final I element1, final J element2);
}
/***************************************************************************
* Copyright 2015 Kieker Project (http://kieker-monitoring.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 anomalydetection.util;
import java.util.function.Predicate;
import teetime.stage.basic.AbstractTransformation;
/**
* This stage filters incoming objects and forwards only those which meet the given predicate.
*
* @author Nils Christian Ehmke
*
* @param <T>
* The precise type of the incoming and outgoing object.
*/
public final class Filter<T> extends AbstractTransformation<T, T> {
private final Predicate<T> predicate;
public Filter(final Predicate<T> predicate) {
this.predicate = predicate;
}
@Override
protected void execute(final T element) {
if (this.predicate.test(element)) {
super.getOutputPort().send(element);
}
}
}
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