SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.util.io.DataField Class Reference

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.
 DataField (String label, Object data, int effectiveLength)
 Constructor.
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.
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 <tt>Object</tt> @{
Object asObject ()
 Returns the value of the field as an Object.

Detailed Description

This class represents a data field from a file read by an instance of a class implementing DataReader.

Definition at line 35 of file DataField.java.

Constructor & Destructor Documentation

◆ DataField() [1/2]

umontreal.ssj.util.io.DataField.DataField ( String label,
Object data )

Constructor.

Creates a field named label of value data.

Parameters
labelname of the field
datavalue of the field

Definition at line 46 of file DataField.java.

◆ DataField() [2/2]

umontreal.ssj.util.io.DataField.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.

Parameters
labelname of the field
datavalue of the field
effectiveLengthnumber of significant elements contained in data

Definition at line 58 of file DataField.java.

Member Function Documentation

◆ asDouble()

double umontreal.ssj.util.io.DataField.asDouble ( )

Returns the value as double or 0 if it is not of type double See isDouble.

Definition at line 178 of file DataField.java.

◆ asDoubleArray()

double[] umontreal.ssj.util.io.DataField.asDoubleArray ( )

Returns the value as one-dimensional double array or null if it is not of type double[].

Definition at line 218 of file DataField.java.

◆ asDoubleArray2D()

double[][] umontreal.ssj.util.io.DataField.asDoubleArray2D ( )

Returns the value as two-dimensional double array or null if it is not of type double[][].

Definition at line 258 of file DataField.java.

◆ asFloat()

float umontreal.ssj.util.io.DataField.asFloat ( )

Returns the value as float or 0 if it is not of type float See isFloat.

Definition at line 170 of file DataField.java.

◆ asFloatArray()

float[] umontreal.ssj.util.io.DataField.asFloatArray ( )

Returns the value as one-dimensional float array or null if it is not of type float[].

Definition at line 210 of file DataField.java.

◆ asFloatArray2D()

float[][] umontreal.ssj.util.io.DataField.asFloatArray2D ( )

Returns the value as two-dimensional float array or null if it is not of type float[][].

Definition at line 250 of file DataField.java.

◆ asInt()

int umontreal.ssj.util.io.DataField.asInt ( )

Returns the value as int or 0 if it is not of type int See isInt.

Definition at line 162 of file DataField.java.

◆ asIntArray()

int[] umontreal.ssj.util.io.DataField.asIntArray ( )

Returns the value as one-dimensional int array or null if it is not of type int[].

Definition at line 202 of file DataField.java.

◆ asIntArray2D()

int[][] umontreal.ssj.util.io.DataField.asIntArray2D ( )

Returns the value as two-dimensional int array or null if it is not of type int[][].

Definition at line 242 of file DataField.java.

◆ asObject()

Object umontreal.ssj.util.io.DataField.asObject ( )

Returns the value of the field as an Object.

Definition at line 273 of file DataField.java.

◆ asString()

String umontreal.ssj.util.io.DataField.asString ( )

Returns the value as String, or null if it is not of type String.

See isString.

Definition at line 155 of file DataField.java.

◆ asStringArray()

String[] umontreal.ssj.util.io.DataField.asStringArray ( )

Returns the value as one-dimensional String array or null if it is not of type String[].

Definition at line 194 of file DataField.java.

◆ asStringArray2D()

String[][] umontreal.ssj.util.io.DataField.asStringArray2D ( )

Returns the value as two-dimensional String array or null if it is not of type String[][].

Definition at line 234 of file DataField.java.

◆ getArrayLength()

int umontreal.ssj.util.io.DataField.getArrayLength ( )

Returns the length of the array contained by the field, or -1 if it is not an array.

Definition at line 107 of file DataField.java.

◆ getLabel()

String umontreal.ssj.util.io.DataField.getLabel ( )

Returns the field label (or name).

Definition at line 71 of file DataField.java.

◆ getType()

Class umontreal.ssj.util.io.DataField.getType ( )

Returns the type of the field.

Definition at line 78 of file DataField.java.

◆ isArray()

boolean umontreal.ssj.util.io.DataField.isArray ( )

Returns true if the field contains an array.

Definition at line 92 of file DataField.java.

◆ isArray2D()

boolean umontreal.ssj.util.io.DataField.isArray2D ( )

Returns true if the field contains a two-dimensional array.

Definition at line 99 of file DataField.java.

◆ isAtomic()

boolean umontreal.ssj.util.io.DataField.isAtomic ( )

Returns true if the field value is atomic data.

Definition at line 85 of file DataField.java.

◆ isDouble()

boolean umontreal.ssj.util.io.DataField.isDouble ( )

Returns true if the field value is an atomic double.

Definition at line 139 of file DataField.java.

◆ isFloat()

boolean umontreal.ssj.util.io.DataField.isFloat ( )

Returns true if the field value is an atomic float.

Definition at line 132 of file DataField.java.

◆ isInt()

boolean umontreal.ssj.util.io.DataField.isInt ( )

Returns true if the field value is an atomic int.

Definition at line 125 of file DataField.java.

◆ isString()

boolean umontreal.ssj.util.io.DataField.isString ( )

Returns true if the field value is an atomic String.

Definition at line 118 of file DataField.java.


The documentation for this class was generated from the following file: