package nl.tudelft.simulation.xml.dsol;
import java.io.IOException;
import java.net.URL;
import nl.tudelft.simulation.dsol.experiment.ExperimentalFrame;
import nl.tudelft.simulation.event.Event;
import nl.tudelft.simulation.event.EventListenerInterface;
import nl.tudelft.simulation.event.EventType;
import nl.tudelft.simulation.logger.Logger;
/**
* A ExperimentParsingThread
* (c) copyright 2002-2005 Delft University of Technology , the
* Netherlands.
* See for project information www.simulation.tudelft.nl
* License of use: Lesser General Public License (LGPL) , no
* warranty.
* @version 1.0 Mar 2, 2004
* @author Peter Jacobs
*/
public class ExperimentParsingThread extends Thread
{
/** EXPERIMENT_PARSED_EVENT */
public static final EventType EXPERIMENT_PARSED_EVENT = new EventType("EXPERIMENT_PARSED_EVENT");
/** the owning listener. */
protected EventListenerInterface source = null;
/** the experiment. */
protected URL experiment = null;
/**
* constructs a new ExperimentParsingThread
* @param source the source of this thread
* @param experiment the experiment to parse
*/
public ExperimentParsingThread(final EventListenerInterface source, final URL experiment)
{
super("ExperimentParsingThread");
this.source = source;
this.experiment = experiment;
}
/** {@inheritDoc} */
@Override
public void run()
{
try
{
ExperimentalFrame experimentalFrame = ExperimentParser.parseExperimentalFrame(this.experiment);
this.source.notify(new Event(EXPERIMENT_PARSED_EVENT, this, experimentalFrame));
}
catch (IOException exception)
{
Logger.warning(this, "run", exception);
}
}
}