Class PollingIStream

java.lang.Object
com.stuypulse.stuylib.streams.numbers.PollingIStream
All Implemented Interfaces:
IStream, AutoCloseable, DoubleSupplier

public class PollingIStream extends Object implements IStream, AutoCloseable
A PollingIStream calls IStream.get() every x milliseconds instead of when the user calls get
  • Constructor Details

    • PollingIStream

      public PollingIStream(IStream stream, double dt)
      Creates a PollingIStream from an IStream and a time value
      Parameters:
      stream - istream to poll from
      dt - Number of calls per second
  • Method Details

    • get

      public double get()
      Specified by:
      get in interface IStream
      Returns:
      next value in the stream
    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable