Package com.mckoi.util

## Class BlockIntegerList.IntArrayListBlock

- java.lang.Object
- - com.mckoi.util.IntegerListBlockInterface
  - - com.mckoi.util.BlockIntegerList.IntArrayListBlock

Enclosing class:
  BlockIntegerList

    public static class BlockIntegerList.IntArrayListBlock
    extends IntegerListBlockInterface

The block that contains the actual int values of the list. This is made public because it may be useful to derive from this class.

### Field Summary

Fields
`protected int[]` `array` The array of int's stored in this block.
`protected int` `count` The number of block entries in this list.

### Fields inherited from class com.mckoi.util.IntegerListBlockInterface

`next, previous`

### Constructor Summary

Constructors
`protected` `IntArrayListBlock()` Blank protected constructor.
`` `IntArrayListBlock​(int block_size)` Constructs the block to a specific size.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addInt​(int val)` Adds an int to the block.
`int` `binarySearch​(java.lang.Object key, IndexComparator c)` Considers each int a reference to another structure, and the block sorted by these structures.
`int` `bottomInt()` The bottom int in the list.
`boolean` `canContain​(int number)` Returns true if the block has enough room to fill with the given number of integers.
`void` `clear()` Clears the object to be re-used.
`int` `copyTo​(int[] to, int offset)` Copies all the data from this block into the given int[] array.
`void` `copyTo​(IntegerListBlockInterface dest_block)` Copies all the data from this block into the given destination block.
`protected int[]` `getArray​(boolean immutable)` Returns the int[] array for this block.
`protected int` `getArrayLength()` Returns the count of int's in this block.
`void` `insertIntAt​(int val, int pos)` Inserts an int at the given position.
`int` `intAt​(int pos)` Returns the int at the given position in the array.
`boolean` `isEmpty()` Returns true if the block is empty.
`boolean` `isFull()` Returns true if the block is full.
`int` `iterativeSearch​(int val)` Performs an iterative search through the int values in the list.
`int` `iterativeSearch​(int val, int position)` Performs an iterative search from the given position to the end of the list in the block.
`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.
`int` `removeIntAt​(int pos)` Removes an Int from the specified position in the block.
`int` `searchFirst​(int val)` Assuming a sorted block, finds the first index in the block that equals the given value.
`int` `searchFirst​(java.lang.Object key, IndexComparator c)` Considers each int a reference to another structure, and the block sorted by these structures.
`int` `searchLast​(int val)` Assuming a sorted block, finds the first index in the block that equals the given value.
`int` `searchLast​(java.lang.Object key, IndexComparator c)` Considers each int a reference to another structure, and the block sorted by these structures.
`int` `setIntAt​(int val, int pos)` Sets an int at the given position, overwriting anything that was previously there.
`int` `size()` Returns the number of entries in this block.
`int` `topInt()` The top int in the list.
`java.lang.String` `toString()` Converts the block into a String.

### Methods inherited from class com.mckoi.util.IntegerListBlockInterface

`hasChanged`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### array

    protected int[] array

The array of int's stored in this block.

#### count

    protected int count

The number of block entries in this list.

### Constructor Detail

#### IntArrayListBlock

    protected IntArrayListBlock()

Blank protected constructor.

#### IntArrayListBlock

    public IntArrayListBlock​(int block_size)

Constructs the block to a specific size.

### Method Detail

#### getArray

    protected int[] getArray​(boolean immutable)

Returns the int[] array for this block. If 'immutable' is true then the array object is guarenteed to not be mutated.

#### getArrayLength

    protected int getArrayLength()

Returns the count of int's in this block.

#### size

    public final int size()

Returns the number of entries in this block.

Specified by:
  `size` in class `IntegerListBlockInterface`

#### isFull

    public final boolean isFull()

Returns true if the block is full.

Specified by:
  `isFull` in class `IntegerListBlockInterface`

#### isEmpty

    public final boolean isEmpty()

Returns true if the block is empty.

Specified by:
  `isEmpty` in class `IntegerListBlockInterface`

#### canContain

    public final boolean canContain​(int number)

Returns true if the block has enough room to fill with the given number of integers.

Specified by:
  `canContain` in class `IntegerListBlockInterface`

#### topInt

    public int topInt()

The top int in the list.

Specified by:
  `topInt` in class `IntegerListBlockInterface`

#### bottomInt

    public int bottomInt()

The bottom int in the list.

Specified by:
  `bottomInt` in class `IntegerListBlockInterface`

#### intAt

    public final int intAt​(int pos)

Returns the int at the given position in the array.

Specified by:
  `intAt` in class `IntegerListBlockInterface`

#### addInt

    public final void addInt​(int val)

Adds an int to the block.

Specified by:
  `addInt` in class `IntegerListBlockInterface`

#### removeIntAt

    public final int removeIntAt​(int pos)

Removes an Int from the specified position in the block.

Specified by:
  `removeIntAt` in class `IntegerListBlockInterface`

#### insertIntAt

    public final void insertIntAt​(int val,
                                  int pos)

Inserts an int at the given position.

Specified by:
  `insertIntAt` in class `IntegerListBlockInterface`

#### setIntAt

    public final 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.

Specified by:
  `setIntAt` in class `IntegerListBlockInterface`

#### moveTo

    public final 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.

Specified by:
  `moveTo` in class `IntegerListBlockInterface`

#### copyTo

    public final void copyTo​(IntegerListBlockInterface dest_block)

Copies all the data from this block into the given destination block.

Specified by:
  `copyTo` in class `IntegerListBlockInterface`

#### copyTo

    public final 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.

Specified by:
  `copyTo` in class `IntegerListBlockInterface`

#### clear

    public final void clear()

Clears the object to be re-used.

Specified by:
  `clear` in class `IntegerListBlockInterface`

#### iterativeSearch

    public 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.

Specified by:
  `iterativeSearch` in class `IntegerListBlockInterface`

#### iterativeSearch

    public 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.

Specified by:
  `iterativeSearch` in class `IntegerListBlockInterface`

#### binarySearch

    public final 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.

Specified by:
  `binarySearch` in class `IntegerListBlockInterface`

#### searchFirst

    public final 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.

Specified by:
  `searchFirst` in class `IntegerListBlockInterface`

#### searchLast

    public final 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.

Specified by:
  `searchLast` in class `IntegerListBlockInterface`

#### searchFirst

    public final int searchFirst​(int val)

Assuming a sorted block, finds the first index in the block that equals the given value.

Specified by:
  `searchFirst` in class `IntegerListBlockInterface`

#### searchLast

    public final int searchLast​(int val)

Assuming a sorted block, finds the first index in the block that equals the given value.

Specified by:
  `searchLast` in class `IntegerListBlockInterface`

#### toString

    public java.lang.String toString()

Converts the block into a String.

Overrides:
  `toString` in class `java.lang.Object`