Class PollingVStream

java.lang.Object
com.stuypulse.stuylib.streams.vectors.PollingVStream
All Implemented Interfaces:
VStream, Supplier<Vector2D>

public class PollingVStream extends Object implements VStream
A PollingVStream is a VStream but its .get() method is called for you at a certain rate. This contains race conditions.
  • Constructor Details

    • PollingVStream

      public PollingVStream(VStream stream, double dt)
      Creates a PollingVStream from an VStream and a time value
      Parameters:
      stream - VStream to poll from
      dt - time inbetween each poll
  • Method Details

    • get

      public Vector2D get()
      Specified by:
      get in interface Supplier<Vector2D>
      Specified by:
      get in interface VStream
      Returns:
      next value in the stream
    • finalize

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

      public void close()