Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.xmlbind
Class CSVSourceArray2D

    java.lang.Object
      umontreal.iro.lecuyer.xmlbind.CSVSourceArray2D

All Implemented Interfaces:
  Closeable, SourceArray2D

    public class CSVSourceArray2D

extends Object
implements SourceArray2D

Represents a source array whose contents is read from a CSV-formatted text file. Each line of the text file pointed to by a URL becomes a row of the source array, with elements of the row separated using commas. Text is read using `TextDataReader.readCSVData(URL,char,char)` with `,` as the column delimiter and `"` as the string delimiter, while `StringConvert.fromString(URI,ClassFinder,Class,String)` is used to convert strings to target objects.

In the XML file, the `URL` attribute of an element representing a CSV source array must be used to indicate the URL of the CSV data file.

Constructor Summary
`CSVSourceArray2D(Node node, String uri)`
`CSVSourceArray2D(URL url)`

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`.
`URL` | `getURL()` Returns the URL of the text file containing the values of the array, in CSV format.
`int` | `rows()` Returns the number of rows in the source array.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CSVSourceArray2D

    public CSVSourceArray2D(URL url)

### CSVSourceArray2D

    public CSVSourceArray2D(Node node,
                            String uri)
                     throws URISyntaxException,
                            MalformedURLException

Throws:
  `URISyntaxException`
  `MalformedURLException`

Method Detail

### getURL

    public URL getURL()

  Returns the URL of the text file containing the values of the array, in CSV format.

  Returns:
    the URL of the CSV data.

### columns

    public int columns(int row)

  Description copied from interface: `SourceArray2D`
  Returns the number of columns in row `row` of the source array.

  Specified by:
    `columns` in interface `SourceArray2D`
  Parameters:
    `row` - the row to test.
  Returns:
    the number of columns in the row.

### get

    public <T> T get(Class<T> pcls,
                     int row,
                     int column)

  Description copied from interface: `SourceArray2D`
  Returns the element at row `row` and column `column` of the source array, converted to class `pcls`.

  Specified by:
    `get` in interface `SourceArray2D`
  Type Parameters:
    `T` - the target class.
  Parameters:
    `pcls` - the target class.
    `row` - the row index.
    `column` - the column index.
  Returns:
    the element.

### rows

    public int rows()

  Description copied from interface: `SourceArray2D`
  Returns the number of rows in the source array.

  Specified by:
    `rows` in interface `SourceArray2D`
  Returns:
    the number of rows in the array.

### close

    public void close()

  Description copied from interface: `SourceArray2D`
  Clears the data in the source array.

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in interface `SourceArray2D`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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