Class IntLongIndexedList

  • All Implemented Interfaces:
    java.io.Serializable

    public class IntLongIndexedList
    extends java.lang.Object
    implements java.io.Serializable
    Manages an array of lists of longs. It provides methods for adding, deleting, and retrieving int values for specific lists.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      IntLongIndexedList​(int numLists)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int listID, long value)
      Add a value to the front of the list indexed by listID.
      void append​(int listID, long value)
      Add a value to the back of the list indexed by listID.
      void clear()
      Removes all values from all lists.
      boolean contains​(int listID, long value)
      Returns true if the value exists in the specified list.
      long[] get​(int listID)
      Get list of values stored in the specified list.
      int getCount​(int listID)
      Get the number of values in the specified list.
      int getNumLists()
      Returns the number of lists.
      void growNumLists​(int numLists)
      Increase the number of lists.
      boolean remove​(int listID, long value)
      Remove the value from the list indexed by listID.
      void removeAll​(int listID)
      Remove all values from a specified list.
      • Methods inherited from class java.lang.Object

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

      • IntLongIndexedList

        public IntLongIndexedList​(int numLists)
        Constructor
        Parameters:
        numLists - initial number of lists.
    • Method Detail

      • add

        public void add​(int listID,
                        long value)
        Add a value to the front of the list indexed by listID.
        Parameters:
        listID - specifies which list the value is to be added.
        value - the value to be added to the list.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • append

        public void append​(int listID,
                           long value)
        Add a value to the back of the list indexed by listID.
        Parameters:
        listID - specifies which list the value is to be appended.
        value - the value to be added to the linked list.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • remove

        public boolean remove​(int listID,
                              long value)
        Remove the value from the list indexed by listID.
        Parameters:
        listID - the id of the list from which to remove the value.
        value - the value to be removed from the specified list.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • removeAll

        public void removeAll​(int listID)
        Remove all values from a specified list.
        Parameters:
        listID - the id of the list to be cleared.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • contains

        public boolean contains​(int listID,
                                long value)
        Returns true if the value exists in the specified list.
        Parameters:
        listID - the id of the list to be tested for the given value.
        value - the value to search for in the specified list.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • getCount

        public int getCount​(int listID)
        Get the number of values in the specified list.
        Parameters:
        listID - the id of the list for which to get the count.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • get

        public long[] get​(int listID)
        Get list of values stored in the specified list.
        Parameters:
        listID - the id of the list from which to get the values.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if the listID is not in the range [0, numLists].
      • getNumLists

        public int getNumLists()
        Returns the number of lists.
      • growNumLists

        public void growNumLists​(int numLists)
        Increase the number of lists.
        Parameters:
        numLists - the new number of lists.
      • clear

        public void clear()
        Removes all values from all lists.