gov.sandia.cognition.learning.experiment
Class AbstractLearningExperiment

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.experiment.AbstractLearningExperiment
All Implemented Interfaces:
LearningExperiment, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
AbstractValidationFoldExperiment, LearnerRepeatExperiment, OnlineLearnerValidationExperiment

public abstract class AbstractLearningExperiment
extends AbstractCloneableSerializable
implements LearningExperiment

The AbstractLearningExperiment class implements the general functionality of the LearningExperiment interface, which is mainly the handling of listeners and firing of events.

Since:
2.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  LinkedList<LearningExperimentListener> listeners
          The listeners for the experiment.
 
Constructor Summary
AbstractLearningExperiment()
          Creates a new instance of AbstractLearningExperiment.
 
Method Summary
 void addListener(LearningExperimentListener listener)
          Adds the given listener to this object.
protected  void fireExperimentEnded()
          Fires the experimentEnded event for all listeners.
protected  void fireExperimentStarted()
          Fires the experimentStarted event for all listeners.
protected  void fireTrialEnded()
          Fires the trialEnded event for all listeners.
protected  void fireTrialStarted()
          Fires the trialStarted event for all listeners.
 LinkedList<LearningExperimentListener> getListeners()
          Gets the listeners for this experiment.
 void removeListener(LearningExperimentListener listener)
          Removes the given listener from this object.
protected  void setListeners(LinkedList<LearningExperimentListener> listeners)
          Sets the listeners for this experiment.
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.experiment.LearningExperiment
getNumTrials
 

Field Detail

listeners

protected transient LinkedList<LearningExperimentListener> listeners
The listeners for the experiment.

Constructor Detail

AbstractLearningExperiment

public AbstractLearningExperiment()
Creates a new instance of AbstractLearningExperiment.

Method Detail

addListener

public void addListener(LearningExperimentListener listener)
Description copied from interface: LearningExperiment
Adds the given listener to this object.

Specified by:
addListener in interface LearningExperiment
Parameters:
listener - The listener to add.

removeListener

public void removeListener(LearningExperimentListener listener)
Description copied from interface: LearningExperiment
Removes the given listener from this object.

Specified by:
removeListener in interface LearningExperiment
Parameters:
listener - The listener to remove.

fireExperimentStarted

protected void fireExperimentStarted()
Fires the experimentStarted event for all listeners.


fireExperimentEnded

protected void fireExperimentEnded()
Fires the experimentEnded event for all listeners.


fireTrialStarted

protected void fireTrialStarted()
Fires the trialStarted event for all listeners.


fireTrialEnded

protected void fireTrialEnded()
Fires the trialEnded event for all listeners.


getListeners

public LinkedList<LearningExperimentListener> getListeners()
Gets the listeners for this experiment.

Returns:
The list of listeners for this experiment.

setListeners

protected void setListeners(LinkedList<LearningExperimentListener> listeners)
Sets the listeners for this experiment.

Parameters:
listeners - The listeners for this experiment.