Class WriteLock<T>

  • Type Parameters:
    T - Datatype

    public class WriteLock<T>
    extends java.lang.Object
    A dataclass for storing a value, and if it should be written out or not
    • Field Summary

      Fields 
      Modifier and Type Field Description
      T value  
      boolean write  
    • Constructor Summary

      Constructors 
      Constructor Description
      WriteLock()
      Create a WriteLock
      WriteLock​(T defaultValue)
      Create a WriteLock with a default value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T consume()
      Get the value, and set write to false
      void write​(T value)
      Write a value and enable reading
      void zero()
      Set to defaults
      • Methods inherited from class java.lang.Object

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

      • write

        public boolean write
      • value

        public T value
    • Constructor Detail

      • WriteLock

        public WriteLock()
        Create a WriteLock
      • WriteLock

        public WriteLock​(T defaultValue)
        Create a WriteLock with a default value
        Parameters:
        defaultValue - Default value
    • Method Detail

      • zero

        public void zero()
        Set to defaults
      • write

        public void write​(T value)
        Write a value and enable reading
        Parameters:
        value - Value
      • consume

        public T consume()
        Get the value, and set write to false
        Returns:
        Value