Package mgui.models.environments
Class AbstractEnvironmentDataSource<T extends MguiNumber>
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.models.environments.AbstractEnvironmentDataSource<T>
- Type Parameters:
T
- Number type for this data source
- All Implemented Interfaces:
InterfaceObject
,InterfaceDataSource<T>
,InterfaceDataSourceTimeSeries<T>
,InterfaceDataSourceXY<T>
,NamedDataSource
,NamedObject
,TreeObject
,CleanableObject
,DynamicModelEnvironmentSensor
- Direct Known Subclasses:
SimpleEnvironmentInputDataSource
,SimpleEnvironmentObservableDataSource
public abstract class AbstractEnvironmentDataSource<T extends MguiNumber> extends AbstractInterfaceObject implements InterfaceDataSourceTimeSeries<T>, DynamicModelEnvironmentSensor, NamedDataSource
Serves as a data source updated by a
DynamicModelEnvironment
.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected T
clock
protected int
index
protected boolean
isDestroyed
NameMap
names
protected java.util.ArrayList<T>
signal
protected java.util.ArrayList<DataSourceListener>
sourceListeners
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
tree_nodes
-
Constructor Summary
Constructors Constructor Description AbstractEnvironmentDataSource()
-
Method Summary
Modifier and Type Method Description void
addDataSourceListener(DataSourceListener l)
void
destroy()
Destroy this object (prepare it to be removed from memory)protected void
fireEmission()
protected void
fireReset()
java.util.ArrayList<java.lang.String>
getChannelNames()
int
getIndex()
java.lang.String
getName()
Gets the name for this object.java.util.List<T>
getSourceSignal()
Returns a list of typeT
, representing a signal emission.byte[]
getSourceSignalAsBytes()
Returns an array of bytes, representing a signal emission.java.util.List<T>
getSourceSignalX()
Returns the X data for this source.java.util.List<T>
getSourceSignalX(int i)
Returns the X data corresponding to this signal's i'th channel.java.util.List<XYData<T>>
getSourceSignalXY(int i)
Returns the X-Y data corresponding to this signal's i'th channel.java.util.List<java.util.List<T>>
getSourceSignalY()
Returns the Y data corresponding to all channels.java.util.List<T>
getSourceSignalY(int i)
Returns the Y data corresponding to this signal's i'th channel.boolean
isDestroyed()
Test whether this object has been destroyedvoid
removeDataSourceListener(DataSourceListener l)
void
reset()
void
setChannelNames(java.util.List<java.lang.String> names)
void
setIndex(int i)
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, getTreeLabel, issueTreeNode, setName, setTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface mgui.interfaces.util.CleanableObject
clean
Methods inherited from interface mgui.models.dynamic.DynamicModelEnvironmentSensor
stimulate
Methods inherited from interface mgui.interfaces.io.InterfaceDataSourceTimeSeries
getChannelCount
Methods inherited from interface mgui.interfaces.NamedObject
setName
Methods inherited from interface mgui.interfaces.trees.TreeObject
getTreeLabel, issueTreeNode, setTreeNode
-
Field Details
-
names
-
signal
-
clock
-
index
protected int index -
sourceListeners
-
isDestroyed
protected boolean isDestroyed
-
-
Constructor Details
-
AbstractEnvironmentDataSource
public AbstractEnvironmentDataSource()
-
-
Method Details
-
getIndex
public int getIndex()- Specified by:
getIndex
in interfaceDynamicModelEnvironmentSensor
-
setIndex
public void setIndex(int i)- Specified by:
setIndex
in interfaceDynamicModelEnvironmentSensor
-
getSourceSignal
Description copied from interface:InterfaceDataSource
Returns a list of typeT
, representing a signal emission.- Specified by:
getSourceSignal
in interfaceInterfaceDataSource<T extends MguiNumber>
- Returns:
-
getSourceSignalAsBytes
public byte[] getSourceSignalAsBytes()Description copied from interface:InterfaceDataSource
Returns an array of bytes, representing a signal emission.- Specified by:
getSourceSignalAsBytes
in interfaceInterfaceDataSource<T extends MguiNumber>
- Returns:
-
getChannelNames
public java.util.ArrayList<java.lang.String> getChannelNames()- Specified by:
getChannelNames
in interfaceNamedDataSource
-
setChannelNames
public void setChannelNames(java.util.List<java.lang.String> names)- Specified by:
setChannelNames
in interfaceNamedDataSource
-
addDataSourceListener
- Specified by:
addDataSourceListener
in interfaceInterfaceDataSource<T extends MguiNumber>
-
removeDataSourceListener
- Specified by:
removeDataSourceListener
in interfaceInterfaceDataSource<T extends MguiNumber>
-
fireEmission
protected void fireEmission() -
fireReset
protected void fireReset() -
reset
public void reset()- Specified by:
reset
in interfaceDynamicModelEnvironmentSensor
-
getSourceSignalX
Description copied from interface:InterfaceDataSourceTimeSeries
Returns the X data for this source.- Specified by:
getSourceSignalX
in interfaceInterfaceDataSourceTimeSeries<T extends MguiNumber>
- Returns:
-
getSourceSignalY
Description copied from interface:InterfaceDataSourceTimeSeries
Returns the Y data corresponding to this signal's i'th channel.- Specified by:
getSourceSignalY
in interfaceInterfaceDataSourceTimeSeries<T extends MguiNumber>
- Specified by:
getSourceSignalY
in interfaceInterfaceDataSourceXY<T extends MguiNumber>
- Returns:
-
getSourceSignalY
Description copied from interface:InterfaceDataSourceTimeSeries
Returns the Y data corresponding to all channels.- Specified by:
getSourceSignalY
in interfaceInterfaceDataSourceTimeSeries<T extends MguiNumber>
- Returns:
-
getSourceSignalXY
Description copied from interface:InterfaceDataSourceXY
Returns the X-Y data corresponding to this signal's i'th channel.- Specified by:
getSourceSignalXY
in interfaceInterfaceDataSourceXY<T extends MguiNumber>
- Returns:
-
getSourceSignalX
Description copied from interface:InterfaceDataSourceXY
Returns the X data corresponding to this signal's i'th channel.- Specified by:
getSourceSignalX
in interfaceInterfaceDataSourceXY<T extends MguiNumber>
- Returns:
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceDynamicModelEnvironmentSensor
- Specified by:
getName
in interfaceNamedObject
- Overrides:
getName
in classAbstractInterfaceObject
- Returns:
-
destroy
public void destroy()Description copied from interface:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
- Overrides:
destroy
in classAbstractInterfaceObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObject
Test whether this object has been destroyed- Specified by:
isDestroyed
in interfaceInterfaceObject
- Overrides:
isDestroyed
in classAbstractInterfaceObject
- Returns:
-