Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

com::cosylab::acs::maci::IntArray Class Reference

List of all members.

Public Member Functions

 IntArray ()
 IntArray (int capacity)
 IntArray (int[] values)
void ensureCapacity (int capacity)
int size ()
boolean isEmpty ()
void trimToSize ()
void add (int val)
void add (int[] vals)
void add (int[] vals, int offset, int length)
void insert (int offset, int value)
void insert (int offset, int[] values)
void insert (int offset, int[] values, int valOffset, int len)
int get (int offset)
void set (int offset, int val)
void set (int offset, int[] values)
void set (int offset, int[] values, int valOffset, int length)
void clear ()
void clear (int capacity)
int removeAt (int offset)
int remove (int value)
void removeAt (int offset, int length)
Object clone ()
int[] toArray ()
int[] toArray (int offset, int len)
void toArray (int[] dest, int offset, int len)
boolean equals (Object other)
int hashCode ()
boolean contains (int value)
String toString ()

Protected Attributes

transient int[] data

Private Member Functions

void writeObject (ObjectOutputStream stream) throws IOException
void readObject (ObjectInputStream stream) throws IOException, ClassNotFoundException

Private Attributes

transient int pos

Static Private Attributes

final long serialVersionUID = -8356201427005323616L
final int DEFAULT_CAPACITY = 10

Detailed Description

A resizable, array of integer primitives.

Author:
Matej Sekoranja (matej.sekoranja@cosylab.com)
Version:
@VERSION@


Constructor & Destructor Documentation

com::cosylab::acs::maci::IntArray::IntArray  )  [inline]
 

Constrcuts a new IntArray instance with the default capacity.

com::cosylab::acs::maci::IntArray::IntArray int  capacity  )  [inline]
 

Constrcuts a new IntArray instance with the specified capacity.

Parameters:
capacity an int value

com::cosylab::acs::maci::IntArray::IntArray int[]  values  )  [inline]
 

Constrcuts a new IntArray instance whose capacity is the greater of the length of values and DEFAULT_CAPACITY and whose initial contents are the specified values.

Parameters:
values an int[] value


Member Function Documentation

void com::cosylab::acs::maci::IntArray::add int[]  vals,
int  offset,
int  length
[inline]
 

Adds a subset of the values in the array vals to the end of the list, in order.

Parameters:
vals an int[] value
offset the offset at which to start copying
length the number of values to copy.

void com::cosylab::acs::maci::IntArray::add int[]  vals  )  [inline]
 

Adds the values in the array vals to the end of the list, in order.

Parameters:
vals an int[] value

void com::cosylab::acs::maci::IntArray::add int  val  )  [inline]
 

Adds val to the end of the list, growing as needed.

Parameters:
val an int value

void com::cosylab::acs::maci::IntArray::clear int  capacity  )  [inline]
 

Flushes the internal state of the list, setting the capacity of the empty list to capacity.

Parameters:
capacity an int value

void com::cosylab::acs::maci::IntArray::clear  )  [inline]
 

Flushes the internal state of the list, resetting the capacity to the default.

Object com::cosylab::acs::maci::IntArray::clone  )  [inline]
 

Returns a clone of this list. Since this is a primitive collection, this will be a deep clone.

Returns:
a deep clone of the list.

boolean com::cosylab::acs::maci::IntArray::contains int  value  )  [inline]
 

Searches the list for value

Parameters:
value an int value
Returns:
true if value is in the list.

void com::cosylab::acs::maci::IntArray::ensureCapacity int  capacity  )  [inline]
 

Grow the internal array as needed to accomodate the specified number of elements. The size of the array doubles on each resize unless capacity requires more than twice the current capacity.

Parameters:
capacity an int value

boolean com::cosylab::acs::maci::IntArray::equals Object  other  )  [inline]
 

Compares this list to another list, value by value.

Parameters:
other the object to compare against
Returns:
true if other is a TIntArrayList and has exactly the same values.

int com::cosylab::acs::maci::IntArray::get int  offset  )  [inline]
 

Returns the value at the specified offset.

Parameters:
offset an int value
Returns:
an int value

int com::cosylab::acs::maci::IntArray::hashCode  )  [inline]
 

Returns the hash code value for this list.

This implementation uses exactly the code that is used to define the list hash function in the documentation for the List.hashCode method.

Returns:
the hash code value for this list.

void com::cosylab::acs::maci::IntArray::insert int  offset,
int[]  values,
int  valOffset,
int  len
[inline]
 

Inserts a slice of the array of values into the list at offset. All values including and to the right of offset are shifted to the right.

Parameters:
offset an int value
values an int[] value
valOffset the offset in the values array at which to start copying.
len the number of values to copy from the values array

void com::cosylab::acs::maci::IntArray::insert int  offset,
int[]  values
[inline]
 

Inserts the array of values into the list at offset. All values including and to the right of offset are shifted to the right.

Parameters:
offset an int value
values an int[] value

void com::cosylab::acs::maci::IntArray::insert int  offset,
int  value
[inline]
 

Inserts value into the list at offset. All values including and to the right of offset are shifted to the right.

Parameters:
offset an int value
value an int value

boolean com::cosylab::acs::maci::IntArray::isEmpty  )  [inline]
 

Tests whether this list contains any values.

Returns:
true if the list is empty.

void com::cosylab::acs::maci::IntArray::readObject ObjectInputStream  stream  )  throws IOException, ClassNotFoundException [inline, private]
 

Reconstitute the ArrayList instance from a stream (that is, deserialize it).

int com::cosylab::acs::maci::IntArray::remove int  value  )  [inline]
 

Removes the element with value value from the list.

Parameters:
value value of the element to be removed
Returns:
ofset of the removed element, -1 on failure.

void com::cosylab::acs::maci::IntArray::removeAt int  offset,
int  length
[inline]
 

Removes length values from the list, starting at offset

Parameters:
offset an int value
length an int value

int com::cosylab::acs::maci::IntArray::removeAt int  offset  )  [inline]
 

Removes the value at offset from the list.

Parameters:
offset an int value
Returns:
the value previously stored at offset.

void com::cosylab::acs::maci::IntArray::set int  offset,
int[]  values,
int  valOffset,
int  length
[inline]
 

Replace the values in the list starting at offset with length values from the values array, starting at valOffset.

Parameters:
offset the first offset to replace
values the source of the new values
valOffset the first value to copy from the values array
length the number of values to copy

void com::cosylab::acs::maci::IntArray::set int  offset,
int[]  values
[inline]
 

Replace the values in the list starting at offset with the contents of the values array.

Parameters:
offset the first offset to replace
values the source of the new values

void com::cosylab::acs::maci::IntArray::set int  offset,
int  val
[inline]
 

Sets the value at the specified offset.

Parameters:
offset an int value
val an int value

int com::cosylab::acs::maci::IntArray::size  )  [inline]
 

Returns the number of values in the list.

Returns:
the number of values in the list.

void com::cosylab::acs::maci::IntArray::toArray int[]  dest,
int  offset,
int  len
[inline]
 

Copies a slice of the list into a native array.

Parameters:
dest the array to copy into.
offset the offset of the first value to copy
len the number of values to copy.

int [] com::cosylab::acs::maci::IntArray::toArray int  offset,
int  len
[inline]
 

Copies a slice of the list into a native array.

Parameters:
offset the offset at which to start copying
len the number of values to copy.
Returns:
an int[] value

int [] com::cosylab::acs::maci::IntArray::toArray  )  [inline]
 

Copies the contents of the list into a native array.

Returns:
an int[] value

String com::cosylab::acs::maci::IntArray::toString  )  [inline]
 

Returns a String representation of the list, front to back.

Returns:
a String value

void com::cosylab::acs::maci::IntArray::trimToSize  )  [inline]
 

Sheds any excess capacity above and beyond the current size of the list.

void com::cosylab::acs::maci::IntArray::writeObject ObjectOutputStream  stream  )  throws IOException [inline, private]
 

Save the state of the ArrayList instance to a stream (that is, serialize it).

The length of the array backing the ArrayList instance is emitted (int), followed by all of its elements (each an Object) in the proper order.


Member Data Documentation

transient int [] com::cosylab::acs::maci::IntArray::data [protected]
 

Array data.

final int com::cosylab::acs::maci::IntArray::DEFAULT_CAPACITY = 10 [static, private]
 

Default capacity for the array.

transient int com::cosylab::acs::maci::IntArray::pos [private]
 

Index of the first empty bucket (also size).

final long com::cosylab::acs::maci::IntArray::serialVersionUID = -8356201427005323616L [static, private]
 

Serial version UID.


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 03:11:16 2009 for ACS Java API by doxygen 1.3.8