Package mgui.interfaces.plots
Class PlotXYDataSource<T extends MguiNumber>
java.lang.Object
mgui.interfaces.plots.PlotXYDataSource<T>
- All Implemented Interfaces:
InterfaceDataSource<T>
,InterfaceDataSourceXY<T>
,NamedDataSource
- Direct Known Subclasses:
PlotTimeSeriesDataSource
,VariablePlotXYDataSource
public class PlotXYDataSource<T extends MguiNumber> extends java.lang.Object implements InterfaceDataSourceXY<T>, NamedDataSource
Plot data source for X-Y data sets.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected boolean
batch
protected int
cursor
protected boolean
emission
protected boolean
reset
protected java.util.ArrayList<DataSourceListener>
sourceListeners
protected int
var_count
protected java.util.HashMap<java.lang.String,java.util.List<XYData<T>>>
xy
protected java.util.HashMap<java.lang.String,java.util.List<XYData<T>>>
xy_data
-
Constructor Summary
Constructors Constructor Description PlotXYDataSource()
PlotXYDataSource(int var_count)
-
Method Summary
Modifier and Type Method Description void
addDataSourceListener(DataSourceListener l)
protected java.util.List<XYData<T>>
appendChannel(java.lang.String channel, int size)
protected void
fireEmission(int size)
Fires a source emission of sizesize
, and updates the cursor.protected void
fireReset()
Informs listeners that this data source has been reset (i.e., the XY signal history should be destroyed.int
getChannelCount()
Returns the number of Y channels in this source.java.util.List<java.lang.String>
getChannelNames()
int
getChannelSize(java.lang.String channel)
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(int i)
Returns the X data corresponding to this signal's i'th channel.java.util.List<T>
getSourceSignalX(java.lang.String 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<XYData<T>>
getSourceSignalXY(java.lang.String channel)
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)
void
removeDataSourceListener(DataSourceListener l)
void
reset()
Resets this data source.void
setBatch(boolean b)
Informs this data source to treat all subsequent operations as a batch job; i.e., do not fire any events.void
setChannelNames(java.util.List<java.lang.String> names)
void
setX(java.lang.String channel, java.util.List<T> x)
void
setXY(java.lang.String channel, java.util.List<XYData<T>> new_xy)
void
setY(java.lang.String channel, java.util.List<T> y)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
batch
protected boolean batch -
emission
protected boolean emission -
reset
protected boolean reset -
sourceListeners
-
xy_data
-
xy
-
cursor
protected int cursor -
var_count
protected int var_count
-
-
Constructor Details
-
PlotXYDataSource
public PlotXYDataSource() -
PlotXYDataSource
public PlotXYDataSource(int var_count)
-
-
Method Details
-
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:
-
getChannelSize
public int getChannelSize(java.lang.String channel) -
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:
-
getSourceSignalY
Description copied from interface:InterfaceDataSourceXY
Returns the Y data corresponding to this signal's i'th channel.- Specified by:
getSourceSignalY
in interfaceInterfaceDataSourceXY<T extends MguiNumber>
- Returns:
-
getSourceSignalXY
-
getSourceSignalX
-
getSourceSignalY
-
setChannelNames
public void setChannelNames(java.util.List<java.lang.String> names)- Specified by:
setChannelNames
in interfaceNamedDataSource
-
getChannelNames
public java.util.List<java.lang.String> getChannelNames()- Specified by:
getChannelNames
in interfaceNamedDataSource
-
getChannelCount
public int getChannelCount()Description copied from interface:InterfaceDataSourceXY
Returns the number of Y channels in this source.- Specified by:
getChannelCount
in interfaceInterfaceDataSourceXY<T extends MguiNumber>
- Returns:
-
addDataSourceListener
- Specified by:
addDataSourceListener
in interfaceInterfaceDataSource<T extends MguiNumber>
-
removeDataSourceListener
- Specified by:
removeDataSourceListener
in interfaceInterfaceDataSource<T extends MguiNumber>
-
setX
-
setY
-
appendChannel
-
setXY
-
setBatch
public void setBatch(boolean b)Informs this data source to treat all subsequent operations as a batch job; i.e., do not fire any events. Events will be fired, if necessary, when this method is called withb == false
.- Parameters:
b
-
-
reset
public void reset() throws java.io.IOExceptionResets this data source.- Throws:
java.io.IOException
-
fireEmission
protected void fireEmission(int size)Fires a source emission of sizesize
, and updates the cursor.- Parameters:
size
-
-
fireReset
protected void fireReset()Informs listeners that this data source has been reset (i.e., the XY signal history should be destroyed.
-