/*-
 * APT - Analysis of Petri Nets and labeled Transition systems
 * Copyright (C) 2015       vsp
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package uniol.apt.tasks.parsers;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;

import uniol.apt.io.parser.Parser;

/**
 * A tester for parsers that implement the LTSParser interface.
 * @param <G> The type of object generated by the parser to test.
 * @author vsp
 */
public class ParserTester<G> extends AbstractParserTester {
	private final Parser<? extends G> parser;

	/**
	 * Construct a new tester
	 * @param parser The parser to test.
	 * @param outputDir The directory to create the output in.
	 * @throws FileNotFoundException If the given directory does not exist.
	 * @throws UnsupportedEncodingException If your Java installation is broken and does not support UTF-8.
	 */
	public ParserTester(Parser<? extends G> parser, File outputDir) throws FileNotFoundException, UnsupportedEncodingException {
		super(outputDir, parser.getClass().getSimpleName());
		this.parser = parser;
	}

	@Override
	public void parse(File file) throws Exception {
		this.parser.parseFile(file);
	}
}

// vim: ft=java:noet:sw=8:sts=8:ts=8:tw=120
