ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.xmlbind
Interface SourceArray2D

All Superinterfaces:
Closeable
All Known Implementing Classes:
CSVSourceArray2D, SourceSubset2D

public interface SourceArray2D
extends Closeable

Represents a 2D array obtained from a data source such a text file, or a spreadsheet. Such a source array can be used to create 1D or 2D arrays. The rows(), columns(int), and get(Class,int,int) methods can then be used to inspect the array.


Method Summary
 void close()
          Clears the data in the source array.
 int columns(int row)
          Returns the number of columns in row row of the source array.
<T> T
get(Class<T> pcls, int row, int column)
          Returns the element at row row and column column of the source array, converted to class pcls.
 int rows()
          Returns the number of rows in the source array.
 

Method Detail

rows

int rows()
Returns the number of rows in the source array.

Returns:
the number of rows in the array.

columns

int columns(int row)
Returns the number of columns in row row of the source array.

Parameters:
row - the row to test.
Returns:
the number of columns in the row.
Throws:
IllegalArgumentException - if the row index is out of bounds.

get

<T> T get(Class<T> pcls,
          int row,
          int column)
Returns the element at row row and column column of the source array, converted to class pcls.

Type Parameters:
T - the target class.
Parameters:
pcls - the target class.
row - the row index.
column - the column index.
Returns:
the element.
Throws:
IllegalArgumentException - if the row or column indices are out of bounds.
ClassCastException - if the element cannot be converted to the target class.

close

void close()
Clears the data in the source array.

Specified by:
close in interface Closeable

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.