Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Util.Structures
Class StaticIntList

    java.lang.Object
      Util.Structures.StaticIntList

All Implemented Interfaces:
  IntList

Direct Known Subclasses:
  GEChromosome

    public class StaticIntList

extends java.lang.Object
implements IntList

This is a simple implementation of a wrapper for a dynamically sized static array to hold ints. Does not support insertion of elements between a particular element or removal of elemnts but allow elements to change. When current size is reached the array size is doubled untill maxSize is reached

Version:
  2007.0220
Author:
  Blip

Field Summary
`int` | `currentSize`
`int[]` | `data`
`int` | `initialSize`
`static int` | `maxSize`

Constructor Summary
`StaticIntList(int size)` Creates a new instance of StaticIntList
`StaticIntList(StaticIntList list)` Copy constructor

Method Summary
`void` | `add(int item)` Add int to list.
`int` | `allocationSize()` Get the total
`void` | `clear()` Clear list by setting current size to 0
`int` | `get(int index)` Get element at index
`int` | `getMaxSize()` Get max size
`IntIterator` | `iterator()` Create iterator over list
`static void` | `main(java.lang.String[] args)`
`void` | `set(int index, int item)` Set element at index
`void` | `setAll(int[] data)` Set all the elements to data
`void` | `setMaxSize(int i)` Set max size
`int` | `size()` Get current size of the list
`int[]` | `toArray()` To array

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### data

    public int[] data

### currentSize

    public int currentSize

### initialSize

    public final int initialSize

### maxSize

    public static int maxSize

Constructor Detail

### StaticIntList

    public StaticIntList(int size)

  Creates a new instance of StaticIntList

  Parameters:
    `size` - start size of int list

### StaticIntList

    public StaticIntList(StaticIntList list)

  Copy constructor

  Parameters:
    `list` - object to copy

Method Detail

### setMaxSize

    public void setMaxSize(int i)

  Set max size

  Parameters:
    `i` - max size

### getMaxSize

    public int getMaxSize()

  Get max size

  Returns:
    max size

### get

    public int get(int index)

  Get element at index

  Specified by:
    `get` in interface `IntList`
  Parameters:
    `index` - element index
  Returns:
    element at index

### set

    public void set(int index,
                    int item)

  Set element at index

  Specified by:
    `set` in interface `IntList`
  Parameters:
    `index` - index to set element
    `item` - element to set

### setAll

    public void setAll(int[] data)

  Set all the elements to data

  Parameters:
    `data` - the set elements

### clear

    public void clear()

  Clear list by setting current size to 0

  Specified by:
    `clear` in interface `IntList`

### toArray

    public int[] toArray()

  To array

  Specified by:
    `toArray` in interface `IntList`
  Returns:
    array of list

### iterator

    public IntIterator iterator()

  Create iterator over list

  Specified by:
    `iterator` in interface `IntList`
  Returns:
    iterator

### add

    public void add(int item)
             throws java.lang.IndexOutOfBoundsException

  Add int to list. If current size equals data length a new data structure which is 10% larger is created.

  Specified by:
    `add` in interface `IntList`
  Parameters:
    `item` - item to add
  Throws:
    `java.lang.IndexOutOfBoundsException`

### main

    public static void main(java.lang.String[] args)

### size

    public int size()

  Get current size of the list

  Specified by:
    `size` in interface `IntList`
  Returns:
    int The number of elements in the list

### allocationSize

    public int allocationSize()

  Get the total

  Returns:
    int The allocated lenth of the list

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD