Skip to content
Snippets Groups Projects
Commit 10625492 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Refactoring and comments

parent 90db4157
No related branches found
No related tags found
No related merge requests found
/***************************************************************************
* Copyright 2014 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 kieker.gui.model;
import java.util.ArrayList;
......
......@@ -29,6 +29,12 @@ public final class Cloner<T> extends AbstractConsumerStage<T> {
private final OutputPort<T> firstOutputPort = super.createOutputPort();
private final OutputPort<T> secondOutputPort = super.createOutputPort();
@Override
protected void execute(final T element) {
this.firstOutputPort.send(element);
this.secondOutputPort.send(element);
}
public OutputPort<T> getFirstOutputPort() {
return this.firstOutputPort;
}
......@@ -36,11 +42,4 @@ public final class Cloner<T> extends AbstractConsumerStage<T> {
public OutputPort<T> getSecondOutputPort() {
return this.secondOutputPort;
}
@Override
protected void execute(final T element) {
this.firstOutputPort.send(element);
this.secondOutputPort.send(element);
}
}
......@@ -25,6 +25,8 @@ import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort;
/**
* Aggregates incoming traces into trace equivalence classes.
*
* @author Nils Christian Ehmke
*/
public final class TraceAggregator extends AbstractConsumerStage<ExecutionEntry> {
......@@ -33,12 +35,12 @@ public final class TraceAggregator extends AbstractConsumerStage<ExecutionEntry>
private final Map<ExecutionEntry, AggregatedExecutionEntry> aggregationMap = new HashMap<>();
@Override
protected void execute(final ExecutionEntry execEntry) {
if (!this.aggregationMap.containsKey(execEntry)) {
final AggregatedExecutionEntry aggregatedExecutionEntry = new AggregatedExecutionEntry(execEntry);
this.aggregationMap.put(execEntry, aggregatedExecutionEntry);
protected void execute(final ExecutionEntry executionEntry) {
if (!this.aggregationMap.containsKey(executionEntry)) {
final AggregatedExecutionEntry aggregatedExecutionEntry = new AggregatedExecutionEntry(executionEntry);
this.aggregationMap.put(executionEntry, aggregatedExecutionEntry);
}
this.aggregationMap.get(execEntry).incrementCalls();
this.aggregationMap.get(executionEntry).incrementCalls();
}
@Override
......
......@@ -32,10 +32,11 @@ import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort;
/**
* Reconstruct traces based on the incoming instances of {@code IFlowRecord}. Currently only {@link TraceMetadata}, {@link BeforeOperationEvent} and {@link AfterOperationEvent} instances are supported.
* Reconstruct traces based on the incoming instances of {@code IFlowRecord}. Currently only {@link TraceMetadata}, {@link BeforeOperationEvent} and
* {@link AfterOperationEvent} instances are supported.
*
* @author Nils Christian Ehmke
*/
*/
public final class TraceReconstructor extends AbstractConsumerStage<IFlowRecord> {
private final OutputPort<ExecutionEntry> outputPort = super.createOutputPort();
......@@ -72,7 +73,7 @@ public final class TraceReconstructor extends AbstractConsumerStage<IFlowRecord>
return this.outputPort;
}
private final static class TraceBuffer {
private static final class TraceBuffer {
private final String hostname;
private final Deque<BeforeOperationEvent> stack = new LinkedList<>();
......
......@@ -5,11 +5,16 @@ import java.util.Observer;
import org.eclipse.swt.widgets.Tree;
class TreeUpdateObserver implements Observer {
/**
* An observer clearing an instance of {@link Tree}.
*
* @author Nils Christian Ehmke
*/
public final class ClearTreeObserver implements Observer {
private final Tree tree;
public TreeUpdateObserver(final Tree tree) {
public ClearTreeObserver(final Tree tree) {
this.tree = tree;
}
......@@ -18,4 +23,4 @@ class TreeUpdateObserver implements Observer {
this.tree.clearAll(true);
}
}
\ No newline at end of file
}
......@@ -208,7 +208,7 @@ public class MainWindow {
this.executionTracesTree.setHeaderVisible(true);
this.executionTracesTree.addListener(SWT.SetData, new ExecutionTracesTreeSetDataListener());
this.executionTracesTree.addSelectionListener(new ExecutionTraceTreeSelectionListener(this));
Properties.getInstance().addObserver(new TreeUpdateObserver(this.executionTracesTree));
Properties.getInstance().addObserver(new ClearTreeObserver(this.executionTracesTree));
this.tracesTreeContainerColumn = new TreeColumn(this.executionTracesTree, SWT.NONE);
this.tracesTreeContainerColumn.setWidth(100);
......@@ -301,7 +301,7 @@ public class MainWindow {
this.tree_1 = new Tree(this.sashForm, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL);
this.tree_1.setHeaderVisible(true);
this.tree_1.addListener(SWT.SetData, new AggregatedExecutionTracesTreeSetDataListener());
Properties.getInstance().addObserver(new TreeUpdateObserver(this.tree_1));
Properties.getInstance().addObserver(new ClearTreeObserver(this.tree_1));
this.treeColumn = new TreeColumn(this.tree_1, SWT.NONE);
this.treeColumn.setWidth(100);
......
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