| IGLib 1.5 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Properties | List of all members
IG.Lib.StringTable Class Reference

2D tables of data represented by strings. Maps to CSV files. More...

Inheritance diagram for IG.Lib.StringTable:
[legend]
Collaboration diagram for IG.Lib.StringTable:
[legend]

## Public Member Functions
| 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. Parameters
  values | Array of values of the elements that are added.
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. Parameters
  values | Array of values of the elements that are added.
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 UtilStr.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 UtilStr.DefaultCsvSeparator is assumed to be a separator for the CSV format. More...

## Static Public Member Functions
static void | ExampleWriteCsv (string filePath)
| Creates a simple string table and saves it to a CSV file. More...

## Public Attributes
const string | DefaultCsvSeparator = ","
| The default separator in the CSV files - comma (","). More...

## Static Public Attributes
static int | DefaultOutputLevel = 0
| Dafault output level for object of the StringTable and derived classes. More...

## Protected Attributes
readonly object | _lock = new object()
int | _outputLevel = DefaultOutputLevel
List< List< string > > | _data = new List<List<string>>()
bool | _isReadOnly = false
bool | _isAutoExtend = true
string | _csvSeparator = UtilCsv.CsvSeparator

## Properties
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]`

## Detailed Description

2D tables of data represented by strings. Maps to CSV files.

Data access operations are thread safe.

$A Igor xx;

## Constructor & Destructor Documentation

IG.Lib.StringTable.StringTable | ( | bool | readOnly | ) |
| inline

Constructs a new string table, a data structure compatible with CSV file format.

Parameters

  readOnly | Whether the created object is read only or not.

IG.Lib.StringTable.StringTable | ( |  | ) |
| inline

Constructs a new string table, a data structure compatible with CSV file format.

## Member Function Documentation

void IG.Lib.StringTable.SetElement | ( | int | rowNumber,
|  | int | columnNumber,
|  | string | element
| ) |  |
| inline

Sets element at the specified position to the specified value.

Parameters

  rowNumber | Row index of the element to be set.
  columnNumber | Column index of the element to be set.
  element | Element to be set.

void IG.Lib.StringTable.SetElement< ElementType > | ( | int | rowNumber,
|  | int | columnNumber,
|  | ElementType | elementValue
| ) |  |
| inline

Sets element at the specified position to the string representation of the specified value.

Parameters

  rowNumber | Row index of the element to be set.
  columnNumber | Column index of the element to be set.
  elementValue | Value whose string representation is to be set.

ElementType IG.Lib.StringTable.GetElement< ElementType > | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns the element of the specified type at the specified position.

Element is parrsed from the string element. Exception is thrown if the element doed not exist or parsing fails.

Template Parameters

  ElementType | Type of the element to be returned.

Parameters

  rowNumber | Row index of the element.
  columnNumber | Column index of the element.

Returns
  Object (of simple type) parsed from the element at the speciffied position.

References IG.Lib.Util.Parse().

bool IG.Lib.StringTable.TryGetElement< ElementType > | ( | int | rowNumber,
|  | int | columnNumber,
|  | ref ElementType | elementValue
| ) |  |
| inline

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).

Value (of the specified type) of the specified element is returned through a ref parameter.

Template Parameters

  ElementType | Type of the element to be extracted.

Parameters

  rowNumber | Row index of the element.
  columnNumber | Column index of the element.
  elementValue | Argument through which the value is returned.

Returns
  Value of the specified element.

bool IG.Lib.StringTable.IsDefined< ElementType > | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns a flag indicating whether the specified position contains a valid string representation of a element of the specified type.

Template Parameters

  ElementType | Element type.

Parameters

  rowNumber | Row index of the element.
  columnNumber | Column index of the element.

Returns
  true if the specified position contains a valid non-null element of the specified type, false otherwise.

bool IG.Lib.StringTable.IsDefined | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns a flag telling whether the specified element is defined (it exists in the data table) or not.

If the specified element is null, true is returned. Use IsNotNullOrEmpty method to check also if the element is not null or empty string.

Parameters

  rowNumber | Row number of the element checked.
  columnNumber | Column number of the element checked.

bool IG.Lib.StringTable.IsNotNullOrEmpty | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

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.

Parameters

  rowNumber | Row number of the element checked.
  columnNumber | Column number of the element checked.

string IG.Lib.StringTable.GetElementOrNull | ( | int | rowNumber,
|  | int | columnNumber,
|  | out bool | isDefined
| ) |  |
| inline

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.

Parameters

  rowNumber | Row number of the element checked.
  columnNumber | Column number of the element checked.
  isDefined | Specifies, on return, whether the specified element is defined (it exists in the data table).

string IG.Lib.StringTable.GetElementOrNull | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns the specified element on the data table or null if that element is not defined.

Use another overload to also notify the caller whether the element is defined or not.

Parameters

  rowNumber | Row number of the element checked.
  columnNumber | Column number of the element checked.

int IG.Lib.StringTable.FirstNonemptyRow | ( | int | startRow | ) |
| inline

Returns index of the first non-empty row from the specified row on (inclusively), or -1 if there is no such row.

Parameters

  startRow | Row where search starts.

int IG.Lib.StringTable.FirstNonemptyRow | ( |  | ) |
| inline

Returns index of the first non-empty row of the table, or -1 if there is no such row.

int IG.Lib.StringTable.FirstNonemptyColumn | ( | int | rowNum,
|  | int | startColumn
| ) |  |
| inline

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.

Parameters

  rowNum | Index of row in which nonemnty cell is searched for.
  startColumn | Starting column from which on (inclusively) a nonempty cell is searched.

int IG.Lib.StringTable.FirstNonemptyColumn | ( | int | rowNum | ) |
| inline

Returns number of the first non-empty cell in the specified row.

Parameters

  rowNum | Index of row in which nonemnty cell is searched for.

void IG.Lib.StringTable.Clear | ( |  | ) |
| inline

Clears the data table.

void IG.Lib.StringTable.AddRow | ( |  | ) |
| inline

Adds a new row at the end of the data table.

Throws exception if the data table is read only.

Referenced by IG.Lib.StringTable.ExampleWriteCsv().

void IG.Lib.StringTable.AddRow | ( | params string[] | elements | ) |
| inline

Adds a new row at the end of the data table.

Throws exception if the data table is read only.

void IG.Lib.StringTable.AddRow< ElementType > | ( | params ElementType[] | elements | ) |
| inline

Adds (appends) a new row with the specified elements at the end of the table.

Template Parameters

  ElementType | Type of elements to be added to the newly created row.

Parameters

  elements | Elements to ne added to the new row.

Throws exception if the data table is read only.

void IG.Lib.StringTable.AddElement | ( | int | rowNum,
|  | string | value
| ) |  |
| inline

Adds a new element at the end of the specified row of te data table.

Parameters

  rowNum | Sequential number of the row to which the element is added.
  value | Value of the element that is added.

Throws exception if the data table is read only, or if the specified row does not exist and the data table is not extensible.

void IG.Lib.StringTable.AddElement | ( | string | value | ) |
| inline

Adds (appends) the speecified element at the end of the table, i.e. at the end of the last row.

Parameters

  value | Value to be added to the table.

void IG.Lib.StringTable.AddElement< ElementType > | ( | int | rowNum,
|  | ElementType | value
| ) |  |
| inline

Adds string representation of a new element of the specified type at the end of the specified row of te data table.

Parameters

  rowNum | Sequential number of the row to which the element is added.
  value | Value of the element that is added.

Throws exception if the data table is read only, or if the specified row does not exist and the data table is not extensible.

void IG.Lib.StringTable.AddElement< ElementType > | ( | ElementType | value | ) |
| inline

Adds (appends) string representatin of the speecified element at the end of the table, i.e. at the end of the last row.

Parameters

  value | Value to be added to the table.

void IG.Lib.StringTable.AddElements | ( | int | rowNum,
|  | params string[] | values
| ) |  |
| inline

Adds the specified elements at the end of the specified row of te data table.

Parameters

  rowNum | Sequential number of the row to which the elements are added.
  values | Array of values of the elements that are added.

Throws exception if the data table is read only, or if the specified row does not exist and the data table is not extensible.

Referenced by IG.Lib.StringTable.ExampleWriteCsv().

void IG.Lib.StringTable.AddElements< ElementType > | ( | int | rowNum,
|  | params ElementType[] | values
| ) |  |
| inline

Adds string representations of the specified elements of the specified type at the end of the specified row of te data table.

Template Parameters

  ElementType | Type of elements to be added.

Parameters

  rowNum | Sequential number of the row to which the elements are added.
  values | Array of values of the elements that are added.

Throws exception if the data table is read only, or if the specified row does not exist and the data table is not extensible.

void IG.Lib.StringTable.AddElements | ( | params string[] | values | ) |
| inline

Adds (appends ) the specified elements at the end of the table, i.e. at the end of the last row.

Parameters

  values | Array of values of the elements that are added.

Throws exception if the data table is read only, or if the specified row does not exist and the data table is not extensible.

void IG.Lib.StringTable.AddElements< ElementType > | ( | params ElementType[] | values | ) |
| inline

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.

Parameters

  values | Array of values of the elements that are added.

Throws exception if the data table is read only, or if the specified row does not exist and the data table is not extensible.

void IG.Lib.StringTable.SetNumRows | ( | int | numRows | ) |
| inline

Change the number of rows in the data table to the specified number.

Parameters

  numRows | New number of rows.

Throws exception if the data table is read only.

If the current number of rows is smaller than the one specified, then new empty (but allocated) rows are added. If the number is greater then the redundant rows are removed.

void IG.Lib.StringTable.SetNumColumns | ( | int | rowNum,
|  | int | numColumns
| ) |  |
| inline

Changes the number of columns of the specified row to the specified number.

Parameters

  rowNum | Row number where number of columns is changed.
  numColumns | New numbef of columns in the specified row.

Throws exception if the data table is read only.

If the current number of rows is smaller than the specified row number, then new empty (but allocated) rows are added. Cells that are eventually added are set to null.

void IG.Lib.StringTable.ClearRow | ( | int | rowNum | ) |
| inline

Clears the specified row in the data table.

Parameters

  rowNum | Number of the row to be cleared.

Throws exception if the data table is read only, or if the row number is out of range and the data table is not automatically extendable.

int IG.Lib.StringTable.NumColumns | ( | int | rowNum | ) |
| inline

Returns the number of elements (columns) of the specified row.

Parameters

  rowNum | Specifies for which row number of columns is returned.

bool IG.Lib.StringTable.IsInt | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns a flag specified whether the specified element of the data table exists and represents an integer.

If the element does not exist then false is returned.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.

int IG.Lib.StringTable.GetInt | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns an integer value of the element at the specified position of the data table, if it is defined, or throws an exception.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.

Returns
  Integer value of the specified element, if the element exists and can be converted to an integer (otherwise, an exception is thrown).

bool IG.Lib.StringTable.TryGetInt | ( | int | rowNumber,
|  | int | columnNumber,
|  | out int | value
| ) |  |
| inline

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.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.
  value | Holds on return the corresponding integer value of the specified element, if defined, or default integer value (i.e. 0) otherwise.

Returns
  Flag indicating whether the elemet at the specified position actually represents an integer.

void IG.Lib.StringTable.GetIntSafe | ( | int | rowNumber,
|  | int | columnNumber,
|  | out int | value,
|  | out bool | isElementDefined,
|  | out bool | isElementNotNullOrEmpty,
|  | out bool | isInt
| ) |  |
| inline

Safely gets the integer value at the specified position of the data table, if it is defined, and notifies the caller on the status.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.
  value | Holds on return the corresponding integer value of the specified element, if defined, or default integer value (i.e. 0) otherwise.
  isElementDefined | Notifies whether the specified element is defined or not.
  isElementNotNullOrEmpty | Notifies whether the element at the specified position is not null or empty string.
  isInt | Notifies whether the elemet at the specified position actually represents an integer.

bool IG.Lib.StringTable.IsDouble | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

Returns a flag specified whether the specified element of the data table exists and represents a number (of type double).

If the element does not exist then false is returned.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.

double IG.Lib.StringTable.GetDouble | ( | int | rowNumber,
|  | int | columnNumber
| ) |  |
| inline

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.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.

Returns
  Double value of the specified element, if the element exists and can be converted to an double (otherwise, an exception is thrown).

bool IG.Lib.StringTable.TryGetDouble | ( | int | rowNumber,
|  | int | columnNumber,
|  | out double | value
| ) |  |
| inline

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.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.
  value | Holds on return the corresponding double value of the specified element, if defined, or default double value (i.e. 0) otherwise.

Returns
  Flag indicating whether the elemet at the specified position actually represents a double.

void IG.Lib.StringTable.GetDoubleSafe | ( | int | rowNumber,
|  | int | columnNumber,
|  | out double | value,
|  | out bool | isElementDefined,
|  | out bool | isElementNotNullOrEmpty,
|  | out bool | isDouble
| ) |  |
| inline

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.

Parameters

  rowNumber | Row number of the data table element.
  columnNumber | Column number of the data table element.
  value | Holds on return the corresponding double value of the specified element, if defined, or default double value (i.e. 0.0) otherwise.
  isElementDefined | Notifies whether the specified element is defined or not.
  isElementNotNullOrEmpty | Notifies whether the element at the specified position is not null or empty string.
  isDouble | Notifies whether the elemet at the specified position actually represents a number of type double.

void IG.Lib.StringTable.LoadCsv | ( | string | filePath,
|  | string | separator
| ) |  |
| inline

Loads the specified CSV file. Reads contents of the file into the data table of the current object.

Parameters

  filePath | Path to the CSV file that is read and parsed.
  separator | Separator that is used in the CSV file. If not specified (null or empty string) then Constant UtilStr.DefaultCsvSeparator is assumed.

References IG.Lib.UtilCsv.LoadCsv().

void IG.Lib.StringTable.LoadCsv | ( | string | filePath | ) |
| inline

Loads the specified CSV file. Reads contents of the file into the data table of the current object.

The value of the CsvSeparator property is used as separator.

Parameters

  filePath | Path to the CSV file that is read and parsed.

override string IG.Lib.StringTable.ToString | ( |  | ) |
| inline

Converts the current string table to a string in CSV form and returns the string.

References IG.Lib.UtilCsv.ToCsvString().

void IG.Lib.StringTable.SaveCsv | ( | string | filePath,
|  | string | separator,
|  | bool | append
| ) |  |
| inline

Saves the data of the current object to the specified CSV file.

Parameters

  filePath | Path to the file into which data is written.
  separator | Separator that is used in CSV format.
  append | If true then the CSV string is appended to the existent file if the file already exists. Otherwise, existend files are overwritten.

References IG.Lib.UtilCsv.SaveCsv().

Referenced by IG.Lib.StringTable.ExampleWriteCsv().

void IG.Lib.StringTable.SaveCsv | ( | string | filePath,
|  | string | separator
| ) |  |
| inline

Saves the data of the current object into a CSV file. If the file already exists then its contents are overwritten.

Parameters

  filePath | Path to the file into which contents is written.
  separator | Separator that is used in CSV format.

void IG.Lib.StringTable.SaveCsv | ( | string | filePath,
|  | bool | append
| ) |  |
| inline

Saves the data of the current object into a CSV file. Constant UtilStr.DefaultCsvSeparator is assumed to be a separator for the CSV format.

Parameters

  filePath | Path to the file into which contents is written.
  values | A 2D jagged array of string cell values. Each outer element contains one row of values in CSV.

void IG.Lib.StringTable.SaveCsv | ( | string | filePath | ) |
| inline

Saves the data of the current object values into a CSV file. If the file already exists then its contents are overwritten. Constant UtilStr.DefaultCsvSeparator is assumed to be a separator for the CSV format.

Parameters

  filePath | Path to the file into which contents is written.
  values | A 2D jagged array of string cell values. Each outer element contains one row of values in CSV.

static void IG.Lib.StringTable.ExampleWriteCsv | ( | string | filePath | ) |
| inline static

Creates a simple string table and saves it to a CSV file.

Parameters

  filePath | Path to the file where CSV is stored.

References IG.Lib.StringTable.AddElements(), IG.Lib.StringTable.AddRow(), IG.Num.RandomGenerator.Global, IG.Num.IRandomGenerator.NextDouble(), and IG.Lib.StringTable.SaveCsv().

## Member Data Documentation

readonly object IG.Lib.StringTable._lock = new object()
| protected

int IG.Lib.StringTable.DefaultOutputLevel = 0
| static

Dafault output level for object of the StringTable and derived classes.

int IG.Lib.StringTable._outputLevel = DefaultOutputLevel
| protected

List<List<string> > IG.Lib.StringTable._data = new List<List<string>>()
| protected

bool IG.Lib.StringTable._isReadOnly = false
| protected

bool IG.Lib.StringTable._isAutoExtend = true
| protected

const string IG.Lib.StringTable.DefaultCsvSeparator = ","

The default separator in the CSV files - comma (",").

string IG.Lib.StringTable._csvSeparator = UtilCsv.CsvSeparator
| protected

## Property Documentation

object IG.Lib.StringTable.Lock
| get

Object used for thread locking.

int IG.Lib.StringTable.OutputLevel
| get set

Output level, specifies the level of descriptive output on console during the operation.

Referenced by IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), and IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData().

List<List<string> > IG.Lib.StringTable.Data
| get protected

Data behind the table - list of lists of strings.

bool IG.Lib.StringTable.IsReadOnly
| get set

Whether or not data table is read only.

bool IG.Lib.StringTable.IsAutoExtend
| get set

Whether or not data storage automatically extends when a value is set on the position that is out of range.

string IG.Lib.StringTable.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.

Handling situation when row or column number is out of range:

If IsAutoExtend then getter returns null and setter extends the table as needed.

Otherwise, IndexOutOfRangeException exception is thrown.

Parameters

  rowNumber | Row number of the element (zero-based).
  columnNumber | Column number of the element (zero-based).

string [][] IG.Lib.StringTable.Table
| get set

Gets or sets copy of the data table in form of 2D jagged array.

int IG.Lib.StringTable.NumRows
| get

Gets number of rows in the data table.

int IG.Lib.StringTable.MaxNumColumns
| get

Returns the maximal number of columns in any row.

bool IG.Lib.StringTable.IsRectangular
| get

Returns true if data table is rectangular (i.e. all rows have equal number of elements) or not.

Table without rows or with one row is considered rectangular.

Table with all rows empty or null is considered rectangular.

string IG.Lib.StringTable.CsvSeparator
| get set

Separator used in CSV files that this class loads data from or writes data to.

Property is used by ethods that deal with CSV files and do not have separator as.

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

- igbase/0guests/Tako78/datastructures/StringTable.cs