Class RollingBuffer<T extends RollingBuffer.Resettable>


  • public abstract class RollingBuffer<T extends RollingBuffer.Resettable>
    extends java.lang.Object
    Acts like forever growing T[], but internally uses a circular buffer to reuse instances of T.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  RollingBuffer.Resettable
      Implement to reset an instance
    • Constructor Summary

      Constructors 
      Constructor Description
      RollingBuffer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void freeBefore​(int pos)  
      T get​(int pos)
      Get T instance for this absolute position; this is allowed to be arbitrarily far "in the future" but cannot be before the last freeBefore.
      int getMaxPos()
      Returns the maximum position looked up, or -1 if no position has been looked up sinc reset/init.
      void reset()  
      • Methods inherited from class java.lang.Object

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

      • RollingBuffer

        public RollingBuffer()
    • Method Detail

      • reset

        public void reset()
      • get

        public T get​(int pos)
        Get T instance for this absolute position; this is allowed to be arbitrarily far "in the future" but cannot be before the last freeBefore.
      • getMaxPos

        public int getMaxPos()
        Returns the maximum position looked up, or -1 if no position has been looked up sinc reset/init.
      • freeBefore

        public void freeBefore​(int pos)