Class NGNetwork.MessageVector

  • Enclosing class:
    NGNetwork

    final class NGNetwork.MessageVector
    extends Object
    • Field Detail

      • elementData

        private Message[] elementData
        The array buffer into which the components of the vector are stored. The capacity of the vector is the length of this array buffer, and is at least large enough to contain all the vector's elements.

        Any array elements following the last element in the Vector are null.

      • elementCount

        private int elementCount
        The number of valid components in this MessageVector object.
      • current

        private int current
        The actual item in this MessageVector object.
    • Constructor Detail

      • MessageVector

        public MessageVector()
        Constructs an empty vector with the specified initial capacity and capacity increment.
    • Method Detail

      • nextMessage

        public Message nextMessage()
      • size

        public int size()
        Returns the number of message in this vector.
        Returns:
        the number of message in this vector.
      • reset

        public void reset()
      • addMessage

        public void addMessage​(Message msg)
        Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.

        Parameters:
        msg - the component to be added.
      • removeCurrent

        public void removeCurrent()
      • removeMessage

        public Message removeMessage​(int stamp)
        Removes a message specified by its stamp. Only remove real message, this method don't touch to acknowledge message.
        Parameters:
        stamp - the stamp of the message to remove.
        Returns:
        the removed message.