IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Base class for CSV (comma separated files) representation, importer and exporter of sampled data and data definitions. More...
Classes | |
class | DataColumnDefinition |
Used to define which columns in a data table correspond to which input or output elements. More... | |
Public Member Functions | |
SampledDataCsv () | |
Construct a new CSV representation of sampled data and data definitions. More... | |
SampledDataCsv (int inputLength, int outputLength) | |
Construct a new CSV representation of sampled data and data definitions, with numbers of input parameters and output values specified. More... | |
bool | IsKey (string str, string keyString) |
Returns true if the specified string represents the specified keyword. More... | |
bool | IsSingleValueKey (string str) |
Returns a value indicating whether the specified string is a keyword for a field that has a single value (e.g. number of parameters or number of output values). More... | |
bool | IsElementTypeKey (string str) |
Returns a value indicating whether the specified string is a keyword indicating a specific value (e.g. KeyElementTypeInput or KeyElementTypeOutput). More... | |
bool | IsDefinitionKey (string str) |
Returns a value indicating whether the specified string is a keyword for a field that is a part of the data definition. More... | |
bool | IsDataKey (string str) |
Returns a value indicating whether the specified string is a keyword for a data field. More... | |
bool | IsDefinitionOrDataKey (string str) |
Returns a value indicating whether the specified string is a keyword for some field, either a part of data definition or a keyword that introduces data. More... | |
bool | IsKeyData (string str) |
Whether the specified string is a keyword introducing the sampled data. More... | |
bool | IsKeyElementTypeInput (string str) |
Whether the specified string is a keyword that marks the input data type. More... | |
bool | IsKeyElementTypeOutput (string str) |
Whether the specified string is a keyword that marks the output data type. More... | |
bool | IsKeyComment (string str) |
Whether the specified string is a keyword introducing a comment in the line that contains it. More... | |
bool | IsKeyNumInputParameters (string str) |
Whether the specified string is a keyword introducing the number of input parameters. More... | |
bool | IsKeyNumOutputValues (string str) |
Whether the specified string is a keyword introducing the number of output parameters. More... | |
bool | IsKeyNames (string str) |
Whether the specified string is a keyword introducing variable names. More... | |
bool | IsKeyTitles (string str) |
Whether the specified string is a keyword introducing variable titles. More... | |
bool | IsKeyDescriptions (string str) |
Whether the specified string is a keyword introducing variable descriptions. More... | |
bool | IsKeyElementTypes (string str) |
Whether the specified string is a keyword introducing variable element types (e.g. input/output). More... | |
bool | IsKeyElementIndices (string str) |
Whether the specified string is a keyword introducing variable element indices names. More... | |
bool | IsKeyMinimalValues (string str) |
Whether the specified string is a keyword introducing variable minimal values. More... | |
bool | IsKeyMaximalValues (string str) |
Whether the specified string is a keyword introducing variable maximal values. More... | |
bool | IsKeyScalingLengths (string str) |
Whether the specified string is a keyword introducing variable scaling lengths. More... | |
bool | IsKeyDefaultValues (string str) |
Whether the specified string is a keyword introducing variable default values. More... | |
bool | IsKeyNumSamplingPoints (string str) |
Whether the specified string is a keyword introducing variable for number of sampling points. More... | |
bool | IsKeyDiscretizationSteps (string str) |
Whether the specified string is a keyword introducing variable discretization steps. More... | |
bool | IsKeyTargetValues (string str) |
Whether the specified string is a keyword introducing variable target values. More... | |
bool | IsKeyOptimizationIndices (string str) |
Whether the specified string is a keyword introducing variable optimization indices. More... | |
string | GetPositionString () |
Returns the string indicating the current position in the form (row, column), e.g. "(23, 55)". More... | |
string | GetPositionString (int rowNum, int columnNum) |
Returns the string indicating the specified position position in the form (row, column), e.g. "(23, 55)". More... | |
bool | CheckIfDataColumnsDefined () |
Returns a flag defining whether all data columns in the data table are defined. More... | |
void | UpdateDataColumnDefinitions () |
Updates index lists for data column definitions for inputs (InputColumnDefinitions) and outputs (OutputColumnDefinitions), and sets the IsDataColumnDefinitionsUpdated flag to true if successful. More... | |
void | StoreDefinition () |
Stores data definitions to the data table. More... | |
void | StoreData () |
Stores sampled data to the data table. More... | |
void | StoreDefinitionAndData () |
Stores data definitions AND sampled data to the data table. More... | |
void | SaveDefinition (string filePath) |
Saves data definitions to the specified file. More... | |
void | SaveData (string filePath) |
Saves sampled data to the specified file. More... | |
void | SaveDefinitionAndData (string filePath) |
Saves data definitions AND sampled data to the specified file. More... | |
void | RestoreDefinition (bool resetPosition) |
Restores data definition from the data table. More... | |
void | RestoreDefinition () |
Restores data definition from the data table. Position is reset before the operation begins. More... | |
void | RestoreData (bool resetPosition) |
Restores sampled data from the data table, starting from the current position, i.e. (CurrentRow, CurrentColumn). More... | |
void | RestoreData () |
Restores sampled data definition from the data table. Position is reset before the operation begins. More... | |
void | RestoreDefinitionAndData (bool resetPosition) |
Restores data definition AND sampled data definition from the data table. More... | |
void | RestoreDefinitionAndData () |
Restores data definition AND sampled data definition from the data table. Position is reset before the operation begins. More... | |
void | LoadDefinition (string filePath) |
Loads data definition form the specified CSV file. More... | |
void | LoadData (string filePath) |
Loads sampled data form the specified CSV file. More... | |
void | LoadDefinitionAndData (string filePath) |
Loads data definition AND sampled data form the specified CSV file. More... | |
Public Member Functions inherited from IG.Lib.StringTable | |
StringTable (bool readOnly) | |
Constructs a new string table, a data structure compatible with CSV file format. More... | |
StringTable () | |
Constructs a new string table, a data structure compatible with CSV file format. More... | |
void | SetElement (int rowNumber, int columnNumber, string element) |
Sets element at the specified position to the specified value. More... | |
void | SetElement< ElementType > (int rowNumber, int columnNumber, ElementType elementValue) |
Sets element at the specified position to the string representation of the specified value. More... | |
ElementType | GetElement< ElementType > (int rowNumber, int columnNumber) |
Returns the element of the specified type at the specified position. More... | |
bool | TryGetElement< ElementType > (int rowNumber, int columnNumber, ref ElementType elementValue) |
Tries to obtain a value of the specified type at the specified position, and returns a flag indicating whether parsing the value from a string was successful (and the element existed). More... | |
bool | IsDefined< ElementType > (int rowNumber, int columnNumber) |
Returns a flag indicating whether the specified position contains a valid string representation of a element of the specified type. More... | |
bool | IsDefined (int rowNumber, int columnNumber) |
Returns a flag telling whether the specified element is defined (it exists in the data table) or not. More... | |
bool | IsNotNullOrEmpty (int rowNumber, int columnNumber) |
Returns a flag telling whether the specified element is defined (it exists in the data table) and is at the same time not null or empty string. More... | |
string | GetElementOrNull (int rowNumber, int columnNumber, out bool isDefined) |
Returns the specified element on the data table or null if that element is not defined, and notifies the caller through isDefined whether the element is defined or not. More... | |
string | GetElementOrNull (int rowNumber, int columnNumber) |
Returns the specified element on the data table or null if that element is not defined. More... | |
int | FirstNonemptyRow (int startRow) |
Returns index of the first non-empty row from the specified row on (inclusively), or -1 if there is no such row. More... | |
int | FirstNonemptyRow () |
Returns index of the first non-empty row of the table, or -1 if there is no such row. More... | |
int | FirstNonemptyColumn (int rowNum, int startColumn) |
Returns number of the first non-empty cell in the specified row, from the specified starting column on (inclusively), or -1 if there is no suuch column. More... | |
int | FirstNonemptyColumn (int rowNum) |
Returns number of the first non-empty cell in the specified row. More... | |
void | Clear () |
Clears the data table. More... | |
void | AddRow () |
Adds a new row at the end of the data table. More... | |
void | AddRow (params string[] elements) |
Adds a new row at the end of the data table. More... | |
void | AddRow< ElementType > (params ElementType[] elements) |
Adds (appends) a new row with the specified elements at the end of the table. More... | |
void | AddElement (int rowNum, string value) |
Adds a new element at the end of the specified row of te data table. More... | |
void | AddElement (string value) |
Adds (appends) the speecified element at the end of the table, i.e. at the end of the last row. More... | |
void | AddElement< ElementType > (int rowNum, ElementType value) |
Adds string representation of a new element of the specified type at the end of the specified row of te data table. More... | |
void | AddElement< ElementType > (ElementType value) |
Adds (appends) string representatin of the speecified element at the end of the table, i.e. at the end of the last row. More... | |
void | AddElements (int rowNum, params string[] values) |
Adds the specified elements at the end of the specified row of te data table. More... | |
void | AddElements< ElementType > (int rowNum, params ElementType[] values) |
Adds string representations of the specified elements of the specified type at the end of the specified row of te data table. More... | |
void | AddElements (params string[] values) |
Adds (appends ) the specified elements at the end of the table, i.e. at the end of the last row. More... | |
void | AddElements< ElementType > (params ElementType[] values) |
Adds (appends ) string representations of the specified elements of the specified type at the end of the table, i.e. at the end of the last row. More... | |
void | SetNumRows (int numRows) |
Change the number of rows in the data table to the specified number. More... | |
void | SetNumColumns (int rowNum, int numColumns) |
Changes the number of columns of the specified row to the specified number. More... | |
void | ClearRow (int rowNum) |
Clears the specified row in the data table. More... | |
int | NumColumns (int rowNum) |
Returns the number of elements (columns) of the specified row. More... | |
bool | IsInt (int rowNumber, int columnNumber) |
Returns a flag specified whether the specified element of the data table exists and represents an integer. More... | |
int | GetInt (int rowNumber, int columnNumber) |
Returns an integer value of the element at the specified position of the data table, if it is defined, or throws an exception. More... | |
bool | TryGetInt (int rowNumber, int columnNumber, out int value) |
Safely gets the integer value at the specified position of the data table, if it is defined, and notifies the caller whether it is defined. More... | |
void | GetIntSafe (int rowNumber, int columnNumber, out int value, out bool isElementDefined, out bool isElementNotNullOrEmpty, out bool isInt) |
Safely gets the integer value at the specified position of the data table, if it is defined, and notifies the caller on the status. More... | |
bool | IsDouble (int rowNumber, int columnNumber) |
Returns a flag specified whether the specified element of the data table exists and represents a number (of type double). More... | |
double | GetDouble (int rowNumber, int columnNumber) |
Returns a double value of the element at the specified position of the data table, if such element is defined and represents a number, or throws an exception otherwise. More... | |
bool | TryGetDouble (int rowNumber, int columnNumber, out double value) |
Safely gets the double value at the specified position of the data table, if it is defined, and notifies the caller whether it is defined. More... | |
void | GetDoubleSafe (int rowNumber, int columnNumber, out double value, out bool isElementDefined, out bool isElementNotNullOrEmpty, out bool isDouble) |
Safely gets the numerical value (of type double) at the specified position of the data table, if it is defined, and notifies the caller about the status. More... | |
void | LoadCsv (string filePath, string separator) |
Loads the specified CSV file. Reads contents of the file into the data table of the current object. More... | |
void | LoadCsv (string filePath) |
Loads the specified CSV file. Reads contents of the file into the data table of the current object. More... | |
override string | ToString () |
Converts the current string table to a string in CSV form and returns the string. More... | |
void | SaveCsv (string filePath, string separator, bool append) |
Saves the data of the current object to the specified CSV file. More... | |
void | SaveCsv (string filePath, string separator) |
Saves the data of the current object into a CSV file. If the file already exists then its contents are overwritten. More... | |
void | SaveCsv (string filePath, bool append) |
Saves the data of the current object into a CSV file. Constant UtilCsv.DefaultCsvSeparator is assumed to be a separator for the CSV format. More... | |
void | SaveCsv (string filePath) |
Saves the data of the current object values into a CSV file. If the file already exists then its contents are overwritten. Constant UtilCsv.DefaultCsvSeparator is assumed to be a separator for the CSV format. More... | |
Public Attributes | |
bool | _throwExceptionsOnDataErrors = false |
Public Attributes inherited from IG.Lib.StringTable | |
const string | DefaultCsvSeparator = "," |
The default separator in the CSV files - comma (","). More... | |
Protected Member Functions | |
void | ClearDataColumnDefinitions () |
Clears data column definitions. More... | |
void | StoreDefinition (bool clearFirst) |
Stores definition data to the data table. More... | |
void | StoreData (bool clearFirst) |
Stores the samples data to the data table. More... | |
void | StoreDefinitionAndData (bool clearFirst) |
Stores data definitions AND sampled data to the data table. More... | |
InputElementDefinition | GetInputElementDefinition (int whichElement) |
Gets the specified input element definition from DataDefinition. If data definition is not defined then it is created, and if it has less input elements than the required element index plus one, then new element definitions are created and added to it. More... | |
OutputElementDefinition | GetOutputElementDefinition (int whichElement) |
Gets the specified output element definition from DataDefinition. If data definition is not defined then it is created, and if it has less output elements than the required element index plus one, then new element definitions are created and added to it. More... | |
DataColumnDefinition | GetDataColumnDefinition (int dataColumnIndex) |
Returns the specified data column definition by its sequential number on the list of columns DataColumnDefinitions. More... | |
bool | ReadSingleInt (ref int value) |
Reads a single integer value. Current line and column must be set to its key. More... | |
void | FindFirstDataCell (int keyRow, int keyColumn, out int row, out int column) |
Finds the first data cell for data inroduced by a key, provided that the key that introduces the data is located at (keyRow , keyColumn ). More... | |
void | FindFirstDataCell (out int row, out int column) |
Finds the first data cell for data inroduced by a key, provided that the key that introduces the data is located at (CurrentRow, CurrentColumn). More... | |
void | GetDataColumnDefinitionsFromData (int keyRow, int keyColumn, bool isDouble, bool isInt) |
Extracts information about data columns from the data. More... | |
void | GetDataColumnDefinitionsFromData (bool isDouble, bool isInt) |
Extracts information about data columns from the data. More... | |
void | ReadElementTypes () |
Reads types of elements from the CSV-like string table, from the current position on (inclusively). More... | |
void | ReadElementIndices () |
Reads types of elements from the CSV, from the current position on (inclusively). More... | |
void | ReadStringData (ref string[] dataArray) |
Reads string values from the CSV-like string table, from the current position on (inclusively), and stores them into the provided array. More... | |
void | ReadDoubleData (ref double[] dataArray) |
Reads double values from the CSV-like string table, from the current position on (inclusively), and stores them into the provided array. More... | |
void | ReadIntData (ref int[] dataArray) |
Reads integer values from the CSV-like string table, from the current position on (inclusively), and stores them into the provided array. More... | |
void | ReadElementNames () |
Reads names of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementTitles () |
Reads titles of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementDescriptions () |
Reads descriptions of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementMinimalValues () |
Reads minimal values of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementMaximalValues () |
Reads maximal values of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementScalingLengths () |
Reads scaling lengths of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementDefaultValues () |
Reads default values of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementDiscretizationSteps () |
Reads discretization steps of input data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementNumSamplingPoints () |
Reads numberr of sampling points of input data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementTargetValues () |
Reads target values of input and output data elements from the CSV, from the current position on (inclusively). More... | |
void | ReadElementOptimizationIndices () |
Reads optimization indices of input and output data elements from the CSV, from the current position on (inclusively). More... | |
Properties | |
static bool | DefaultIsKeysCaseSensitive [get, set] |
Default value for the flag indicating whether keys should be treated as case sensitive. More... | |
static string | DefaultKeyData [get, protected set] |
Default key for introduction of sampled data. More... | |
static string | DefaultKeyElementTypeInput [get, protected set] |
Default element type keyword for input element. More... | |
static string | DefaultKeyElementTypeOutput [get, protected set] |
Default element type keyword for output element. More... | |
static string | DefaultKeyComment [get, protected set] |
Default key for comment in the current line. More... | |
static string | DefaultKeyNumInputParameters [get, protected set] |
Default key for introduction of number of input parameters. More... | |
static string | DefaultKeyNumOutputValues [get, protected set] |
Default key for introduction of number of output parameters. More... | |
static string | DefaultKeyNames [get, protected set] |
Default key for introduction of names of input and output data elements. More... | |
static string | DefaultKeyTitles [get, protected set] |
Default key for introduction of titles of input and output data elements. More... | |
static string | DefaultKeyDescriptions [get, protected set] |
Default key for introduction of descriptions of input and output data elements. More... | |
static string | DefaultKeyElementTypes [get, protected set] |
Default key for introduction of element types of input and output data elements (e.g. input/output). More... | |
static string | DefaultKeyElementIndices [get, protected set] |
Default key for introduction of element indices of input and output data elements. More... | |
static string | DefaultKeyMinimalValues [get, protected set] |
Default key for introduction of minimal values of input and output data elements. More... | |
static string | DefaultKeyMaximalValues [get, protected set] |
Default key for introduction of maximal values of input and output data elements. More... | |
static string | DefaultKeyDefaultValues [get, protected set] |
Default key for introduction of default values of input data elements. More... | |
static string | DefaultKeyScalingLengths [get, protected set] |
Default key for introduction of scaling lengths of input and output data elements. More... | |
static string | DefaultKeyDiscretizationSteps [get, protected set] |
Default key for introduction of discretization steps of input and output data elements. More... | |
static string | DefaultKeyNumSamplingPoints [get, protected set] |
Default key for introduction of number of sampling points of input and output data elements. More... | |
static string | DefaultKeyTargetValues [get, protected set] |
Default key for introduction of target values of input and output data elements. More... | |
static string | DefaultKeyOptimizationIndices [get, protected set] |
Default key for introduction of optimization indices of input and output data elements. More... | |
bool | IsKeysCaseSensitive [get, set] |
Whether keywords are case sensitive. More... | |
string | KeyData [get, protected set] |
Keyword that introduces the sampled data. More... | |
string | KeyElementTypeInput [get, protected set] |
A keyword string for input element type in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyElementTypeOutput [get, protected set] |
A keyword string for output element type in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyComment [get, protected set] |
A keyword string that introduces a commet in the containing line. More... | |
string | KeyNumInputParameters [get, protected set] |
A keyword string that introduces the number of input parameters in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyNumOutputValues [get, protected set] |
A keyword string that introduces the number of output parameters in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyNames [get, protected set] |
A keyword string that introduces variable names in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyTitles [get, protected set] |
A keyword string that introduces variable titles in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyDescriptions [get, protected set] |
A keyword string that introduces variable descriptions in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyElementTypes [get, protected set] |
A keyword string that introduces variable element types in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyElementIndices [get, protected set] |
A keyword string that introduces variable element indices in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyMinimalValues [get, protected set] |
A keyword string that introduces variable minimal values in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyMaximalValues [get, protected set] |
A keyword string that introduces variable maximal values in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyScalingLengths [get, protected set] |
A keyword string that introduces variable scaling lengths in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyDefaultValues [get, protected set] |
A keyword string that introduces variable default values in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyDiscretizationSteps [get, protected set] |
A keyword string that introduces variable discretization steps in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyNumSamplingPoints [get, protected set] |
A keyword string that introduces variable discretization steps in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyTargetValues [get, protected set] |
A keyword string that introduces variable target values in the CSV file containing sampled data and / or data definitions. More... | |
string | KeyOptimizationIndices [get, protected set] |
A keyword string that introduces variable optimization indices in the CSV file containing sampled data and / or data definitions. More... | |
InputOutputDataDefiniton | DataDefinition [get, set] |
SampledDataSet | SampledData [get, set] |
int | InputLength [get, set] |
Number of input elements. More... | |
int | OutputLength [get, set] |
Number of output values in the data. More... | |
int | CurrentRow [get, protected set] |
int | CurrentColumn [get, protected set] |
List< DataColumnDefinition > | DataColumnDefinitions [get] |
Contains definitions of data columns within the data table. More... | |
List< DataColumnDefinition > | InputColumnDefinitions [get] |
Contains definitions for input data columns, sorted by element indices. More... | |
List< DataColumnDefinition > | OutputColumnDefinitions [get] |
Contains definitions for output data columns, sorted by element indices. More... | |
bool | IsDataColumnDefinitionsUpdated [get, protected set] |
Whether complete information about data column definitions is up to date, including auciliary lists with sorted input and output definitions. More... | |
bool | KeyAndDataInSameRow [get, set] |
Whether keys and data are in the same row in data definition section wnen writing to CSV format. More... | |
int | Indentation [get, set] |
Offset - specifies in which column data columns begin when writing tyo CSV format. More... | |
bool | ThrowExceptionsOnDataErrors [get, set] |
Properties inherited from IG.Lib.StringTable | |
object | Lock [get] |
Object used for thread locking. More... | |
int | OutputLevel [get, set] |
Output level, specifies the level of descriptive output on console during the operation. More... | |
List< List< string > > | Data [get] |
Data behind the table - list of lists of strings. More... | |
bool | IsReadOnly [get, set] |
Whether or not data table is read only. More... | |
bool | IsAutoExtend [get, set] |
Whether or not data storage automatically extends when a value is set on the position that is out of range. More... | |
string | this[int rowNumber, int columnNumber] [get, set] |
Index operator, gets or sets the specific element of the data table specified by row and column number. More... | |
string[][] | Table [get, set] |
Gets or sets copy of the data table in form of 2D jagged array. More... | |
int | NumRows [get] |
Gets number of rows in the data table. More... | |
int | MaxNumColumns [get] |
Returns the maximal number of columns in any row. More... | |
bool | IsRectangular [get] |
Returns true if data table is rectangular (i.e. all rows have equal number of elements) or not. More... | |
string | CsvSeparator [get, set] |
Separator used in CSV files that this class loads data from or writes data to. More... | |
Properties inherited from IG.Lib.ILockable | |
object | Lock [get] |
Private Attributes | |
InputOutputDataDefiniton | _dataDefinition |
SampledDataSet | _sampledData |
int | _inputLength = -1 |
int | _outputLength = -1 |
List< DataColumnDefinition > | _outputColumnDefinitions = new List<DataColumnDefinition>() |
bool | _isDataColumnDefinitionsUpdated = false |
Static Private Attributes | |
static bool | _defaultIsKeysCaseSensitive = false |
static string | _defaultKeyData = "Data" |
static string | _defaultKeyElementTypeInput = "Input" |
static string | _defaultKeyElementTypeOutput = "Output" |
static string | _defaultKeyComment = "Comment" |
static string | _defaultKeyNumInputParameters = "NumInputs" |
static string | _defaultKeyNumOutputParameters = "NumOutputs" |
static string | _defaultKeyNames = "Names" |
static string | _defaultKeyTitles = "Titles" |
static string | _defaultKeyDescriptions = "Descriptions" |
static string | _defaultKeyElementTypes = "ElementTypes" |
static string | _defaultKeyElementIndices = "ElementIndices" |
static string | _defaultKeyMinimalValues = "MinimalValues" |
static string | _defaultKeyMaximalValues = "MaximalValues" |
static string | _defaultKeyDefaultValues = "DefaultValues" |
static string | _defaultKeySclaingLengths = "ScalingLengths" |
static string | _defaultKeyDiscretizationSteps = "DiscretizationSteps" |
static string | _defaultKeyNumSamplingPoints = "NumSamplingPoints" |
static string | _defaultKeyTargetValues = "TargetValues" |
static string | _defaultKeyOptimizationIndices = "OptimizationIndices" |
Additional Inherited Members | |
Static Public Member Functions inherited from IG.Lib.StringTable | |
static void | ExampleWriteCsv (string filePath) |
Creates a simple string table and saves it to a CSV file. More... | |
Static Public Attributes inherited from IG.Lib.StringTable | |
static int | DefaultOutputLevel = 0 |
Dafault output level for object of the StringTable and derived classes. More... | |
Base class for CSV (comma separated files) representation, importer and exporter of sampled data and data definitions.
$A Igo Oct08 Jul13;
|
inline |
Construct a new CSV representation of sampled data and data definitions.
|
inline |
Construct a new CSV representation of sampled data and data definitions, with numbers of input parameters and output values specified.
inputLength | Number of input parameters. |
outputLength | Number of output values. |
|
inline |
Returns true if the specified string represents the specified keyword.
Always use this method to verify if the string represents a specific key, sice it takes into account relevant internal parameters such as case sensitivity.
str | String that is checked against the specified keyword. |
keyString | Keyword ageinst which the string is checked. |
|
inline |
Returns a value indicating whether the specified string is a keyword for a field that has a single value (e.g. number of parameters or number of output values).
str | String that is queried. |
|
inline |
Returns a value indicating whether the specified string is a keyword indicating a specific value (e.g. KeyElementTypeInput or KeyElementTypeOutput).
str | String that is queried. |
|
inline |
Returns a value indicating whether the specified string is a keyword for a field that is a part of the data definition.
str | String that is queried. |
|
inline |
Returns a value indicating whether the specified string is a keyword for a data field.
str | String that is queried. |
|
inline |
Returns a value indicating whether the specified string is a keyword for some field, either a part of data definition or a keyword that introduces data.
str | String that is queried. |
|
inline |
Whether the specified string is a keyword introducing the sampled data.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword that marks the input data type.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword that marks the output data type.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing a comment in the line that contains it.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing the number of input parameters.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing the number of output parameters.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable names.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable titles.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable descriptions.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable element types (e.g. input/output).
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable element indices names.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable minimal values.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable maximal values.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable scaling lengths.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable default values.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable for number of sampling points.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable discretization steps.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable target values.
str | String that is checked. |
|
inline |
Whether the specified string is a keyword introducing variable optimization indices.
str | String that is checked. |
|
inline |
Returns the string indicating the current position in the form (row, column), e.g. "(23, 55)".
Rows and columns are counted form 1.
|
inline |
Returns the string indicating the specified position position in the form (row, column), e.g. "(23, 55)".
Rows and columns are counted form 1.
rowNum | Row number (counting from 0). |
columnNum | Column number (counting from 0). |
|
inlineprotected |
Clears data column definitions.
|
inline |
Returns a flag defining whether all data columns in the data table are defined.
|
inline |
Updates index lists for data column definitions for inputs (InputColumnDefinitions) and outputs (OutputColumnDefinitions), and sets the IsDataColumnDefinitionsUpdated flag to true if successful.
References IG.Num.SampledDataCsv.DataColumnDefinition.Column, IG.Num.InputOutputElementDefinition.ElementIndex, IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex, IG.Num.InputOutputElementDefinition.ElementIndexSpecified, IG.Num.SampledDataCsv.DataColumnDefinition.IsDefined(), IG.Num.SampledDataCsv.DataColumnDefinition.IsInput, and IG.Num.SampledDataCsv.DataColumnDefinition.IsInputOutputDefined.
|
inlineprotected |
Stores definition data to the data table.
clearFirst | Whether the data table is cleared before the operation begins. |
References IG.Num.InputOutputElementDefinition.BoundsDefined, IG.Num.InputElementDefinition.DefaultValue, IG.Num.InputElementDefinition.DefaultValueDefined, IG.Num.InputOutputElementDefinition.Description, IG.Num.InputElementDefinition.DiscretizationStep, IG.Num.InputOutputElementDefinition.MaximalValue, IG.Num.InputOutputElementDefinition.MinimalValue, IG.Num.InputOutputElementDefinition.Name, IG.Num.InputElementDefinition.NumSamplingPoints, IG.Num.InputElementDefinition.OptimizationIndex, IG.Num.InputElementDefinition.OptimizationIndexSpecified, IG.Num.InputOutputElementDefinition.ScalingLength, IG.Num.InputOutputElementDefinition.ScalingLengthDefined, IG.Num.InputOutputElementDefinition.TargetValue, IG.Num.InputOutputElementDefinition.TargetValueDefined, and IG.Num.InputOutputElementDefinition.Title.
|
inlineprotected |
Stores the samples data to the data table.
clearFirst | Whether the data table is cleared before the operation begins. |
References IG.Num.SampledDataElement.InputParameters, IG.Num.SampledDataElement.OutputValues, and IG.Num.IVector.ToString().
|
inlineprotected |
Stores data definitions AND sampled data to the data table.
clearFirst | Whether the data table is cleared before the operation begins. |
|
inline |
Stores data definitions to the data table.
The table is cleared first.
|
inline |
Stores sampled data to the data table.
The table is cleared first.
|
inline |
Stores data definitions AND sampled data to the data table.
The table is cleared first.
|
inline |
Saves data definitions to the specified file.
The file is overridden if it already exists.
filePath | Path to the file where data definitions are stored. |
|
inline |
Saves sampled data to the specified file.
The file is overridden if it already exists.
filePath | Path to the file where data is stored. |
|
inline |
Saves data definitions AND sampled data to the specified file.
The file is overridden if it already exists.
filePath | Path to the file where data is stored. |
Referenced by IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), and IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData().
|
inlineprotected |
Gets the specified input element definition from DataDefinition. If data definition is not defined then it is created, and if it has less input elements than the required element index plus one, then new element definitions are created and added to it.
Method does not check whether element index is out of range with respect to InputLength.
whichElement | Specifies which input element definition is returned. |
|
inlineprotected |
Gets the specified output element definition from DataDefinition. If data definition is not defined then it is created, and if it has less output elements than the required element index plus one, then new element definitions are created and added to it.
Method does not check whether element index is out of range with respect to OutputLength.
whichElement | Specifies which output element definition is returned. |
|
inlineprotected |
Returns the specified data column definition by its sequential number on the list of columns DataColumnDefinitions.
dataColumnIndex | Sequential number of the column data definition on the list of definitions. Definitions follow in the same order as the corresponding columns, but there may be gaps between them. |
|
inlineprotected |
Reads a single integer value. Current line and column must be set to its key.
After successful execution, current cell is set just after the value position.
|
inlineprotected |
Finds the first data cell for data inroduced by a key, provided that the key that introduces the data is located at (keyRow , keyColumn ).
keyRow | Row number of the cell containing the key that introduces the data. |
keyColumn | Column number of the cell containing the key that introduces the data. |
row | Variable where row number of the cell where data begins is stored. |
column | Variable where column number of the cell where data begins is stored. |
InvalidDataException | When the first data cell could not be located. |
|
inlineprotected |
Finds the first data cell for data inroduced by a key, provided that the key that introduces the data is located at (CurrentRow, CurrentColumn).
row | Variable where row number of the cell where data begins is stored. |
column | Variable where column number of the cell where data begins is stored. |
InvalidDataException | When the first data cell could not be located. |
|
inlineprotected |
Extracts information about data columns from the data.
keyRow | Row of the cell that contains the key that introduces the data from which information is extracted. |
keyColumn | Column of the cell that contains the key that introduces the data from which information is extracted. |
isDouble | Whether data elements are real numbers (e.g. of type double). |
isInt | Whether data elements are integer numbers. |
For tis method in order to work, data must be defined for all input and output elements, and no additional cells must be nonempty.
This method is called when one encounters data whose reading would already require infomration about data columns, but this information is not yet available from the definition data already read and must be inferred from the data itself. Conditions are that data cellls are in natural order (first input and then output elements in the correct order), that there are no non-empty cells in the data row from the beginning of data that do not belong to data, that all data columns (input and output) are defined and that input and output dimensions are known.
References IG.Num.SampledDataCsv.DataColumnDefinition.Column, IG.Num.SampledDataCsv.DataColumnDefinition.ColumnIndex, IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex, and IG.Num.SampledDataCsv.DataColumnDefinition.IsInput.
|
inlineprotected |
Extracts information about data columns from the data.
isDouble | Whether data elements are real numbers (e.g. of type double). |
isInt | Whether data elements are integer numbers. |
For tis method in order to work, data must be defined for all input and output elements, and no additional cells must be nonempty.
This method is called when one encounters data whose reading would already require infomration about data columns, but this information is not yet available from the definition data already read and must be inferred from the data itself. Conditions are that data cellls are in natural order (first input and then output elements in the correct order), that there are no non-empty cells in the data row from the beginning of data that do not belong to data, that all data columns (input and output) are defined and that input and output dimensions are known.
|
inlineprotected |
Reads types of elements from the CSV-like string table, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.SampledDataCsv.DataColumnDefinition.Column, IG.Num.SampledDataCsv.DataColumnDefinition.ColumnIndex, IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex, IG.Num.SampledDataCsv.DataColumnDefinition.IsInput, IG.Num.SampledDataCsv.DataColumnDefinition.IsInputOutputDefined, and IG.Num.SampledDataCsv.DataColumnDefinition.ToStringList().
|
inlineprotected |
Reads types of elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex, IG.Num.SampledDataCsv.DataColumnDefinition.IsInput, IG.Num.SampledDataCsv.DataColumnDefinition.IsInputOutputDefined, and IG.Num.SampledDataCsv.DataColumnDefinition.ToStringList().
|
inlineprotected |
Reads string values from the CSV-like string table, from the current position on (inclusively), and stores them into the provided array.
Array is sorted in such a way that values corresponding to input elements are included first, followed by values corresponding to output elements, both sorted by element indices.
After reading, current cell position is set to the first column after the last cell in the data.
If element positions are not yet known then they are established (if possible, otherwise exception is thrown).
Exception is thrown if values are not at expected positions.
dataArray | Array where string values read from data columns are stored. |
References IG.Num.SampledDataCsv.DataColumnDefinition.Column, and IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex.
|
inlineprotected |
Reads double values from the CSV-like string table, from the current position on (inclusively), and stores them into the provided array.
Array is sorted in such a way that values corresponding to input elements are included first, followed by values corresponding to output elements, both sorted by element indices.
double.NaN is stored to positions for which data cells were empty.
After reading, current cell position is set to the first column after the last cell in the data.
If element positions are not yet known then they are established (if possible, otherwise exception is thrown).
Exception is thrown if values are not at expected positions.
dataArray | Array where string values read from data columns are stored. |
References IG.Num.SampledDataCsv.DataColumnDefinition.Column, and IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex.
|
inlineprotected |
Reads integer values from the CSV-like string table, from the current position on (inclusively), and stores them into the provided array.
Array is sorted in such a way that values corresponding to input elements are included first, followed by values corresponding to output elements, both sorted by element indices.
int.MinValue is stored to positions for which data cells were empty.
After reading, current cell position is set to the first column after the last cell in the data.
If element positions are not yet known then they are established (if possible, otherwise exception is thrown).
Exception is thrown if values are not at expected positions.
dataArray | Array where string values read from data columns are stored. |
References IG.Num.SampledDataCsv.DataColumnDefinition.Column, and IG.Num.SampledDataCsv.DataColumnDefinition.ElementIndex.
|
inlineprotected |
Reads names of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.Name.
|
inlineprotected |
Reads titles of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.Title.
|
inlineprotected |
Reads descriptions of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.Description.
|
inlineprotected |
Reads minimal values of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.BoundsDefined, and IG.Num.InputOutputElementDefinition.MinimalValue.
|
inlineprotected |
Reads maximal values of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.BoundsDefined, and IG.Num.InputOutputElementDefinition.MaximalValue.
|
inlineprotected |
Reads scaling lengths of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.ScalingLength, and IG.Num.InputOutputElementDefinition.ScalingLengthDefined.
|
inlineprotected |
Reads default values of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputElementDefinition.DefaultValue, and IG.Num.InputElementDefinition.DefaultValueDefined.
|
inlineprotected |
Reads discretization steps of input data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputElementDefinition.DiscretizationStep.
|
inlineprotected |
Reads numberr of sampling points of input data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputElementDefinition.NumSamplingPoints.
|
inlineprotected |
Reads target values of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputOutputElementDefinition.TargetValue, and IG.Num.InputOutputElementDefinition.TargetValueDefined.
|
inlineprotected |
Reads optimization indices of input and output data elements from the CSV, from the current position on (inclusively).
After successful execution, the current cell is set just after the last read position.
References IG.Num.InputElementDefinition.OptimizationIndex, and IG.Num.InputElementDefinition.OptimizationIndexSpecified.
|
inline |
Restores data definition from the data table.
Data definition is assigned to the DataDefinition property.
resetPosition | Whether position is reset before the restoration begins. |
|
inline |
Restores data definition from the data table. Position is reset before the operation begins.
Data definition is assigned to the DataDefinition property.
|
inline |
Restores sampled data from the data table, starting from the current position, i.e. (CurrentRow, CurrentColumn).
Data is assigned to the SampledData property.
resetPosition | Whether position is reset before the restoration begins. |
References IG.Num.SampledDataSet.InputLength, IG.Num.SampledDataSet.OutputLength, and IG.Num.IVector.ToString().
|
inline |
Restores sampled data definition from the data table. Position is reset before the operation begins.
Data is assigned to the SampledData property.
|
inline |
Restores data definition AND sampled data definition from the data table.
Data definition is assigned to the DataDefinition property.
Data is assigned to the SampledData property.
resetPosition | Whether position is reset before the restoration begins. |
|
inline |
Restores data definition AND sampled data definition from the data table. Position is reset before the operation begins.
Data definition is assigned to the DataDefinition property.
Data is assigned to the SampledData property.
|
inline |
Loads data definition form the specified CSV file.
Data definition is assigned to the DataDefinition property.
filePath | Path to the file where data definition is read from. |
|
inline |
Loads sampled data form the specified CSV file.
Data is assigned to the SampledData property.
filePath | Path to the file where data definition is read from. |
|
inline |
Loads data definition AND sampled data form the specified CSV file.
Data definition is assigned to the DataDefinition property.
Data is assigned to the SampledData property.
filePath | Path to the file where data definition is read from. |
Referenced by IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData().
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
Whether a full list of data columns is defined.
|
private |
|
protected |
|
protected |
bool IG.Num.SampledDataCsv._throwExceptionsOnDataErrors = false |
|
protected |
Auxiliary array for temporary storage of strings.
|
protected |
Auxiliary array for temporary storage of double numbers.
|
protected |
Auxiliary array for temporary storage of integer numbers.
|
staticgetset |
Default value for the flag indicating whether keys should be treated as case sensitive.
|
staticgetprotected set |
Default key for introduction of sampled data.
|
staticgetprotected set |
Default element type keyword for input element.
|
staticgetprotected set |
Default element type keyword for output element.
|
staticgetprotected set |
Default key for comment in the current line.
|
staticgetprotected set |
Default key for introduction of number of input parameters.
|
staticgetprotected set |
Default key for introduction of number of output parameters.
|
staticgetprotected set |
Default key for introduction of names of input and output data elements.
|
staticgetprotected set |
Default key for introduction of titles of input and output data elements.
|
staticgetprotected set |
Default key for introduction of descriptions of input and output data elements.
|
staticgetprotected set |
Default key for introduction of element types of input and output data elements (e.g. input/output).
|
staticgetprotected set |
Default key for introduction of element indices of input and output data elements.
|
staticgetprotected set |
Default key for introduction of minimal values of input and output data elements.
|
staticgetprotected set |
Default key for introduction of maximal values of input and output data elements.
|
staticgetprotected set |
Default key for introduction of default values of input data elements.
|
staticgetprotected set |
Default key for introduction of scaling lengths of input and output data elements.
|
staticgetprotected set |
Default key for introduction of discretization steps of input and output data elements.
|
staticgetprotected set |
Default key for introduction of number of sampling points of input and output data elements.
|
staticgetprotected set |
Default key for introduction of target values of input and output data elements.
|
staticgetprotected set |
Default key for introduction of optimization indices of input and output data elements.
|
getset |
Whether keywords are case sensitive.
|
getprotected set |
Keyword that introduces the sampled data.
|
getprotected set |
A keyword string for input element type in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string for output element type in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces a commet in the containing line.
|
getprotected set |
A keyword string that introduces the number of input parameters in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces the number of output parameters in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable names in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable titles in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable descriptions in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable element types in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable element indices in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable minimal values in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable maximal values in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable scaling lengths in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable default values in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable discretization steps in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable discretization steps in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable target values in the CSV file containing sampled data and / or data definitions.
|
getprotected set |
A keyword string that introduces variable optimization indices in the CSV file containing sampled data and / or data definitions.
|
getset |
|
getset |
|
getsetprivate |
Number of input elements.
|
getsetprivate |
Number of output values in the data.
|
getprotected set |
|
getprotected set |
|
getprotected |
Contains definitions of data columns within the data table.
Definitions follow in the same order as the corresponding columns, but there may be gaps between them.
|
getprotected |
Contains definitions for input data columns, sorted by element indices.
|
getprotected |
Contains definitions for output data columns, sorted by element indices.
|
getprotected set |
Whether complete information about data column definitions is up to date, including auciliary lists with sorted input and output definitions.
|
getset |
Whether keys and data are in the same row in data definition section wnen writing to CSV format.
Referenced by IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), and IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData().
|
getset |
Offset - specifies in which column data columns begin when writing tyo CSV format.
Referenced by IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), and IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData().
|
getset |