ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.xmlconfig
Interface SourceArray2D

All Known Implementing Classes:
CSVSourceArray2D, DBSourceArray2D, ExcelSourceArray2D, SourceSubset2D

public interface SourceArray2D

Represents a 2D array obtained from a data source such a text file, or a database. Such a source array can be used to create 1D or 2D arrays. Any implementation of this interface must be initialized through the init() method before elements can be extracted from the source array. The rows(), columns(int), and get(Class,int,int) methods can then be used to inspect the array.


Method Summary
 int columns(int row)
          Returns the number of columns in row row of the source array.
 void dispose()
          Clears the data in 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.
 String getElementName()
          Returns the name of the XML element representing the type of source array implemented.
 void init()
          Initializes the source array.
 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.
Throws:
IllegalStateException - if the array was not initialized.

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:
IllegalStateException - if the source array was not initialized.
IllegalArgumentException - if the row index is out of bounds.

get

<T> T get(Class<T> pcls,
          int row,
          int column)
      throws UnsupportedConversionException
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.
IllegalStateException - if the array was not initialized.
ClassCastException - if the element cannot be converted to the target class.
UnsupportedConversionException

init

void init()
Initializes the source array.

Throws:
IllegalStateException - if the source array cannot be initialized.

dispose

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


getElementName

String getElementName()
Returns the name of the XML element representing the type of source array implemented.

Returns:
the name of the XML representing the array type.

ContactCenters
V. 0.9.9.

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