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.xmlconfig
Class ExcelSourceArray2D

    java.lang.Object
      umontreal.iro.lecuyer.xmlconfig.AbstractParam
          umontreal.iro.lecuyer.xmlconfig.ExcelSourceArray2D

All Implemented Interfaces:
  Cloneable, Param, SourceArray2D, StorableParam

    public class ExcelSourceArray2D

extends AbstractParam
implements SourceArray2D, Cloneable, StorableParam

Represents a source array whose contents is read from a Microsoft Excel workbook. Each row of the sheet with the given name, and contained in the workbook pointed to by a URL becomes a row of the source array, with elements of the row separated using commas. Data is read using JExcel API.

In the XML file, the `URL` attribute of an element representing a Excel source array must be used to indicate the URL of the data file. The `sheetName` attribute can also be used to indicate the name of a sheet. By default, the first sheet is read.

Constructor Summary
`ExcelSourceArray2D()`

Method Summary
`static void` | `clearCache()`
`ExcelSourceArray2D` | `clone()`
`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.
`String` | `getSheetName()` Returns the name of the sheet to extract data from.
`URL` | `getURL()` Returns the URL of the text file containing the values of the array, in CSV format.
`void` | `init()` Initializes the source array.
`int` | `rows()` Returns the number of rows in the source array.
`void` | `setSheetName(String sheetName)` Sets the sheet name to `sheetName`.
`void` | `setURL(URL url)` Sets the URL pointing to the CSV file containing the elements of this array to `url`.
`Element` | `toElement(ClassFinder finder, Node parent, String elementName, int spc)` Converts this parameter object to a DOM element using the class finder `finder` for formatting class names, with parent node `parent`, element name `elementName`, and `spc` spaces for each indentation level.

Methods inherited from class umontreal.iro.lecuyer.xmlconfig.AbstractParam
`check, createDocument, getId, getXref, setId, setXref, toString, write, write, write, write, write, write, write, write`

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

Constructor Detail

### ExcelSourceArray2D

    public ExcelSourceArray2D()

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.

### setURL

    public void setURL(URL url)

  Sets the URL pointing to the CSV file containing the elements of this array to `url`.

  Parameters:
    `url` - the URL of the data.

### getSheetName

    public String getSheetName()

  Returns the name of the sheet to extract data from.

  Returns:
    the name of the sheet.

### setSheetName

    public void setSheetName(String sheetName)

  Sets the sheet name to `sheetName`.

  Parameters:
    `sheetName` - the sheet name.

### 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)
          throws UnsupportedConversionException

  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.
  Throws:
    `UnsupportedConversionException`

### init

    public void init()

  Description copied from interface: `SourceArray2D`
  Initializes the source array.

  Specified by:
    `init` in interface `SourceArray2D`

### 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.

### toElement

    public Element toElement(ClassFinder finder,
                             Node parent,
                             String elementName,
                             int spc)

  Description copied from interface: `StorableParam`
  Converts this parameter object to a DOM element using the class finder `finder` for formatting class names, with parent node `parent`, element name `elementName`, and `spc` spaces for each indentation level. The method must create an `Element` instance with name `elementName` and add it to the node `parent` of the DOM tree. It is recommended to use `DOMUtils` helper methods for this. After the element is created, attributes can be set and nested contents can be added. The configured DOM element is then returned.

  Specified by:
    `toElement` in interface `StorableParam`
  Parameters:
    `finder` - the class finder used to format class names.
    `parent` - the parent of the new element.
    `elementName` - the name of the constructed element.
    `spc` - the number of spaces for each indentation level.
  Returns:
    the newly-constructed element.

### dispose

    public void dispose()

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

  Specified by:
    `dispose` in interface `SourceArray2D`

### clone

    public ExcelSourceArray2D clone()

  Overrides:
    `clone` in class `Object`

### getElementName

    public String getElementName()

  Description copied from interface: `SourceArray2D`
  Returns the name of the XML element representing the type of source array implemented.

  Specified by:
    `getElementName` in interface `SourceArray2D`
  Returns:
    the name of the XML representing the array type.

### clearCache

    public static void clearCache()

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.