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 size size, 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 type T, 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

      protected java.util.ArrayList<DataSourceListener> sourceListeners
    • xy_data

      protected java.util.HashMap<java.lang.String,​java.util.List<XYData<T extends MguiNumber>>> xy_data
    • xy

      protected java.util.HashMap<java.lang.String,​java.util.List<XYData<T extends MguiNumber>>> 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

      public java.util.List<T> getSourceSignal()
      Description copied from interface: InterfaceDataSource
      Returns a list of type T, representing a signal emission.
      Specified by:
      getSourceSignal in interface InterfaceDataSource<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 interface InterfaceDataSource<T extends MguiNumber>
      Returns:
    • getChannelSize

      public int getChannelSize​(java.lang.String channel)
    • getSourceSignalXY

      public java.util.List<XYData<T>> getSourceSignalXY​(int i)
      Description copied from interface: InterfaceDataSourceXY
      Returns the X-Y data corresponding to this signal's i'th channel.
      Specified by:
      getSourceSignalXY in interface InterfaceDataSourceXY<T extends MguiNumber>
      Returns:
    • getSourceSignalX

      public java.util.List<T> getSourceSignalX​(int i)
      Description copied from interface: InterfaceDataSourceXY
      Returns the X data corresponding to this signal's i'th channel.
      Specified by:
      getSourceSignalX in interface InterfaceDataSourceXY<T extends MguiNumber>
      Returns:
    • getSourceSignalY

      public java.util.List<T> getSourceSignalY​(int i)
      Description copied from interface: InterfaceDataSourceXY
      Returns the Y data corresponding to this signal's i'th channel.
      Specified by:
      getSourceSignalY in interface InterfaceDataSourceXY<T extends MguiNumber>
      Returns:
    • getSourceSignalXY

      public java.util.List<XYData<T>> getSourceSignalXY​(java.lang.String channel)
    • getSourceSignalX

      public java.util.List<T> getSourceSignalX​(java.lang.String channel)
    • getSourceSignalY

      public java.util.List<T> getSourceSignalY​(java.lang.String channel)
    • setChannelNames

      public void setChannelNames​(java.util.List<java.lang.String> names)
      Specified by:
      setChannelNames in interface NamedDataSource
    • getChannelNames

      public java.util.List<java.lang.String> getChannelNames()
      Specified by:
      getChannelNames in interface NamedDataSource
    • getChannelCount

      public int getChannelCount()
      Description copied from interface: InterfaceDataSourceXY
      Returns the number of Y channels in this source.
      Specified by:
      getChannelCount in interface InterfaceDataSourceXY<T extends MguiNumber>
      Returns:
    • addDataSourceListener

      public void addDataSourceListener​(DataSourceListener l)
      Specified by:
      addDataSourceListener in interface InterfaceDataSource<T extends MguiNumber>
    • removeDataSourceListener

      public void removeDataSourceListener​(DataSourceListener l)
      Specified by:
      removeDataSourceListener in interface InterfaceDataSource<T extends MguiNumber>
    • setX

      public void setX​(java.lang.String channel, java.util.List<T> x)
    • setY

      public void setY​(java.lang.String channel, java.util.List<T> y)
    • appendChannel

      protected java.util.List<XYData<T>> appendChannel​(java.lang.String channel, int size)
    • setXY

      public void setXY​(java.lang.String channel, java.util.List<XYData<T>> new_xy)
    • 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 with b == false.
      Parameters:
      b -
    • reset

      public void reset() throws java.io.IOException
      Resets this data source.
      Throws:
      java.io.IOException
    • fireEmission

      protected void fireEmission​(int size)
      Fires a source emission of size size, 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.