Package mgui.interfaces.plots
Class MatrixPlotDataSource
java.lang.Object
mgui.interfaces.plots.MatrixPlotDataSource
- All Implemented Interfaces:
InterfaceDataSource<MguiDouble>,NamedDataSource,VariableListener
public class MatrixPlotDataSource extends java.lang.Object implements InterfaceDataSource<MguiDouble>, VariableListener, NamedDataSource
Data source representing a MatrixInt object.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected booleanbatchprotected intcursorprotected booleanemissionprotected java.lang.Stringlast_channel_addedprotected java.lang.Stringlast_channel_changedprotected java.lang.Stringlast_channel_removedprotected java.util.HashMap<java.lang.String,MatrixInt>matrix_mapprotected booleanresetprotected java.util.ArrayList<DataSourceListener>sourceListeners -
Constructor Summary
Constructors Constructor Description MatrixPlotDataSource() -
Method Summary
Modifier and Type Method Description voidaddDataSourceListener(DataSourceListener l)protected voidfireEmission(int size)Fires a source emission of sizesize, and updates the cursor.protected voidfireReset()Informs listeners that this data source has been reset (i.e., the XY signal history should be destroyed.java.util.List<java.lang.String>getChannelNames()MatrixIntgetMatrix(java.lang.String channel)Return the matrix corresponding tochannel.java.util.List<MguiDouble>getSourceSignal()Returns a list of typeT, representing a signal emission.byte[]getSourceSignalAsBytes()Returns an array of bytes, representing a signal emission.voidremoveChannel(java.lang.String channel)Removes a channel for this data source.voidremoveDataSourceListener(DataSourceListener l)voidreset()Resets this data source.voidsetBatch(boolean b)Informs this data source to treat all subsequent operations as a batch job; i.e., do not fire any events.voidsetChannel(MatrixInt matrix)Sets a channel for this data source; uses the object's name as the channel name.voidsetChannelNames(java.util.List<java.lang.String> names)voidvariableValuesUpdated(VariableEvent e)Called when a variable's values are updatedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
matrix_map
-
sourceListeners
-
last_channel_changed
protected java.lang.String last_channel_changed -
last_channel_removed
protected java.lang.String last_channel_removed -
last_channel_added
protected java.lang.String last_channel_added -
batch
protected boolean batch -
emission
protected boolean emission -
reset
protected boolean reset -
cursor
protected int cursor
-
-
Constructor Details
-
MatrixPlotDataSource
public MatrixPlotDataSource()
-
-
Method Details
-
getMatrix
Return the matrix corresponding tochannel.- Parameters:
channel-- Returns:
-
getSourceSignal
Description copied from interface:InterfaceDataSourceReturns a list of typeT, representing a signal emission.- Specified by:
getSourceSignalin interfaceInterfaceDataSource<MguiDouble>- Returns:
-
getSourceSignalAsBytes
public byte[] getSourceSignalAsBytes()Description copied from interface:InterfaceDataSourceReturns an array of bytes, representing a signal emission.- Specified by:
getSourceSignalAsBytesin interfaceInterfaceDataSource<MguiDouble>- Returns:
-
addDataSourceListener
- Specified by:
addDataSourceListenerin interfaceInterfaceDataSource<MguiDouble>
-
removeDataSourceListener
- Specified by:
removeDataSourceListenerin interfaceInterfaceDataSource<MguiDouble>
-
getChannelNames
public java.util.List<java.lang.String> getChannelNames()- Specified by:
getChannelNamesin interfaceNamedDataSource
-
setChannelNames
public void setChannelNames(java.util.List<java.lang.String> names)- Specified by:
setChannelNamesin interfaceNamedDataSource
-
variableValuesUpdated
Description copied from interface:VariableListenerCalled when a variable's values are updated- Specified by:
variableValuesUpdatedin interfaceVariableListener
-
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. -
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
-
setChannel
Sets a channel for this data source; uses the object's name as the channel name. If a channel by this name doesn't already exist, creates it; otherwise overwrites it. Finally, fires an emission event to alert listeners of this change.- Parameters:
matrix-
-
removeChannel
public void removeChannel(java.lang.String channel)Removes a channel for this data source.- Parameters:
channel-
-