Package repast.simphony.data2
Class AbstractDataSetManager
- java.lang.Object
-
- repast.simphony.data2.AbstractDataSetManager
-
- All Implemented Interfaces:
DataSetManager
,RunListener
- Direct Known Subclasses:
BatchRunDataSetManager
,SingleRunDataSetManager
public abstract class AbstractDataSetManager extends Object implements DataSetManager, RunListener
Abstract implementation of a DataSetManager. This does scheduling and data collection on the master context.- Author:
- Nick Collier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractDataSetManager.ObjList
protected static class
AbstractDataSetManager.ScheduledDataSet
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,DataSetBuilder<?>>
builders
protected List<AbstractDataSetManager.ScheduledDataSet>
dataSets
-
Constructor Summary
Constructors Constructor Description AbstractDataSetManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataSet(DataSet dataSet, ScheduleParameters scheduleParams, boolean atEnd)
Adds a DataSet to this DataSetManager.void
addDataSetBuilder(DataSetBuilder<?> builder)
Adds a DataSetBuilder to this DataSetManager.void
clearDataSetBuilders()
Clears all the DataSetBuilder-s from this DataSetManager.void
clearDataSets()
Clears this data set manager of any added datasets.void
flush()
Notifies the DataSets managed by this DataSetManager to tell their DataSinks to flush any buffered data.BatchRunDataSource
getBatchRunDataSource()
Gets the BatchRunDataSource that this manager will auto update with the current run number.DataSetBuilder<?>
getDataSetBuilder(String id)
Gets the named DataSetBuilder.RandomSeedDataSource
getRandomSeedDataSource()
Gets the default data source for returning the current random seed.TickCountDataSource
getTickCountDataSource()
Gets the default data source for returning the tick count.void
paused()
Invoked when the current run has been paused.void
removeDataSetbuilder(String id)
Removes the specified DataSetBuilder.void
restarted()
Invoked when the current run has been restarted after a pause.void
runEnded(RunState runState, Object contextId)
Notifies this DataSetManager that an individual run has ended.void
runStarted(RunState runState, Object contextId, Parameters parameters)
Notifies this DataSetManager that an individual run has started.void
started()
Invoked when the current run has been started.void
stopped()
Invoked when the current run has been stopped.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface repast.simphony.data2.DataSetManager
batchEnded, batchStarted, isBatch
-
-
-
-
Field Detail
-
builders
protected Map<String,DataSetBuilder<?>> builders
-
dataSets
protected List<AbstractDataSetManager.ScheduledDataSet> dataSets
-
-
Method Detail
-
removeDataSetbuilder
public void removeDataSetbuilder(String id)
Description copied from interface:DataSetManager
Removes the specified DataSetBuilder.- Specified by:
removeDataSetbuilder
in interfaceDataSetManager
- Parameters:
id
- the id of the DataSetBuilder to remove.
-
clearDataSetBuilders
public void clearDataSetBuilders()
Description copied from interface:DataSetManager
Clears all the DataSetBuilder-s from this DataSetManager.- Specified by:
clearDataSetBuilders
in interfaceDataSetManager
-
getBatchRunDataSource
public BatchRunDataSource getBatchRunDataSource()
Gets the BatchRunDataSource that this manager will auto update with the current run number.- Specified by:
getBatchRunDataSource
in interfaceDataSetManager
- Returns:
- the BatchRunDataSource that this manager will auto update with the current run number.
-
getTickCountDataSource
public TickCountDataSource getTickCountDataSource()
Description copied from interface:DataSetManager
Gets the default data source for returning the tick count.- Specified by:
getTickCountDataSource
in interfaceDataSetManager
- Returns:
- the default data source for returning the tick count.
-
getRandomSeedDataSource
public RandomSeedDataSource getRandomSeedDataSource()
Description copied from interface:DataSetManager
Gets the default data source for returning the current random seed.- Specified by:
getRandomSeedDataSource
in interfaceDataSetManager
- Returns:
- the default data source for returning the current random seed.
-
addDataSet
public void addDataSet(DataSet dataSet, ScheduleParameters scheduleParams, boolean atEnd)
Description copied from interface:DataSetManager
Adds a DataSet to this DataSetManager.- Specified by:
addDataSet
in interfaceDataSetManager
- Parameters:
dataSet
- the DataSet to addscheduleParams
- the scheduling info for recording this dataset
-
flush
public void flush()
Notifies the DataSets managed by this DataSetManager to tell their DataSinks to flush any buffered data.- Specified by:
flush
in interfaceDataSetManager
-
clearDataSets
public void clearDataSets()
Clears this data set manager of any added datasets.
-
runStarted
public void runStarted(RunState runState, Object contextId, Parameters parameters)
Description copied from interface:DataSetManager
Notifies this DataSetManager that an individual run has started.- Specified by:
runStarted
in interfaceDataSetManager
- Parameters:
runState
- the current RunState -- run number etc can be retrieved from thatparameters
- the current model parameters
-
runEnded
public void runEnded(RunState runState, Object contextId)
Description copied from interface:DataSetManager
Notifies this DataSetManager that an individual run has ended.- Specified by:
runEnded
in interfaceDataSetManager
- Parameters:
runState
- the RunState of the run that just ended.
-
addDataSetBuilder
public void addDataSetBuilder(DataSetBuilder<?> builder)
Description copied from interface:DataSetManager
Adds a DataSetBuilder to this DataSetManager.- Specified by:
addDataSetBuilder
in interfaceDataSetManager
-
getDataSetBuilder
public DataSetBuilder<?> getDataSetBuilder(String id)
Description copied from interface:DataSetManager
Gets the named DataSetBuilder.- Specified by:
getDataSetBuilder
in interfaceDataSetManager
- Returns:
- the named DataSetBuilder.
-
stopped
public void stopped()
Description copied from interface:RunListener
Invoked when the current run has been stopped.- Specified by:
stopped
in interfaceRunListener
-
paused
public void paused()
Description copied from interface:RunListener
Invoked when the current run has been paused.- Specified by:
paused
in interfaceRunListener
-
started
public void started()
Description copied from interface:RunListener
Invoked when the current run has been started.- Specified by:
started
in interfaceRunListener
-
restarted
public void restarted()
Description copied from interface:RunListener
Invoked when the current run has been restarted after a pause.- Specified by:
restarted
in interfaceRunListener
-
-