Class GuiDataStore

  • All Implemented Interfaces:
    uk.ac.starlink.ttools.plot2.data.DataStore

    public class GuiDataStore
    extends java.lang.Object
    implements uk.ac.starlink.ttools.plot2.data.DataStore
    DataStore wrapper implementation suitable for use from a GUI application. This wrapper does two things.

    First, it checks for thread interruptions regularly, and stops dispensing tuples from the data store if in case of interruption. The thread interruption status is undisturbed, and clients should in general check the interuption status of the thread following use of an instance of this class.

    Second, it optionally updates a progress bar as tuples are read. For this to work, it needs to know up front (at least a guess for) how many tuples will be read in total over the lifetime of the store.

    Since:
    15 Nov 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      GuiDataStore​(uk.ac.starlink.ttools.plot2.data.DataStore base)
      Constructs a data store that checks for interruptions.
      GuiDataStore​(uk.ac.starlink.ttools.plot2.data.DataStore base, javax.swing.BoundedRangeModel progModel, long tupleCount)
      Constructs a data store that checks for interruptions and optionally reports progress.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      uk.ac.starlink.ttools.plot2.data.TupleRunner getTupleRunner()  
      uk.ac.starlink.ttools.plot2.data.TupleSequence getTupleSequence​(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)  
      boolean hasData​(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GuiDataStore

        public GuiDataStore​(uk.ac.starlink.ttools.plot2.data.DataStore base)
        Constructs a data store that checks for interruptions.
        Parameters:
        base - data store to which most behaviour will be delegated
      • GuiDataStore

        public GuiDataStore​(uk.ac.starlink.ttools.plot2.data.DataStore base,
                            javax.swing.BoundedRangeModel progModel,
                            long tupleCount)
        Constructs a data store that checks for interruptions and optionally reports progress. If progBar is null or tupleCount is negative, there will be no progress updating, but the interruption handling will still take place.
        Parameters:
        base - base data store to which most behaviour is delegated
        progModel - progress bar model, or null
        tupleCount - total number of tuples expected to be read during the life of this data store; -1 may be supplied if not known
    • Method Detail

      • hasData

        public boolean hasData​(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)
        Specified by:
        hasData in interface uk.ac.starlink.ttools.plot2.data.DataStore
      • getTupleSequence

        public uk.ac.starlink.ttools.plot2.data.TupleSequence getTupleSequence​(uk.ac.starlink.ttools.plot2.data.DataSpec dataSpec)
        Specified by:
        getTupleSequence in interface uk.ac.starlink.ttools.plot2.data.DataStore
      • getTupleRunner

        public uk.ac.starlink.ttools.plot2.data.TupleRunner getTupleRunner()
        Specified by:
        getTupleRunner in interface uk.ac.starlink.ttools.plot2.data.DataStore