com.caucho.util
Class IntArray

java.lang.Object
  extended by com.caucho.util.IntArray

public class IntArray
extends java.lang.Object

The IntArray is a variable array containing integers. The API follows the JDK 1.2 collection classes.


Constructor Summary
IntArray()
          Create an empty int array.
 
Method Summary
 void add(int i)
          Adds an integer to the array.
 void add(IntArray array)
          Appends the integers in array to the end of this array.
 void add(int i, int value)
          Inserts an integer into the array.
 void clear()
          clear the array, i.e.
 boolean contains(int test)
          Returns true if the array contains and integer equal to test.
 int get(int i)
          Gets the integer value at the given index.
 int[] getArray()
          Returns the data array.
 boolean isSubset(IntArray subset)
          True if all the integers in subset are contained in the array.
 int last()
          Returns the last integer in the array.
 int pop()
          Pops the value off the end of the array.
 void set(int i, int value)
          Sets the value at the given index.
 void setLength(int size)
          Sets the length of the array, filling with zero if necessary.
 int size()
          Returns the current size of the array
 int[] toArray()
          Return a new int array with the contents.
 java.lang.String toString()
           
 void union(IntArray newArray)
          Adds the members of newArray to the list if they are not already members of the array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntArray

public IntArray()
Create an empty int array.

Method Detail

clear

public void clear()
clear the array, i.e. set the size to 0.


size

public int size()
Returns the current size of the array


getArray

public int[] getArray()
Returns the data array.


add

public void add(int i)
Adds an integer to the array.


add

public void add(IntArray array)
Appends the integers in array to the end of this array.


add

public void add(int i,
                int value)
Inserts an integer into the array.


pop

public int pop()
Pops the value off the end of the array.


setLength

public void setLength(int size)
Sets the length of the array, filling with zero if necessary.


get

public int get(int i)
Gets the integer value at the given index.

Parameters:
i - index into the array.
Returns:
value at the index

last

public int last()
Returns the last integer in the array.


set

public void set(int i,
                int value)
Sets the value at the given index.


contains

public boolean contains(int test)
Returns true if the array contains and integer equal to test.


isSubset

public boolean isSubset(IntArray subset)
True if all the integers in subset are contained in the array.


union

public void union(IntArray newArray)
Adds the members of newArray to the list if they are not already members of the array.


toArray

public int[] toArray()
Return a new int array with the contents.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object