<commit_before>package kieker.analysisteetime.trace.traversal;

import kieker.analysisteetime.model.analysismodel.trace.OperationCall;
import kieker.analysisteetime.model.analysismodel.trace.TraceRoot;

public class TraceTraverser {

	// TODO Make this generic for aggregated traces

	public TraceTraverser() {}

	public void traverse(final TraceRoot trace, final OperationCallVisitor visitor) {
		this.handleOperationCallsRecursively(trace.getRootOperationCall(), visitor);
	}

	private void handleOperationCallsRecursively(final OperationCall operationCall, final OperationCallVisitor visitor) {
		visitor.visit(operationCall);
		for (final OperationCall childOperationCall : operationCall.getChildren()) {
			this.handleOperationCallsRecursively(childOperationCall, visitor);
		}
	}

}<commit_msg>allowing multiple visitors per traverser<commit_after>package kieker.analysisteetime.trace.traversal;

import java.util.Collection;
import java.util.Collections;

import kieker.analysisteetime.model.analysismodel.trace.OperationCall;
import kieker.analysisteetime.model.analysismodel.trace.TraceRoot;

public class TraceTraverser {

	// TODO Make this generic for aggregated traces

	public TraceTraverser() {}

	public void traverse(final TraceRoot trace, final OperationCallVisitor visitor) {
		final Collection<OperationCallVisitor> visitors = Collections.singleton(visitor);
		this.handleOperationCallsRecursively(trace.getRootOperationCall(), visitors);
	}

	public void traverse(final TraceRoot trace, final Collection<OperationCallVisitor> visitors) {
		this.handleOperationCallsRecursively(trace.getRootOperationCall(), visitors);
	}

	private void handleOperationCallsRecursively(final OperationCall operationCall, final Collection<OperationCallVisitor> visitors) {
		for (final OperationCallVisitor visitor : visitors) {
			visitor.visit(operationCall);
		}

		for (final OperationCall childOperationCall : operationCall.getChildren()) {
			this.handleOperationCallsRecursively(childOperationCall, visitors);
		}
	}

}
{'fraction_non_alphanumeric': 0.07840236686390532, 'fraction_numerical': 0.0, 'mean_word_length': 7.083665338645418, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3753848', 'n_tokens_mistral': 574, 'n_tokens_neox': 545, 'n_words': 115}