Class IntegerListBlockInterface

  • Direct Known Subclasses:
    BlockIntegerList.IntArrayListBlock

    public abstract class IntegerListBlockInterface
    extends java.lang.Object
    A block of an AbstractBlockIntegerList. This exposes the contents of a block of the list.

    An IntegerListBlockInterface is a single element of a block of integers that make up some complete list of integers. A block integer list encapsulates a set of integers making up the block, and a chain to the next and previous block in the set.

    Author:
    Tobias Downer
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void addInt​(int val)
      Adds an int to the block.
      abstract int binarySearch​(java.lang.Object key, IndexComparator c)
      Considers each int a reference to another structure, and the block sorted by these structures.
      abstract int bottomInt()
      The bottom int in the list.
      abstract boolean canContain​(int number)
      Returns true if the block has enough room to fill with the given number of integers.
      abstract void clear()
      Clears the object to be re-used.
      abstract int copyTo​(int[] to, int offset)
      Copies all the data from this block into the given int[] array.
      abstract void copyTo​(IntegerListBlockInterface dest_block)
      Copies all the data from this block into the given destination block.
      boolean hasChanged()
      Returns true if this store has been modified.
      abstract void insertIntAt​(int val, int pos)
      Inserts an int at the given position.
      abstract int intAt​(int pos)
      Returns the int at the given position in the array.
      abstract boolean isEmpty()
      Returns true if the block is empty.
      abstract boolean isFull()
      Returns true if the block is full.
      abstract int iterativeSearch​(int val)
      Performs an iterative search through the int values in the list.
      abstract int iterativeSearch​(int val, int position)
      Performs an iterative search from the given position to the end of the list in the block.
      abstract void moveTo​(IntegerListBlockInterface dest_block, int dest_index, int length)
      Moves a set of values from the end of this block and inserts it into the given block at the destination index specified.
      abstract int removeIntAt​(int pos)
      Removes an Int from the specified position in the block.
      abstract int searchFirst​(int val)
      Assuming a sorted block, finds the first index in the block that equals the given value.
      abstract int searchFirst​(java.lang.Object key, IndexComparator c)
      Considers each int a reference to another structure, and the block sorted by these structures.
      abstract int searchLast​(int val)
      Assuming a sorted block, finds the first index in the block that equals the given value.
      abstract int searchLast​(java.lang.Object key, IndexComparator c)
      Considers each int a reference to another structure, and the block sorted by these structures.
      abstract int setIntAt​(int val, int pos)
      Sets an int at the given position, overwriting anything that was previously there.
      abstract int size()
      Returns the number of entries in this block.
      abstract int topInt()
      The top int in the list.
      • Methods inherited from class java.lang.Object

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

      • IntegerListBlockInterface

        public IntegerListBlockInterface()
    • Method Detail

      • hasChanged

        public final boolean hasChanged()
        Returns true if this store has been modified. The purpose of this method is to determine if any updates need to be made to any persistant representation of this store.
      • size

        public abstract int size()
        Returns the number of entries in this block.
      • isFull

        public abstract boolean isFull()
        Returns true if the block is full.
      • isEmpty

        public abstract boolean isEmpty()
        Returns true if the block is empty.
      • canContain

        public abstract boolean canContain​(int number)
        Returns true if the block has enough room to fill with the given number of integers.
      • topInt

        public abstract int topInt()
        The top int in the list.
      • bottomInt

        public abstract int bottomInt()
        The bottom int in the list.
      • intAt

        public abstract int intAt​(int pos)
        Returns the int at the given position in the array.
      • addInt

        public abstract void addInt​(int val)
        Adds an int to the block.
      • removeIntAt

        public abstract int removeIntAt​(int pos)
        Removes an Int from the specified position in the block.
      • insertIntAt

        public abstract void insertIntAt​(int val,
                                         int pos)
        Inserts an int at the given position.
      • setIntAt

        public abstract int setIntAt​(int val,
                                     int pos)
        Sets an int at the given position, overwriting anything that was previously there. It returns the value that was previously at the element.
      • moveTo

        public abstract void moveTo​(IntegerListBlockInterface dest_block,
                                    int dest_index,
                                    int length)
        Moves a set of values from the end of this block and inserts it into the given block at the destination index specified. Assumes the destination block has enough room to store the set. Assumes 'dest_block' is the same class as this.
      • copyTo

        public abstract void copyTo​(IntegerListBlockInterface dest_block)
        Copies all the data from this block into the given destination block. Assumes 'dest_block' is the same class as this.
      • copyTo

        public abstract int copyTo​(int[] to,
                                   int offset)
        Copies all the data from this block into the given int[] array. Returns the number of 'int' values copied.
      • clear

        public abstract void clear()
        Clears the object to be re-used.
      • iterativeSearch

        public abstract int iterativeSearch​(int val)
        Performs an iterative search through the int values in the list. If it's found the index of the value is returned, else it returns -1.
      • iterativeSearch

        public abstract int iterativeSearch​(int val,
                                            int position)
        Performs an iterative search from the given position to the end of the list in the block. If it's found the index of the value is returned, else it returns -1.
      • binarySearch

        public abstract int binarySearch​(java.lang.Object key,
                                         IndexComparator c)
        Considers each int a reference to another structure, and the block sorted by these structures. The method performs a binary search.
      • searchFirst

        public abstract int searchFirst​(java.lang.Object key,
                                        IndexComparator c)
        Considers each int a reference to another structure, and the block sorted by these structures. Finds the first index in the block that equals the given key.
      • searchLast

        public abstract int searchLast​(java.lang.Object key,
                                       IndexComparator c)
        Considers each int a reference to another structure, and the block sorted by these structures. Finds the first index in the block that equals the given key.
      • searchFirst

        public abstract int searchFirst​(int val)
        Assuming a sorted block, finds the first index in the block that equals the given value.
      • searchLast

        public abstract int searchLast​(int val)
        Assuming a sorted block, finds the first index in the block that equals the given value.