All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface javax.infobus.ArrayAccess

public interface ArrayAccess
DataItems that implement the ArrayAccess interface are collections of DataItems organized in an n-dimensional array. The ArrayAccess interface contains methods to determine dimensions, obtain individual elements of the data set, to iterate over all elements in the data set, and to subdivide one ArrayAccess object into another ArrayAccess.

Version:
$Revision: 1.10 $ $Date: 08 Mar 1998 22:18:28 $

Method Index

 o getDimensions()
Returns an array of integers which has the same number of elements as the number of dimensions in the ArrayAccess and where each integer value is the the number of elements in the respective ArrayAccess dimension.
 o getItemByCoordinates(int[])
Returns the DataItem corresponding to the given coordinates.
 o setItemByCoordinates(int[], Object)
Sets a new value for an item at the indicated coordinates in an ArrayAccess.
 o subdivide(int[], int[])
Returns a subset ArrayAccess of this ArrayAccess.

Methods

 o getItemByCoordinates
 public abstract Object getItemByCoordinates(int coordinates[])
Returns the DataItem corresponding to the given coordinates. Valid coordinates for dimension k are 0 to (getDimensions()[k] - 1).

Parameters:
coordinates - the coordinates of the desired DataItem in array form
Returns:
the DataItem located at the given coordinates
Throws: ArrayIndexOutOfBoundsException
if any of coordinates[k] are less than 0 or greater than getDimensions()[k] - 1
 o setItemByCoordinates
 public abstract void setItemByCoordinates(int coordinates[],
                                           Object newValue) throws InvalidDataException
Sets a new value for an item at the indicated coordinates in an ArrayAccess. Setting a data item via this method should not affect Iterators for other access interfaces on the object that implements ArrayAccess. Indexing in each dimension is zero-based; that is, coordinates[i] range from 0 to (getDimensions()[i] - 1 ), to agree with Java arrays. We recommend that all producers accept an ImmediateAccess, if present, as the source of a new value, but also allow for producers to accept other types of Objects that make sense for the application.

Parameters:
coordinates - the coordinates of the element to set
newValue - the new value of the element
Throws: InvalidDataException
if changes are supported but newValue is not a legal value for the element
Throws: UnsupportedOperationException
if changes are not supported
 o subdivide
 public abstract ArrayAccess subdivide(int startCoordinates[],
                                       int endCoordinates[])
Returns a subset ArrayAccess of this ArrayAccess. For each dimension k, endCoordinates[k] must be greater than or equal to startCoordinates[k]. The indexes of the returned ArrayAccess are readjusted to be zero-based.

Parameters:
startCoordinates - the coordinates in the original ArrayAccess of the first item in the desired subset
endCoordinates - the coordinates in the original ArrayAccess of the last item in the desired subset
Returns:
a subset ArrayAccess defined by startCoordinates and endCoordinates
Throws: ArrayIndexOutOfBoundsException
if any of startCoordinates[k] or endCoordinates[k] are less than 0 or greater than getDimensions()[k] - 1, or if endCoordinates[k] is less than startCoordinates[k]
 o getDimensions
 public abstract int[] getDimensions()
Returns an array of integers which has the same number of elements as the number of dimensions in the ArrayAccess and where each integer value is the the number of elements in the respective ArrayAccess dimension. For example, a return value of {5,6,7} indicates a 5 x 6 x 7 three-dimensional ArrayAccess.

Returns:
array of dimension sizes

All Packages  Class Hierarchy  This Package  Previous  Next  Index