<commit_before>/***************************************************************************
 * Copyright 2012 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.test.tools.util.graph;

import kieker.analysis.plugin.annotation.Plugin;
import kieker.analysis.plugin.filter.forward.ListCollectionFilter;
import kieker.common.configuration.Configuration;
import kieker.tools.traceAnalysis.filter.visualization.graph.AbstractGraph;

/**
 * A plugin which receives one or more graphs and stores them for later access. This plugin is primarily
 * intended for unit tests of graph-producing plugins.
 * 
 * @author <NAME>
 * 
 */
@Plugin(description = "A plugin that receives one or more graphs and provides access them via methods.")
public class GraphReceiverPlugin extends ListCollectionFilter<AbstractGraph<?, ?, ?>> {

	/**
	 * The name of the input port which receives graphs.
	 */
	public static final String INPUT_PORT_NAME_GRAPHS = ListCollectionFilter.INPUT_PORT_NAME;

	/**
	 * Creates a new receiver plugin with the given configuration.
	 * 
	 * @param configuration
	 *            The configuration to use
	 */
	public GraphReceiverPlugin(final Configuration configuration) {
		super(configuration);
	}

	/**
	 * Returns the number of graphs received so far.
	 * 
	 * @return See above
	 */
	public int getNumberOfReceivedGraphs() {
		return this.size();
	}

	/**
	 * Returns the first received graph, if any.
	 * 
	 * @return See above
	 */
	@SuppressWarnings("unchecked")
	public <T extends AbstractGraph<?, ?, ?>> T getFirstGraph() {
		return (T) this.getList().get(0); // using getGraphAt leads to a compile error, probably caused by a javac bug
	}
<commit_msg>Added a nicer workaround for javac bug<commit_after>/***************************************************************************
 * Copyright 2012 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.test.tools.util.graph;

import kieker.analysis.plugin.annotation.Plugin;
import kieker.analysis.plugin.filter.forward.ListCollectionFilter;
import kieker.common.configuration.Configuration;
import kieker.tools.traceAnalysis.filter.visualization.graph.AbstractGraph;

/**
 * A plugin which receives one or more graphs and stores them for later access. This plugin is primarily
 * intended for unit tests of graph-producing plugins.
 * 
 * @author <NAME>
 * 
 */
@Plugin(description = "A plugin that receives one or more graphs and provides access them via methods.")
public class GraphReceiverPlugin extends ListCollectionFilter<AbstractGraph<?, ?, ?>> {

	/**
	 * The name of the input port which receives graphs.
	 */
	public static final String INPUT_PORT_NAME_GRAPHS = ListCollectionFilter.INPUT_PORT_NAME;

	/**
	 * Creates a new receiver plugin with the given configuration.
	 * 
	 * @param configuration
	 *            The configuration to use
	 */
	public GraphReceiverPlugin(final Configuration configuration) {
		super(configuration);
	}

	/**
	 * Returns the number of graphs received so far.
	 * 
	 * @return See above
	 */
	public int getNumberOfReceivedGraphs() {
		return this.size();
	}

	/**
	 * Returns the first received graph, if any.
	 * 
	 * @return See above
	 */
	public <T extends AbstractGraph<?, ?, ?>> T getFirstGraph() {
		return this.<T> getGraphAt(0); // Explicit bound is required to work around a possible javac bug
	}

{'fraction_non_alphanumeric': 0.1480598309126382, 'fraction_numerical': 0.0039020160416215043, 'mean_word_length': 4.255125284738041, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5106935', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1132, 'n_words': 453}