Enum DisabledBuffer

  • All Implemented Interfaces:
    Buffer<java.lang.Object>, java.io.Serializable, java.lang.Comparable<DisabledBuffer>

    enum DisabledBuffer
    extends java.lang.Enum<DisabledBuffer>
    implements Buffer<java.lang.Object>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      INSTANCE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DisabledBuffer()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void drainTo​(java.util.function.Consumer<java.lang.Object> consumer)
      Drains the buffer, sending each element to the consumer for processing.
      int offer​(java.lang.Object e)
      Inserts the specified element into this buffer if it is possible to do so immediately without violating capacity restrictions.
      int reads()
      Returns the number of elements that have been read from the buffer.
      int size()
      Returns the number of elements residing in the buffer.
      static DisabledBuffer valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static DisabledBuffer[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      int writes()
      Returns the number of elements that have been written to the buffer.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DisabledBuffer

        private DisabledBuffer()
    • Method Detail

      • values

        public static DisabledBuffer[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DisabledBuffer c : DisabledBuffer.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DisabledBuffer valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • offer

        public int offer​(java.lang.Object e)
        Description copied from interface: Buffer
        Inserts the specified element into this buffer if it is possible to do so immediately without violating capacity restrictions. The addition is allowed to fail spuriously if multiple threads insert concurrently.
        Specified by:
        offer in interface Buffer<java.lang.Object>
        Parameters:
        e - the element to add
        Returns:
        1 if the buffer is full, -1 if the CAS failed, or 0 if added
      • drainTo

        public void drainTo​(java.util.function.Consumer<java.lang.Object> consumer)
        Description copied from interface: Buffer
        Drains the buffer, sending each element to the consumer for processing. The caller must ensure that a consumer has exclusive read access to the buffer.
        Specified by:
        drainTo in interface Buffer<java.lang.Object>
        Parameters:
        consumer - the action to perform on each element
      • size

        public int size()
        Description copied from interface: Buffer
        Returns the number of elements residing in the buffer.
        Specified by:
        size in interface Buffer<java.lang.Object>
        Returns:
        the number of elements in this buffer
      • reads

        public int reads()
        Description copied from interface: Buffer
        Returns the number of elements that have been read from the buffer.
        Specified by:
        reads in interface Buffer<java.lang.Object>
        Returns:
        the number of elements read from this buffer
      • writes

        public int writes()
        Description copied from interface: Buffer
        Returns the number of elements that have been written to the buffer.
        Specified by:
        writes in interface Buffer<java.lang.Object>
        Returns:
        the number of elements written to this buffer