Class GridIntList

    • Constructor Detail

      • GridIntList

        public GridIntList()
      • GridIntList

        public GridIntList​(int size)
        Parameters:
        size - Size.
      • GridIntList

        public GridIntList​(int[] arr)
        Parameters:
        arr - Array.
    • Method Detail

      • asList

        public static GridIntList asList​(int... vals)
        Parameters:
        vals - Values.
        Returns:
        List from values.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • add

        public void add​(int x)
        Add element to this array.
        Parameters:
        x - Value.
      • copyWithout

        public GridIntList copyWithout​(GridIntList l)
        Returns (possibly reordered) copy of this list, excluding all elements of given list.
        Parameters:
        l - List of elements to remove.
        Returns:
        New list without all elements from l.
      • get

        public int get​(int i)
        Parameters:
        i - Index.
        Returns:
        Value.
      • size

        public int size()
        Returns:
        Size.
      • isEmpty

        public boolean isEmpty()
        Returns:
        True if this list has no elements.
      • contains

        public boolean contains​(int l)
        Parameters:
        l - Element to find.
        Returns:
        True if found.
      • truncate

        public void truncate​(int size,
                             boolean last)
        Parameters:
        size - New size.
        last - If true the last elements will be removed, otherwise the first.
      • removeIndex

        public int removeIndex​(int i)
        Removes element by given index.
        Parameters:
        i - Index.
        Returns:
        Removed value.
      • removeValue

        public int removeValue​(int startIdx,
                               int val)
        Removes value from this list.
        Parameters:
        startIdx - Index to begin search with.
        val - Value.
        Returns:
        Index of removed value if the value was found and removed or -1 otherwise.
      • array

        public int[] array()
        Returns:
        Array copy.
      • sort

        public GridIntList sort()
        Sorts this list. Use copy().sort() if you need a defensive copy.
        Returns:
        this For chaining.
      • onAckReceived

        public void onAckReceived()
        Method called when ack message received.
        Specified by:
        onAckReceived in interface Message
      • writeTo

        public boolean writeTo​(ByteBuffer buf,
                               MessageWriter writer)
        Writes this message to provided byte buffer.
        Specified by:
        writeTo in interface Message
        Parameters:
        buf - Byte buffer.
        writer - Writer.
        Returns:
        Whether message was fully written.
      • readFrom

        public boolean readFrom​(ByteBuffer buf,
                                MessageReader reader)
        Reads this message from provided byte buffer.
        Specified by:
        readFrom in interface Message
        Parameters:
        buf - Byte buffer.
        reader - Reader.
        Returns:
        Whether message was fully read.
      • directType

        public short directType()
        Gets message type.
        Specified by:
        directType in interface Message
        Returns:
        Message type.
      • fieldsCount

        public byte fieldsCount()
        Gets fields count.
        Specified by:
        fieldsCount in interface Message
        Returns:
        Fields count.