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 boolean
batch
protected int
cursor
protected boolean
emission
protected java.lang.String
last_channel_added
protected java.lang.String
last_channel_changed
protected java.lang.String
last_channel_removed
protected java.util.HashMap<java.lang.String,MatrixInt>
matrix_map
protected boolean
reset
protected java.util.ArrayList<DataSourceListener>
sourceListeners
-
Constructor Summary
Constructors Constructor Description MatrixPlotDataSource()
-
Method Summary
Modifier and Type Method Description void
addDataSourceListener(DataSourceListener l)
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.java.util.List<java.lang.String>
getChannelNames()
MatrixInt
getMatrix(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.void
removeChannel(java.lang.String channel)
Removes a channel for this data source.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
setChannel(MatrixInt matrix)
Sets a channel for this data source; uses the object's name as the channel name.void
setChannelNames(java.util.List<java.lang.String> names)
void
variableValuesUpdated(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:InterfaceDataSource
Returns a list of typeT
, representing a signal emission.- Specified by:
getSourceSignal
in interfaceInterfaceDataSource<MguiDouble>
- Returns:
-
getSourceSignalAsBytes
public byte[] getSourceSignalAsBytes()Description copied from interface:InterfaceDataSource
Returns an array of bytes, representing a signal emission.- Specified by:
getSourceSignalAsBytes
in interfaceInterfaceDataSource<MguiDouble>
- Returns:
-
addDataSourceListener
- Specified by:
addDataSourceListener
in interfaceInterfaceDataSource<MguiDouble>
-
removeDataSourceListener
- Specified by:
removeDataSourceListener
in interfaceInterfaceDataSource<MguiDouble>
-
getChannelNames
public java.util.List<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
-
variableValuesUpdated
Description copied from interface:VariableListener
Called when a variable's values are updated- Specified by:
variableValuesUpdated
in 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
-
-