English | Site Directory

Android - An Open Handset Alliance Project

android.util
public class

android.util.PackedIntVector

java.lang.Object
android.util.PackedIntVector

PackedIntVector stores a two-dimensional array of integers, optimized for inserting and deleting rows and for offsetting the values in segments of a given column.

Summary

Public Constructors

          PackedIntVector(int columns)
Creates a new PackedIntVector with the specified width and a height of 0.

Public Methods

        void  adjustValuesBelow(int startRow, int column, int delta)
Increments all values in the specified column whose row >= the specified row by the specified delta.
        void  deleteAt(int row, int count)
Deletes the specified number of rows starting with the specified row.
        int  getValue(int row, int column)
Returns the value at the specified row and column.
        void  insertAt(int row, int[] values)
Inserts a new row of values at the specified row offset.
        void  setValue(int row, int column, int value)
Sets the value at the specified row and column.
        int  size()
Returns the number of rows in the PackedIntVector.
        int  width()
Returns the width of the PackedIntVector.
Methods inherited from class java.lang.Object

Details

Public Constructors

public PackedIntVector(int columns)

Creates a new PackedIntVector with the specified width and a height of 0.

Parameters

columns the width of the PackedIntVector.

Public Methods

public void adjustValuesBelow(int startRow, int column, int delta)

Increments all values in the specified column whose row >= the specified row by the specified delta.

Parameters

startRow the row at which to begin incrementing. This may be == size(), which case there is no effect.
column the index of the column to set.

Throws

IndexOutOfBoundsException if the row is out of range (startRow < 0 || startRow > size()) or the column is out of range (column < 0 || column >= width()).

public void deleteAt(int row, int count)

Deletes the specified number of rows starting with the specified row.

Parameters

row the index of the first row to be deleted.
count the number of rows to delete.

Throws

IndexOutOfBoundsException if any of the rows to be deleted are out of range (row < 0 || count < 0 || row + count > size()).

public int getValue(int row, int column)

Returns the value at the specified row and column.

Parameters

row the index of the row to return.
column the index of the column to return.

Returns

  • the value stored at the specified position.

Throws

IndexOutOfBoundsException if the row is out of range (row < 0 || row >= size()) or the column is out of range (column < 0 || column >= width()).

public void insertAt(int row, int[] values)

Inserts a new row of values at the specified row offset.

Parameters

row the row above which to insert the new row. This may be == size(), which case the new row is added at the end.
values the new values to be added. If this is null, a row of zeroes is added.

Throws

IndexOutOfBoundsException if the row is out of range (row < 0 || row > size()) or if the length of the values array is too small (values.length < width()).

public void setValue(int row, int column, int value)

Sets the value at the specified row and column.

Parameters

row the index of the row to set.
column the index of the column to set.

Throws

IndexOutOfBoundsException if the row is out of range (row < 0 || row >= size()) or the column is out of range (column < 0 || column >= width()).

public int size()

Returns the number of rows in the PackedIntVector. This number will change as rows are inserted and deleted.

Returns

  • the number of rows.

public int width()

Returns the width of the PackedIntVector. This number is set at construction and will not change.

Returns

  • the number of columns.
Build m5-rc15i - 10 Jun 2008 13:54