Package org.jcsp.util

Class ZeroBuffer<T>

    • Constructor Detail

      • ZeroBuffer

        public ZeroBuffer()
    • Method Detail

      • get

        public T get()
        Returns the Object from the ZeroBuffer.

        Pre-condition: getState must not currently return EMPTY.

        Specified by:
        get in interface ChannelDataStore<T>
        Returns:
        the Object from the ZeroBuffer
      • startGet

        public T startGet()
        Begins an extended rendezvous - simply returns the next object in the buffer. This function does not remove the object. Pre-condition: getState must not currently return EMPTY.
        Specified by:
        startGet in interface ChannelDataStore<T>
        Returns:
        The object in the buffer.
        See Also:
        ChannelDataStore.endGet()
      • put

        public void put​(T value)
        Puts a new Object into the ZeroBuffer.

        Pre-condition: getState must not currently return FULL.

        Specified by:
        put in interface ChannelDataStore<T>
        Parameters:
        value - the Object to put into the ZeroBuffer
      • getState

        public int getState()
        Returns the current state of the ZeroBuffer.
        Specified by:
        getState in interface ChannelDataStore<T>
        Returns:
        the current state of the ZeroBuffer (EMPTY or FULL)
      • clone

        public Object clone()
        Returns a new (and EMPTY) ZeroBuffer with the same creation parameters as this one.

        Note: Only the size and structure of the ZeroBuffer is cloned, not any stored data.

        Specified by:
        clone in interface ChannelDataStore<T>
        Overrides:
        clone in class Object
        Returns:
        the cloned instance of this ZeroBuffer.