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

Inheritance diagram for com::cosylab::acs::maci::IntArray:
Inheritance graph
[legend]
Collaboration diagram for com::cosylab::acs::maci::IntArray:
Collaboration graph
[legend]

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

static final long serialVersionUID = -8356201427005323616L
static 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.

References 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

References data, and pos.

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

References add(), and DEFAULT_CAPACITY.


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.

References data, ensureCapacity(), and pos.

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

References add().

void com::cosylab::acs::maci::IntArray::add ( int  val  )  [inline]
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

References data, and pos.

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

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

References DEFAULT_CAPACITY.

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.

References clone(), and data.

Referenced by clone().

boolean com::cosylab::acs::maci::IntArray::contains ( int  value  )  [inline]
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

References data.

Referenced by add(), and insert().

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.

References data, pos, and size().

int com::cosylab::acs::maci::IntArray::get ( int  offset  )  [inline]
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.

References data, and pos.

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

References add(), data, ensureCapacity(), and pos.

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

References insert().

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

References add(), data, ensureCapacity(), and pos.

Referenced by insert().

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

Tests whether this list contains any values.

Returns:
true if the list is empty.

References pos.

Referenced by com::cosylab::acs::maci::manager::ComponentInfoTopologicalSort::extract().

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

References data, pos, and size().

int com::cosylab::acs::maci::IntArray::remove ( int  value  )  [inline]
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

References data, and pos.

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.

Referenced by remove(), com::cosylab::acs::maci::test::IntArrayTest::testContainment(), and com::cosylab::acs::maci::test::IntArrayTest::testRemoval().

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

References data, and pos.

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

References data, and pos.

int com::cosylab::acs::maci::IntArray::size (  )  [inline]
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.

References data, and pos.

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

References toArray().

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

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

Returns:
a String value

References data, and pos.

Referenced by com::cosylab::acs::maci::test::IntArrayTest::testContainment().

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

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

References data, size(), and toArray().

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.

References data, and pos.


Member Data Documentation

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

Default capacity for the array.

Referenced by clear(), and IntArray().

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

Index of the first empty bucket (also size).

Referenced by add(), clear(), contains(), equals(), get(), hashCode(), insert(), IntArray(), isEmpty(), readObject(), remove(), removeAt(), set(), size(), toArray(), toString(), and writeObject().

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 by  doxygen 1.6.2