|
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
umontreal.iro.lecuyer.xmlconfig.ArrayParam2D
public class ArrayParam2D
Represents a parameter object containing a 2D array or a matrix of
parameters. When a creater method constructs such a parameter object, it
needs to specify a component class for the elements in the 2D array. The
component class can be any non-array primitive type or class supported by
StringConvert
. It is recommended to use this class as a temporary
placeholder. A creater method constructs and returns an instance whereas an
adder method receives the configured instance and extracts the array, without
having to keep the parameter object.
In the XML file, two formats are allowed to represent this parameter. The 2D
array can be specified as a list of arrays or one row element can be
used for each row of the 2D array. As with ArrayParam
, the
row elements supports the repeat attribute.
For example,
<matrix> {1, 2,3}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {9, 11,13} </matrix>is equivalent to
<matrix> <row>1,2,3</row> <row repeat="4">4, 5</row> <row> 9 , 11, 13</row> </matrix>
Matrices can also be specified externally
by using the CSV or DB
sub-elements. See ParamWithSourceArray
for more information.
Nested Class Summary | |
---|---|
static class |
ArrayParam2D.MatrixRowParam
For internal use only. |
Constructor Summary | |
---|---|
ArrayParam2D(Class<?> componentClass)
Constructs a new 2D array parameter with components of class componentClass. |
Method Summary | |
---|---|
ArrayParam2D |
clone()
|
ArrayParam2D.MatrixRowParam |
createRow()
For internal use only. |
boolean[][] |
getBooleanValues()
Converts the objects returned by getValues() to boolean
and returns the resulting 2D array. |
byte[][] |
getByteValues()
Converts the objects returned by getValues() to byte and
returns the resulting 2D array. |
char[][] |
getCharValues()
Converts the objects returned by getValues() to char and
returns the resulting 2D array. |
Class<?> |
getComponentClass()
Returns the class of the components in this array parameter. |
double[][] |
getDoubleValues()
Converts the objects returned by getValues() to double and
returns the resulting 2D array. |
float[][] |
getFloatValues()
Converts the objects returned by getValues() to float and
returns the resulting 2D array. |
int[][] |
getIntValues()
Converts the objects returned by getValues() to int and
returns the resulting 2D array. |
long[][] |
getLongValues()
Converts the objects returned by getValues() to long and
returns the resulting 2D array. |
short[][] |
getShortValues()
Converts the objects returned by getValues() to short and
returns the resulting 2D array. |
Object[][] |
getValues()
Returns the values in the 2D array represented by this parameter object. |
boolean |
isAttributeSupported(String a)
For internal use only. |
void |
nestedText(ParamReader reader,
String str)
For internal use only. |
void |
setValues(Object[][] m)
Sets the 2D array to m. |
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.ParamWithSourceArray |
---|
addCSV, addDB, addExcel, disposeSourceArray, getDataMatrix, getNumColumn, getNumRows, getSourceSubset, getStartingColumn, getStartingRow, initSourceArray, isTransposed, setDataMatrix, setNumColumns, setNumRows, setStartingColumn, setStartingRow, setTransposed |
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 ArrayParam2D(Class<?> componentClass)
componentClass
- the component class.
NullPointerException
- if componentClass is null.
IllegalArgumentException
- if componentClass is an array class.Method Detail |
---|
public Class<?> getComponentClass()
public Object[][] getValues()
ParamReadException
- if no 2D array was specified.public float[][] getFloatValues()
getValues()
to float and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public double[][] getDoubleValues()
getValues()
to double and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public int[][] getIntValues()
getValues()
to int and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public short[][] getShortValues()
getValues()
to short and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public long[][] getLongValues()
getValues()
to long and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public byte[][] getByteValues()
getValues()
to byte and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public char[][] getCharValues()
getValues()
to char and
returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public boolean[][] getBooleanValues()
getValues()
to boolean
and returns the resulting 2D array.
IllegalStateException
- if the component class is incompatible.public void setValues(Object[][] m)
IllegalArgumentException
.
m
- the new 2D array.
NullPointerException
- if m is null.
IllegalArgumentException
- if the component class is incompatible with m.public boolean isAttributeSupported(String a)
public ArrayParam2D.MatrixRowParam createRow()
public void nestedText(ParamReader reader, String str)
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
toElement
in class ParamWithSourceArray
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 ArrayParam2D clone()
clone
in class ParamWithSourceArray
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |