SSJ
3.3.1
Stochastic Simulation in Java
|
This class represents a data field from a file read by an instance of a class implementing DataReader. More...
Public Member Functions | |
DataField (String label, Object data) | |
Constructor. More... | |
DataField (String label, Object data, int effectiveLength) | |
Constructor. More... | |
Information on the field | |
String | getLabel () |
Returns the field label (or name). | |
Class | getType () |
Returns the type of the field. | |
boolean | isAtomic () |
Returns true if the field value is atomic data. | |
boolean | isArray () |
Returns true if the field contains an array. | |
boolean | isArray2D () |
Returns true if the field contains a two-dimensional array. | |
int | getArrayLength () |
Returns the length of the array contained by the field, or -1 if it is not an array. | |
boolean | isString () |
Returns true if the field value is an atomic String . | |
boolean | isInt () |
Returns true if the field value is an atomic int . | |
boolean | isFloat () |
Returns true if the field value is an atomic float . | |
boolean | isDouble () |
Returns true if the field value is an atomic double . | |
Obtaining the value as atomic data | |
String | asString () |
Returns the value as String , or null if it is not of type String . More... | |
int | asInt () |
Returns the value as int or 0 if it is not of type int See isInt. | |
float | asFloat () |
Returns the value as float or 0 if it is not of type float See isFloat. | |
double | asDouble () |
Returns the value as double or 0 if it is not of type double See isDouble. | |
Obtaining the value as a one-dimensional array | |
String [] | asStringArray () |
Returns the value as one-dimensional String array or null if it is not of type String[] . | |
int [] | asIntArray () |
Returns the value as one-dimensional int array or null if it is not of type int[] . | |
float [] | asFloatArray () |
Returns the value as one-dimensional float array or null if it is not of type float[] . | |
double [] | asDoubleArray () |
Returns the value as one-dimensional double array or null if it is not of type double[] . | |
Obtaining the value as a two-dimensional array | |
String [][] | asStringArray2D () |
Returns the value as two-dimensional String array or null if it is not of type String[][] . | |
int [][] | asIntArray2D () |
Returns the value as two-dimensional int array or null if it is not of type int[][] . | |
float [][] | asFloatArray2D () |
Returns the value as two-dimensional float array or null if it is not of type float[][] . | |
double [][] | asDoubleArray2D () |
Returns the value as two-dimensional double array or null if it is not of type double[][] . | |
Obtaining the value as an `Object` | |
Object | asObject () |
Returns the value of the field as an Object . | |
Protected Attributes | |
String | label |
Object | data |
int | effectiveLength |
This class represents a data field from a file read by an instance of a class implementing DataReader.
DataField | ( | String | label, |
Object | data | ||
) |
Constructor.
Creates a field named label
of value data
.
label | name of the field |
data | value of the field |
DataField | ( | String | label, |
Object | data, | ||
int | effectiveLength | ||
) |
Constructor.
Creates a field named label
of value data
. effectiveLength
is the number of significant elements contained in data
if it is an array.
label | name of the field |
data | value of the field |
effectiveLength | number of significant elements contained in data |
String asString | ( | ) |
Returns the value as String
, or null
if it is not of type String
.
See isString.