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>xprotected java.util.List<java.util.List<T>>yFields 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 voiddataSourceEmission(DataSourceEvent event)Responds to a signal emission from a data source.voiddataSourceReset(DataSourceEvent event)Resets this listener in response to a reset of the data source.intgetChannelCount()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.voidsetData(java.util.List<T> data)Sets the data for this output stream.voidsetDataAsBytes(byte[] d)Sets the data for this output stream as a byte array.voidsetXData(java.util.List<T> x)Sets the X value for this output streamvoidsetYData(int i, java.util.List<T> data)Sets the Y data for the i'th channels of this output stream.voidsetYData(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, removeInputStreamListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mgui.interfaces.io.DataInputStream
addInputStreamListener, close, removeInputStreamListenerMethods 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:DataInputStreamXYReturns the Y data for the i'th channel, as typeT.- Specified by:
getYDatain interfaceDataInputStreamXY<T extends MguiNumber>- Returns:
- Throws:
java.io.IOException
-
getYData
Description copied from interface:DataInputStreamXYReturns the Y data for all channels, as a list of typeT.- Specified by:
getYDatain interfaceDataInputStreamXY<T extends MguiNumber>- Returns:
- Throws:
java.io.IOException
-
setXData
Description copied from interface:DataOutputStreamXYSets the X value for this output stream- Specified by:
setXDatain interfaceDataOutputStreamXY<T extends MguiNumber>- Throws:
java.io.IOException
-
setYData
Description copied from interface:DataOutputStreamXYSets the Y data for all channels of this output stream.- Specified by:
setYDatain interfaceDataOutputStreamXY<T extends MguiNumber>- Throws:
java.io.IOException
-
setYData
Description copied from interface:DataOutputStreamXYSets the Y data for the i'th channels of this output stream.- Specified by:
setYDatain interfaceDataOutputStreamXY<T extends MguiNumber>- Throws:
java.io.IOException- if there is no i'th channel
-
dataSourceEmission
Description copied from interface:DataSourceListenerResponds to a signal emission from a data source.- Specified by:
dataSourceEmissionin interfaceDataSourceListener- Overrides:
dataSourceEmissionin classDataBridge<T extends MguiNumber>
-
dataSourceReset
Description copied from interface:DataSourceListenerResets this listener in response to a reset of the data source.- Specified by:
dataSourceResetin interfaceDataSourceListener
-
getData
Description copied from interface:DataInputStreamReturns a sample of the current state of this input stream.- Specified by:
getDatain interfaceDataInputStream<T extends MguiNumber>- Returns:
- Throws:
java.io.IOException
-
getDataAsBytes
public byte[] getDataAsBytes() throws java.io.IOExceptionDescription copied from interface:DataInputStreamReturns a sample of the current state of this stream as a byte array.- Specified by:
getDataAsBytesin interfaceDataInputStream<T extends MguiNumber>- Returns:
- Throws:
java.io.IOException
-
setData
Description copied from interface:DataOutputStreamSets the data for this output stream.- Specified by:
setDatain interfaceDataOutputStream<T extends MguiNumber>- Throws:
java.io.IOException
-
setDataAsBytes
public void setDataAsBytes(byte[] d) throws java.io.IOExceptionDescription copied from interface:DataOutputStreamSets the data for this output stream as a byte array.- Specified by:
setDataAsBytesin interfaceDataOutputStream<T extends MguiNumber>- Throws:
java.io.IOException
-
getChannelCount
public int getChannelCount()Description copied from interface:DataInputStreamXYReturns the number of Y channels in this stream.- Specified by:
getChannelCountin interfaceDataInputStreamXY<T extends MguiNumber>- Specified by:
getChannelCountin interfaceDataOutputStreamXY<T extends MguiNumber>- Returns:
-
getXData
Description copied from interface:DataInputStreamXYReturns the X data as a value of typeT.- Specified by:
getXDatain interfaceDataInputStreamXY<T extends MguiNumber>- Returns:
- Throws:
java.io.IOException
-