com.inxar.syntacs.util
Class ArrayIntList

java.lang.Object
  |
  +--com.inxar.syntacs.util.ArrayIntList
All Implemented Interfaces:
Cloneable, IntArray, IntList

public class ArrayIntList
extends Object
implements IntList

Concrete implementation of IntList which uses an array internally.


Constructor Summary
ArrayIntList()
          Constructs a new ArrayIntList using a default initial capacity.
ArrayIntList(int capacity)
          Constructs a new ArrayIntList with the given initial capacity.
 
Method Summary
 int add(int value)
          Adds the given value to the end of the list and returns the index number of the element that was written.
 int at(int index)
          Returns the value at the given index.
 Object clone()
          Clones the IntArray.
 boolean contains(int value)
          Returns true if the given value is in the list, false otherwise.
 IntIterator iterator()
          Returns an iterator view over the list.
 int length()
          Returns the length of the array.
 void set(int index, int value)
           
 int[] toArray()
          Returns a new primitive-typed copy of the array.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayIntList

public ArrayIntList(int capacity)
Constructs a new ArrayIntList with the given initial capacity.

ArrayIntList

public ArrayIntList()
Constructs a new ArrayIntList using a default initial capacity.
Method Detail

add

public int add(int value)
Description copied from interface: IntList
Adds the given value to the end of the list and returns the index number of the element that was written.
Specified by:
add in interface IntList

set

public void set(int index,
                int value)

at

public int at(int index)
Description copied from interface: IntArray
Returns the value at the given index.
Specified by:
at in interface IntArray

toArray

public int[] toArray()
Description copied from interface: IntArray
Returns a new primitive-typed copy of the array.
Specified by:
toArray in interface IntArray

iterator

public IntIterator iterator()
Description copied from interface: IntList
Returns an iterator view over the list.
Specified by:
iterator in interface IntList

contains

public boolean contains(int value)
Description copied from interface: IntList
Returns true if the given value is in the list, false otherwise.
Specified by:
contains in interface IntList

length

public int length()
Description copied from interface: IntArray
Returns the length of the array.
Specified by:
length in interface IntArray

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from interface: IntArray
Clones the IntArray.
Specified by:
clone in interface IntArray