Package mgui.interfaces.plots
Class PlotTimeSeriesDataSource<T extends MguiNumber>
java.lang.Object
mgui.interfaces.plots.PlotXYDataSource<T>
mgui.interfaces.plots.PlotTimeSeriesDataSource<T>
- Type Parameters:
T
- Number type for this data source
- All Implemented Interfaces:
InterfaceDataSource<T>
,InterfaceDataSourceTimeSeries<T>
,InterfaceDataSourceXY<T>
,NamedDataSource
- Direct Known Subclasses:
VariablePlotTimeSeriesDataSource
public class PlotTimeSeriesDataSource<T extends MguiNumber> extends PlotXYDataSource<T> implements InterfaceDataSourceTimeSeries<T>, NamedDataSource
A plot data source for XY data, with multiple named Y channels. Can be used as an
updatable time series data source.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<T>
x
protected java.util.ArrayList<T>
x_value
protected java.util.HashMap<java.lang.String,java.util.List<T>>
y
protected java.util.HashMap<java.lang.String,java.util.List<T>>
y_values
Fields inherited from class mgui.interfaces.plots.PlotXYDataSource
batch, cursor, emission, reset, sourceListeners, var_count, xy, xy_data
-
Constructor Summary
Constructors Constructor Description PlotTimeSeriesDataSource()
PlotTimeSeriesDataSource(int size, int var_count)
-
Method Summary
Modifier and Type Method Description protected void
fireEmission(int size)
Fires a source emission of sizesize
, and updates the cursor.int
getChannelCount()
Returns the number of Y channels in this source.java.util.ArrayList<java.lang.String>
getChannelNames()
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<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.java.util.List<T>
getSourceSignalY(java.lang.String channel)
java.util.List<T>
getY(java.lang.String name)
Returns the full set of Y data for the channel namedname
.void
setChannelNames(java.util.List<java.lang.String> names)
void
setX(java.util.ArrayList<T> x)
Copies the X data series to this data source.void
setY(java.lang.String name, java.util.ArrayList<T> data)
Sets the full set of Y data for the channel namedname
.void
setY(java.util.List<java.lang.String> names, java.util.ArrayList<java.util.ArrayList<T>> y)
Copies the complete Y data series to this data source.Methods inherited from class mgui.interfaces.plots.PlotXYDataSource
addDataSourceListener, appendChannel, fireReset, getChannelSize, getSourceSignalX, getSourceSignalXY, getSourceSignalXY, removeDataSourceListener, reset, setBatch, setX, setXY, setY
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface mgui.interfaces.io.InterfaceDataSource
addDataSourceListener, removeDataSourceListener
Methods inherited from interface mgui.interfaces.io.InterfaceDataSourceXY
getSourceSignalXY
-
Field Details
-
y
-
x
-
y_values
-
x_value
-
-
Constructor Details
-
PlotTimeSeriesDataSource
public PlotTimeSeriesDataSource() -
PlotTimeSeriesDataSource
public PlotTimeSeriesDataSource(int size, int var_count)
-
-
Method Details
-
setX
Copies the X data series to this data source.- Parameters:
x
-
-
setY
public void setY(java.util.List<java.lang.String> names, java.util.ArrayList<java.util.ArrayList<T>> y)Copies the complete Y data series to this data source.- Parameters:
y
-
-
setY
Sets the full set of Y data for the channel namedname
.- Parameters:
name
-data
-- Throws:
java.io.IOException
-
getSourceSignalY
Description copied from interface:InterfaceDataSourceTimeSeries
Returns the Y data corresponding to all channels.- Specified by:
getSourceSignalY
in interfaceInterfaceDataSourceTimeSeries<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>
- Overrides:
getSourceSignalX
in classPlotXYDataSource<T extends MguiNumber>
- Returns:
-
getSourceSignalY
Description copied from interface:InterfaceDataSourceXY
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>
- Overrides:
getSourceSignalY
in classPlotXYDataSource<T extends MguiNumber>
- Returns:
-
getSourceSignalY
- Overrides:
getSourceSignalY
in classPlotXYDataSource<T extends MguiNumber>
-
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>
- Overrides:
getSourceSignalAsBytes
in classPlotXYDataSource<T extends MguiNumber>
- Returns:
-
setChannelNames
public void setChannelNames(java.util.List<java.lang.String> names)- Specified by:
setChannelNames
in interfaceNamedDataSource
- Overrides:
setChannelNames
in classPlotXYDataSource<T extends MguiNumber>
-
getChannelCount
public int getChannelCount()Description copied from interface:InterfaceDataSourceXY
Returns the number of Y channels in this source.- Specified by:
getChannelCount
in interfaceInterfaceDataSourceTimeSeries<T extends MguiNumber>
- Specified by:
getChannelCount
in interfaceInterfaceDataSourceXY<T extends MguiNumber>
- Overrides:
getChannelCount
in classPlotXYDataSource<T extends MguiNumber>
- Returns:
-
getSourceSignalX
Description copied from interface:InterfaceDataSourceTimeSeries
Returns the X data for this source.- Specified by:
getSourceSignalX
in interfaceInterfaceDataSourceTimeSeries<T extends MguiNumber>
- Returns:
-
getSourceSignal
Description copied from interface:InterfaceDataSource
Returns a list of typeT
, representing a signal emission.- Specified by:
getSourceSignal
in interfaceInterfaceDataSource<T extends MguiNumber>
- Overrides:
getSourceSignal
in classPlotXYDataSource<T extends MguiNumber>
- Returns:
-
getChannelNames
public java.util.ArrayList<java.lang.String> getChannelNames()- Specified by:
getChannelNames
in interfaceNamedDataSource
- Overrides:
getChannelNames
in classPlotXYDataSource<T extends MguiNumber>
-
getY
Returns the full set of Y data for the channel namedname
.- Parameters:
name
-- Returns:
- Throws:
java.io.IOException
-
fireEmission
protected void fireEmission(int size)Description copied from class:PlotXYDataSource
Fires a source emission of sizesize
, and updates the cursor.- Overrides:
fireEmission
in classPlotXYDataSource<T extends MguiNumber>
-