Class TestDataSetSource

  • All Implemented Interfaces:
    de.gsi.dataset.DataSet, de.gsi.dataset.DataSetMetaData, de.gsi.dataset.event.EventSource, de.gsi.dataset.GridDataSet, java.io.Serializable

    public class TestDataSetSource
    extends de.gsi.dataset.spi.AbstractDataSet<TestDataSetSource>
    implements de.gsi.dataset.GridDataSet
    DataSet source for testing real-time continuous 2D and 3D type data.
    Author:
    rstein
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Timer audioTimer  
      protected int circIndex  
      protected it.unimi.dsi.fastutil.floats.FloatArrayList frame  
      protected int frameCount  
      protected int frameSize  
      protected it.unimi.dsi.fastutil.floats.FloatArrayList[] history  
      protected javax.sound.sampled.TargetDataLine line  
      protected de.gsi.dataset.utils.DoubleCircularBuffer lineBuffer  
      protected boolean paused  
      protected boolean running  
      protected int samplingRate  
      protected MidiWaveformSynthesizer synth  
      protected java.util.TimerTask taskDataUpdate  
      protected java.util.TimerTask traskAudioIO  
      protected int updatePeriod  
      protected java.util.Timer updateTimer  
      • Fields inherited from class de.gsi.dataset.spi.AbstractDataSet

        axisListener, dimension
      • Fields inherited from interface de.gsi.dataset.DataSet

        DIM_X, DIM_Y, DIM_Z
      • Fields inherited from interface de.gsi.dataset.DataSetMetaData

        TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void fillTestData()  
      double get​(int dimIndex, int index)  
      double get​(int dimIndex, int... indices)  
      protected java.util.TimerTask getAudioTimerTask()  
      int getDataCount()  
      protected java.util.TimerTask getDataUpdateTask()  
      int getFrameCount()  
      int getFrameSize()  
      double getGrid​(int dimIndex, int index)  
      int getGridIndex​(int dimIndex, double x)  
      TestDataSetSource.DataInput getInputSource()  
      int getSamplingRate()  
      int[] getShape()  
      int getUpdatePeriod()  
      double getValue​(int dimIndex, double... x)  
      boolean isOutputMuted()  
      static void main​(java.lang.String[] args)  
      protected void openLineIn()  
      void pause()
      pauses play back of the data source via the sound card
      protected void reinitializeData()  
      void reset()  
      de.gsi.dataset.DataSet set​(de.gsi.dataset.DataSet other, boolean copy)  
      void setFrameCount​(int frameCount)  
      void setFrameSize​(int frameSize)  
      void setInputSource​(TestDataSetSource.DataInput inputSource)  
      void setOutputMuted​(boolean state)  
      void setSamplingRate​(int samplingRate)  
      void setUpdatePeriod​(int updatePeriod)  
      void start()
      starts play back of the data source via the sound card
      void step()  
      void stop()
      stops and resets play back of the data source via the sound card
      • Methods inherited from class de.gsi.dataset.spi.AbstractDataSet

        addDataLabel, addDataStyle, autoNotification, binarySearch, binarySearch, clearMetaInfo, copyAxisDescription, copyDataLabelsAndStyles, copyMetaData, equalDataLabels, equalEditConstraints, equalErrorValues, equalMetaData, equals, equals, equalValues, fireInvalidated, getAxisDescriptions, getDataLabel, getDataLabelMap, getDataStyleMap, getDimension, getEditConstraints, getErrorList, getIndex, getInfoList, getMetaInfo, getName, getStyle, getThis, getValues, getWarningList, hashCode, lock, recomputeLimits, removeDataLabel, removeStyle, setEditConstraints, setName, toString, updateEventListener
      • Methods inherited from class de.gsi.dataset.spi.AbstractStylable

        getStyle, setStyle
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface de.gsi.dataset.DataSet

        getAxisDescription, getAxisDescriptions, getDataLabel, getDimension, getIndex, getName, getStyle, getStyle, getValues, lock, recomputeLimits, set, setStyle
      • Methods inherited from interface de.gsi.dataset.event.EventSource

        addListener, autoNotification, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener, updateEventListener
      • Methods inherited from interface de.gsi.dataset.GridDataSet

        getGridValues, getNGrid, getShape
    • Field Detail

      • line

        protected transient javax.sound.sampled.TargetDataLine line
      • lineBuffer

        protected transient de.gsi.dataset.utils.DoubleCircularBuffer lineBuffer
      • history

        protected it.unimi.dsi.fastutil.floats.FloatArrayList[] history
      • frame

        protected transient it.unimi.dsi.fastutil.floats.FloatArrayList frame
      • circIndex

        protected int circIndex
      • samplingRate

        protected int samplingRate
      • frameSize

        protected int frameSize
      • frameCount

        protected int frameCount
      • updatePeriod

        protected int updatePeriod
      • running

        protected volatile boolean running
      • paused

        protected volatile boolean paused
      • updateTimer

        protected transient java.util.Timer updateTimer
      • audioTimer

        protected transient java.util.Timer audioTimer
      • traskAudioIO

        protected transient java.util.TimerTask traskAudioIO
      • taskDataUpdate

        protected transient java.util.TimerTask taskDataUpdate
    • Constructor Detail

      • TestDataSetSource

        public TestDataSetSource()
    • Method Detail

      • openLineIn

        protected void openLineIn()
      • fillTestData

        public void fillTestData()
      • get

        public double get​(int dimIndex,
                          int index)
        Specified by:
        get in interface de.gsi.dataset.DataSet
      • getDataCount

        public int getDataCount()
        Specified by:
        getDataCount in interface de.gsi.dataset.DataSet
      • getFrameCount

        public int getFrameCount()
      • getFrameSize

        public int getFrameSize()
      • getSamplingRate

        public int getSamplingRate()
      • getUpdatePeriod

        public int getUpdatePeriod()
      • getValue

        public double getValue​(int dimIndex,
                               double... x)
        Specified by:
        getValue in interface de.gsi.dataset.DataSet
        Overrides:
        getValue in class de.gsi.dataset.spi.AbstractDataSet<TestDataSetSource>
      • isOutputMuted

        public boolean isOutputMuted()
      • pause

        public void pause()
        pauses play back of the data source via the sound card
      • reset

        public void reset()
      • setFrameCount

        public void setFrameCount​(int frameCount)
      • setFrameSize

        public void setFrameSize​(int frameSize)
      • setOutputMuted

        public void setOutputMuted​(boolean state)
      • setSamplingRate

        public void setSamplingRate​(int samplingRate)
      • setUpdatePeriod

        public void setUpdatePeriod​(int updatePeriod)
      • start

        public void start()
        starts play back of the data source via the sound card
      • step

        public void step()
      • stop

        public void stop()
        stops and resets play back of the data source via the sound card
      • getAudioTimerTask

        protected java.util.TimerTask getAudioTimerTask()
      • getDataUpdateTask

        protected java.util.TimerTask getDataUpdateTask()
      • reinitializeData

        protected void reinitializeData()
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • getShape

        public int[] getShape()
        Specified by:
        getShape in interface de.gsi.dataset.GridDataSet
      • getGrid

        public double getGrid​(int dimIndex,
                              int index)
        Specified by:
        getGrid in interface de.gsi.dataset.GridDataSet
      • getGridIndex

        public int getGridIndex​(int dimIndex,
                                double x)
        Specified by:
        getGridIndex in interface de.gsi.dataset.GridDataSet
      • get

        public double get​(int dimIndex,
                          int... indices)
        Specified by:
        get in interface de.gsi.dataset.GridDataSet
      • set

        public de.gsi.dataset.DataSet set​(de.gsi.dataset.DataSet other,
                                          boolean copy)
        Specified by:
        set in interface de.gsi.dataset.DataSet