cz.cuni.pogamut.experiments
Class ExperimentDescriptor

java.lang.Object
  extended by cz.cuni.pogamut.experiments.ExperimentDescriptor
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BasicExperimentDescriptor

public abstract class ExperimentDescriptor
extends java.lang.Object
implements java.io.Serializable

Data class holding settings for execution of experiment. For example:

NOTE: ExperimentDescriptor can be serialized and send ower network to remote computers. If this happens createExperiment() will allways be called on the remote computer.

See Also:
Serialized Form

Field Summary
private  java.lang.ClassLoader classLoader
           
private  double experimentSpeed
           
protected  java.util.Collection listeners
           
protected  java.util.logging.Logger logger
          Logger that should be used as the default logger for the experiment.
protected  java.lang.String name
          Name used for GUI, log file etc.
private  java.io.File outputDirectory
          Path to the directory, where to save the results.
protected  java.util.List<Parameter> parameters
          Parameters of the experiment
protected  boolean recordReplay
           
 
Constructor Summary
ExperimentDescriptor()
          Creates a new instance of ExperimentDescriptor
 
Method Summary
 void addExperimentStateListener(FlagListener<ExperimentExecutionState> listener)
          Register listeners on execution state of the experiment.
 void addParameter(Parameter param)
          Add experiment parameter of the configuration.
 void clearParameters()
          Delete all parameters from the configuration.
abstract  Experiment createExperiment(UTServer server)
          Factory method creating and initializing the experiment on host computer.
 java.lang.ClassLoader getClassLoader()
           
 double getExperimentSpeed()
           
 java.util.Collection<FlagListener<ExperimentExecutionState>> getExperimentStateListeners()
           
 java.util.logging.Logger getLogger()
           
 java.lang.String getName()
           
 java.util.List<Parameter> getParameters()
          Returns object that is inside the object!
protected  void init()
           
 boolean isRecordReplay()
           
private  void readObject(java.io.ObjectInputStream in)
          Deserialization...
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 void setExperimentSpeed(double experimentSpeed)
           
 void setLogger(java.util.logging.Logger logger)
          Set logger that should be used as the default logger for the experiment.
 void setName(java.lang.String name)
           
 void setParameters(Parameter[] parameters)
          Set parameters of the configuration, clears all previous parameters.
 void setRecordReplay(boolean record)
          If set to true then a replay with the mach will be saved on the server.
private  void writeObject(java.io.ObjectOutputStream out)
          Serialization...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected transient java.util.Collection listeners

name

protected java.lang.String name
Name used for GUI, log file etc.


parameters

protected java.util.List<Parameter> parameters
Parameters of the experiment


outputDirectory

private java.io.File outputDirectory
Path to the directory, where to save the results.


logger

protected transient java.util.logging.Logger logger
Logger that should be used as the default logger for the experiment. It null then experiment will create it's own logger.


experimentSpeed

private double experimentSpeed

recordReplay

protected boolean recordReplay

classLoader

private java.lang.ClassLoader classLoader
Constructor Detail

ExperimentDescriptor

public ExperimentDescriptor()
Creates a new instance of ExperimentDescriptor

Method Detail

createExperiment

public abstract Experiment createExperiment(UTServer server)
Factory method creating and initializing the experiment on host computer. Implementation can be: return new MyExperiment(this, world);

Parameters:
world - World where the experiment will be running.
Returns:
Experiment configured by this descriptor and UTWorld.

addExperimentStateListener

public void addExperimentStateListener(FlagListener<ExperimentExecutionState> listener)
Register listeners on execution state of the experiment.


getExperimentStateListeners

public java.util.Collection<FlagListener<ExperimentExecutionState>> getExperimentStateListeners()

init

protected void init()

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Deserialization...

Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Serialization...

Throws:
java.io.IOException

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getParameters

public java.util.List<Parameter> getParameters()
Returns object that is inside the object! NOT A COPY!


setRecordReplay

public void setRecordReplay(boolean record)
If set to true then a replay with the mach will be saved on the server. Filename of the replay will be the name of the experiment.

Parameters:
record -

isRecordReplay

public boolean isRecordReplay()
Returns:
true if the replay should be recorded.

setParameters

public void setParameters(Parameter[] parameters)
Set parameters of the configuration, clears all previous parameters.

Parameters:
parameters -

clearParameters

public void clearParameters()
Delete all parameters from the configuration.


addParameter

public void addParameter(Parameter param)
Add experiment parameter of the configuration.

Parameters:
param -

getLogger

public java.util.logging.Logger getLogger()

setLogger

public void setLogger(java.util.logging.Logger logger)
Set logger that should be used as the default logger for the experiment. It null then experiment will create it's own logger. Logger is transient, it won't work when serialized/deserialized (eg. when send over network).


getClassLoader

public java.lang.ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Parameters:
classLoader - classloader used for loading all resources in the experiment

getExperimentSpeed

public double getExperimentSpeed()

setExperimentSpeed

public void setExperimentSpeed(double experimentSpeed)