Package mgui.interfaces.io
Class DataBridgeXY<T extends MguiNumber>
java.lang.Object
mgui.interfaces.io.DataBridge<T>
mgui.interfaces.io.DataBridgeXY<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
DataInputStream<T>
,DataInputStreamXY<T>
,DataOutputStream<T>
,DataOutputStreamXY<T>
,DataSourceListener
- Direct Known Subclasses:
DataBridgeNamedXY
public class DataBridgeXY<T extends MguiNumber> extends DataBridge<T> implements DataInputStreamXY<T>, DataOutputStreamXY<T>
Acts as a data bridge for XY data, where X holds a single value and each Y
channel has an array of values corresponding to that X.
- 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.List<java.util.List<T>>
y
Fields inherited from class mgui.interfaces.io.DataBridge
closed, inputListeners
-
Constructor Summary
Constructors Constructor Description DataBridgeXY(int size)
DataBridgeXY(int size, T initial_value)
-
Method Summary
Modifier and Type Method Description void
dataSourceEmission(DataSourceEvent event)
Responds to a signal emission from a data source.void
dataSourceReset(DataSourceEvent event)
Resets this listener in response to a reset of the data source.int
getChannelCount()
Returns the number of Y channels in this stream.java.util.List<T>
getData()
Returns a sample of the current state of this input stream.byte[]
getDataAsBytes()
Returns a sample of the current state of this stream as a byte array.java.util.List<T>
getXData()
Returns the X data as a value of typeT
.java.util.List<java.util.List<T>>
getYData()
Returns the Y data for all channels, as a list of typeT
.java.util.List<T>
getYData(int i)
Returns the Y data for the i'th channel, as typeT
.void
setData(java.util.List<T> data)
Sets the data for this output stream.void
setDataAsBytes(byte[] d)
Sets the data for this output stream as a byte array.void
setXData(java.util.List<T> x)
Sets the X value for this output streamvoid
setYData(int i, java.util.List<T> data)
Sets the Y data for the i'th channels of this output stream.void
setYData(java.util.List<java.util.List<T>> data)
Sets the Y data for all channels of this output stream.Methods inherited from class mgui.interfaces.io.DataBridge
addInputStreamListener, close, fireListeners, removeInputStreamListener
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.DataInputStream
addInputStreamListener, close, removeInputStreamListener
Methods inherited from interface mgui.interfaces.io.DataOutputStream
close
-
Field Details
-
x
-
y
-
-
Constructor Details
-
DataBridgeXY
public DataBridgeXY(int size) -
DataBridgeXY
-
-
Method Details
-
getYData
Description copied from interface:DataInputStreamXY
Returns the Y data for the i'th channel, as typeT
.- Specified by:
getYData
in interfaceDataInputStreamXY<T extends MguiNumber>
- Returns:
- Throws:
java.io.IOException
-
getYData
Description copied from interface:DataInputStreamXY
Returns the Y data for all channels, as a list of typeT
.- Specified by:
getYData
in interfaceDataInputStreamXY<T extends MguiNumber>
- Returns:
- Throws:
java.io.IOException
-
setXData
Description copied from interface:DataOutputStreamXY
Sets the X value for this output stream- Specified by:
setXData
in interfaceDataOutputStreamXY<T extends MguiNumber>
- Throws:
java.io.IOException
-
setYData
Description copied from interface:DataOutputStreamXY
Sets the Y data for all channels of this output stream.- Specified by:
setYData
in interfaceDataOutputStreamXY<T extends MguiNumber>
- Throws:
java.io.IOException
-
setYData
Description copied from interface:DataOutputStreamXY
Sets the Y data for the i'th channels of this output stream.- Specified by:
setYData
in interfaceDataOutputStreamXY<T extends MguiNumber>
- Throws:
java.io.IOException
- if there is no i'th channel
-
dataSourceEmission
Description copied from interface:DataSourceListener
Responds to a signal emission from a data source.- Specified by:
dataSourceEmission
in interfaceDataSourceListener
- Overrides:
dataSourceEmission
in classDataBridge<T extends MguiNumber>
-
dataSourceReset
Description copied from interface:DataSourceListener
Resets this listener in response to a reset of the data source.- Specified by:
dataSourceReset
in interfaceDataSourceListener
-
getData
Description copied from interface:DataInputStream
Returns a sample of the current state of this input stream.- Specified by:
getData
in interfaceDataInputStream<T extends MguiNumber>
- Returns:
- Throws:
java.io.IOException
-
getDataAsBytes
public byte[] getDataAsBytes() throws java.io.IOExceptionDescription copied from interface:DataInputStream
Returns a sample of the current state of this stream as a byte array.- Specified by:
getDataAsBytes
in interfaceDataInputStream<T extends MguiNumber>
- Returns:
- Throws:
java.io.IOException
-
setData
Description copied from interface:DataOutputStream
Sets the data for this output stream.- Specified by:
setData
in interfaceDataOutputStream<T extends MguiNumber>
- Throws:
java.io.IOException
-
setDataAsBytes
public void setDataAsBytes(byte[] d) throws java.io.IOExceptionDescription copied from interface:DataOutputStream
Sets the data for this output stream as a byte array.- Specified by:
setDataAsBytes
in interfaceDataOutputStream<T extends MguiNumber>
- Throws:
java.io.IOException
-
getChannelCount
public int getChannelCount()Description copied from interface:DataInputStreamXY
Returns the number of Y channels in this stream.- Specified by:
getChannelCount
in interfaceDataInputStreamXY<T extends MguiNumber>
- Specified by:
getChannelCount
in interfaceDataOutputStreamXY<T extends MguiNumber>
- Returns:
-
getXData
Description copied from interface:DataInputStreamXY
Returns the X data as a value of typeT
.- Specified by:
getXData
in interfaceDataInputStreamXY<T extends MguiNumber>
- Returns:
- Throws:
java.io.IOException
-