|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.xmlconfig.AbstractParam
umontreal.iro.lecuyer.xmlconfig.ParamWithSourceArray
public class ParamWithSourceArray
Represents a parameter object whose contents can be extracted from a source subset created from a source array. The source array is created by reading data from an external source such as a CSV file or a database. The source subset is then constructed by taking a possibly transposed portion of the source array.
In an XML element whose parameters are extracted from
a source array,
the source array is described using the CSV or DB
subelements.
The CSV element, represented
by CSVSourceArray2D
, takes a single URL attribute
pointing to a CSV-formatted text file containing the data.
The DB element, represented
by DBSourceArray2D
, requires a
dataQuery attribute giving
the query to perform on a database described by
a database subelement.
A single source array can contain information for multiple destination arrays. For example, a spreadsheet containing one column of arrival rates for each call type might be exported to CSV, and used as a source array. Therefore, facilities are provided to subset the source array. For this, the startingRow, startingColumn, numRows, and numColumns attributes of a can be used to indicate the portion of the source array to consider. The first two attributes give the (zero-based) starting row and column of the subset. These are optional and defaults to 0. The last two attributes give the dimensions of the subset. If the number of rows [columns] is omitted, it defaults to the number of rows [columns] in the source array minus the starting row [column]. If the resulting subarray is rectangular, it can finally be transposed by using the transposed boolean attribute. This latter boolean attribute is also optional, and defaults to false, i.e., no transposition.
Constructor Summary | |
---|---|
ParamWithSourceArray()
|
Method Summary | |
---|---|
void |
addCSV(CSVSourceArray2D dataMatrix)
|
void |
addDB(DBSourceArray2D dataMatrix)
|
void |
addExcel(ExcelSourceArray2D dataMatrix)
|
ParamWithSourceArray |
clone()
|
void |
disposeSourceArray()
Clears the data in the source array. |
SourceArray2D |
getDataMatrix()
Returns the matrix from which the data is extracted. |
int |
getNumColumn()
Returns the number of columns to be extracted when the array comes from an external source. |
int |
getNumRows()
Returns the number of rows to be extracted when the array comes from an external source. |
SourceArray2D |
getSourceSubset()
Returns the source subset used to extract data. |
int |
getStartingColumn()
Determines the first column to read in the matrix. |
int |
getStartingRow()
Determines the first row to read in the matrix. |
void |
initSourceArray()
Initializes the source array associated with this object. |
boolean |
isTransposed()
Determines if the matrix of data must be transposed before data is extracted. |
void |
setDataMatrix(SourceArray2D dataMatrix)
Sets the matrix to extract data from to dataMatrix. |
void |
setNumColumns(int numColumns)
Sets the number of columns to be extracted from an external source to construct this array to numColumns |
void |
setNumRows(int numRows)
Sets the number of rows to be extracted from an external source to construct this array to numRows |
void |
setStartingColumn(int startingColumn)
Sets the starting column to extract external data from to startingColumn. |
void |
setStartingRow(int startingRow)
Sets the starting row to extract external data from to startingRow. |
void |
setTransposed(boolean transposed)
Sets the matrix transposition indicator to transposedDataMatrix. |
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 |
---|
public ParamWithSourceArray()
Method Detail |
---|
public SourceArray2D getDataMatrix()
public void setDataMatrix(SourceArray2D dataMatrix)
dataMatrix
- the new matrix to extract data from.public boolean isTransposed()
public void setTransposed(boolean transposed)
transposed
- the new value of the indicator.public int getStartingRow()
public void setStartingRow(int startingRow)
startingRow
- the starting row.public int getNumRows()
Integer.MAX_VALUE
,
all available rows, starting from
getStartingRow()
are extracted.
The default number of rows is
Integer.MAX_VALUE
.
public void setNumRows(int numRows)
numRows
- public int getStartingColumn()
public void setStartingColumn(int startingColumn)
startingColumn
- the starting column.public int getNumColumn()
Integer.MAX_VALUE
,
all available columns, starting from
getStartingColumn()
are extracted.
The default number of rows is
Integer.MAX_VALUE
.
public void setNumColumns(int numColumns)
numColumns
- the number of columns.public void addCSV(CSVSourceArray2D dataMatrix)
public void addDB(DBSourceArray2D dataMatrix)
public void addExcel(ExcelSourceArray2D dataMatrix)
public Element toElement(ClassFinder finder, Node parent, String elementName, int spc)
StorableParam
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.
toElement
in interface StorableParam
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.
public ParamWithSourceArray clone()
clone
in class Object
public void initSourceArray()
public void disposeSourceArray()
public SourceArray2D getSourceSubset()
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |