|
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.ArrayParam
public class ArrayParam
Represents a parameter object containing an array of parameters. When a
creater method constructs this parameter object, it needs to indicate the
class of the components in the 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 supported for the array parameter. A list of comma-separated strings that will be converted to objects of the component class can be used as contents. Alternatively, the array can be encoded using a row nested element for each element. The row element supports the repeat attribute allowing the specification of the number of times an element must be repeated in the array.
Fo rexample,
<doublearray>2.3, 3.2, 3.2, 5.1</doublearray>is equivalent to
<doublearray> <row>2.3</row> <row repeat="2">3.2</row> <row>5.1</row> </doublearray>and can be converted into an array containing 2.3, 3.2, 3.2, and 5.1.
Arrays can also be specified externally
by using the CSV or DB
sub-elements. See ParamWithSourceArray
for more information.
The constructed source subset is read
row by row to obtain an array of objects.
This class provides methods to get the extracted array as well as methods for the primitive types.
Nested Class Summary | |
---|---|
static class |
ArrayParam.RowParam
For internal use only. |
Constructor Summary | |
---|---|
ArrayParam(Class<?> componentClass)
|
|
ArrayParam(Class<?> componentClass,
String elementName)
Constructs a new array parameter with components of class componentClass. |
Method Summary | |
---|---|
ArrayParam |
clone()
|
void |
defaultNestedElement(ParamReader reader,
Element cel)
For internal use only. |
boolean[] |
getBooleanValues()
Converts the objects returned by getValues() to boolean
and returns the resulting array. |
byte[] |
getByteValues()
Converts the objects returned by getValues() to byte and
returns the resulting array. |
char[] |
getCharValues()
Converts the objects returned by getValues() to char and
returns the resulting 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 array. |
float[] |
getFloatValues()
Converts the objects returned by getValues() to float and
returns the resulting array. |
int[] |
getIntValues()
Converts the objects returned by getValues() to int and
returns the resulting array. |
long[] |
getLongValues()
Converts the objects returned by getValues() to long and
returns the resulting array. |
short[] |
getShortValues()
Converts the objects returned by getValues() to short and
returns the resulting array. |
Object[] |
getValues()
Returns the associated array of objects. |
boolean |
isAttributeSupported(String a)
For internal use only. |
protected Param |
makeRow()
|
void |
nestedText(ParamReader reader,
String str)
For internal use only. |
void |
setValues(Object[] v)
Sets the array elements to v. |
Element |
toElement(ClassFinder finder,
Node parent,
String elementName1,
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 ArrayParam(Class<?> componentClass)
public ArrayParam(Class<?> componentClass, String elementName)
componentClass
- the component class.
NullPointerException
- if componentClass is null.
IllegalArgumentException
- if componentClass is an array class.Method Detail |
---|
public Class<?> getComponentClass()
public Object[] getValues()
public float[] getFloatValues()
getValues()
to float and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public double[] getDoubleValues()
getValues()
to double and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public int[] getIntValues()
getValues()
to int and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public short[] getShortValues()
getValues()
to short and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public long[] getLongValues()
getValues()
to long and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public byte[] getByteValues()
getValues()
to byte and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public char[] getCharValues()
getValues()
to char and
returns the resulting array.
IllegalStateException
- if the component class is incompatible.public boolean[] getBooleanValues()
getValues()
to boolean
and returns the resulting array.
IllegalStateException
- if the component class is incompatible.public void setValues(Object[] v)
IllegalArgumentException
.
v
- the values.
NullPointerException
- if v is null.
IllegalArgumentException
- if the component class is incompatible with v.public boolean isAttributeSupported(String a)
public void nestedText(ParamReader reader, String str)
public void defaultNestedElement(ParamReader reader, Element cel)
protected Param makeRow()
public Element toElement(ClassFinder finder, Node parent, String elementName1, 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.elementName1
- the name of the constructed element.spc
- the number of spaces for each indentation level.
public ArrayParam 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 |