C# Class LitDev.LDArray

Datei anzeigen Open project: litdev1/LitDev

Public Methods

Method Description
Copy ( Primitive array1, Primitive array2 ) : Primitive

Copy one array to another array. The dimensions of the 2 arrays must be the same.

CopyNew ( Primitive array ) : Primitive

Copy one array to a new array.

CopyToSBArray ( Primitive array ) : Primitive

Copy LDArray type to SmallBasic array type. The reverse operation (SmallBasic to LDArray) isn't possible becuase the SmallBasic indexes are not necessarily contiguous integers. Note also that a SmallBasic array cannot hold an empty string value, so these will not be copied.

Count ( Primitive array ) : Primitive

Get the number of non-empty "" elements in the array.

Create ( Primitive maxSize ) : Primitive

Create a new array (can be used for numbers or character strings).

CreateFromIndices ( Primitive sbArray ) : Primitive

Create a new array from the indices of a Small Basic array.

CreateFromValues ( Primitive sbArray ) : Primitive

Create a new array from the values of a Small Basic array.

Delete ( Primitive array ) : Primitive

Delete an existing array (not generally required, but can save memory if lots of arrays are created).

GetIndex ( Primitive sbArray, Primitive value ) : Primitive

Get the index of the first occurance of a value in an SB array.

GetValue ( Primitive array, Primitive index ) : Primitive

Get value in array.

Load ( Primitive array, Primitive fileName ) : Primitive

Load an array from a file.

Save ( Primitive array, Primitive fileName ) : Primitive

Save an array to a file.

Search ( Primitive array, Primitive searchstring, Primitive match ) : Primitive

Obtain an array of the indices that have values that contain searchstring. The search is case in-sensitive. The input array is unchanged and the match array must be previously created with the same size as the array to check.

SetValue ( Primitive array, Primitive index, Primitive value ) : Primitive

Set value in array.

Sort ( Primitive array ) : Primitive

Perform a sort on an LDArray. By default the sort is by string value, therefore 10 comes before 2. To sort by number value, all values must be a number (or empty). Empty values are placed at the end of the sort. The input array is replaced by the sorted array.

SortIndex ( Primitive array, Primitive index ) : Primitive

Obtain an array of the indices in sort order of an array. By default the sort is by string value, therefore 10 comes before 2. To sort by number value, all values must be a number (or empty). Empty values are placed at the end of the sort. The input array is unchanged and the index array must be previously created with the same size as the array to sort.

getArray ( string name ) : Array

Private Methods

Method Description
getNewNumber ( ) : int

Method Details

Copy() public static method

Copy one array to another array. The dimensions of the 2 arrays must be the same.
public static Copy ( Primitive array1, Primitive array2 ) : Primitive
array1 Primitive /// The array to copy from. ///
array2 Primitive /// The array to copy to. ///
return Primitive

CopyNew() public static method

Copy one array to a new array.
public static CopyNew ( Primitive array ) : Primitive
array Primitive /// The array to copy. ///
return Primitive

CopyToSBArray() public static method

Copy LDArray type to SmallBasic array type. The reverse operation (SmallBasic to LDArray) isn't possible becuase the SmallBasic indexes are not necessarily contiguous integers. Note also that a SmallBasic array cannot hold an empty string value, so these will not be copied.
public static CopyToSBArray ( Primitive array ) : Primitive
array Primitive /// The array name. ///
return Primitive

Count() public static method

Get the number of non-empty "" elements in the array.
public static Count ( Primitive array ) : Primitive
array Primitive The array name.
return Primitive

Create() public static method

Create a new array (can be used for numbers or character strings).
public static Create ( Primitive maxSize ) : Primitive
maxSize Primitive /// The maximum number of elements in the array. ///
return Primitive

CreateFromIndices() public static method

Create a new array from the indices of a Small Basic array.
public static CreateFromIndices ( Primitive sbArray ) : Primitive
sbArray Primitive The SB array.
return Primitive

CreateFromValues() public static method

Create a new array from the values of a Small Basic array.
public static CreateFromValues ( Primitive sbArray ) : Primitive
sbArray Primitive The SB array.
return Primitive

Delete() public static method

Delete an existing array (not generally required, but can save memory if lots of arrays are created).
public static Delete ( Primitive array ) : Primitive
array Primitive /// The array name. ///
return Primitive

GetIndex() public static method

Get the index of the first occurance of a value in an SB array.
public static GetIndex ( Primitive sbArray, Primitive value ) : Primitive
sbArray Primitive The SB array.
value Primitive The value to find.
return Primitive

GetValue() public static method

Get value in array.
public static GetValue ( Primitive array, Primitive index ) : Primitive
array Primitive /// The array name. ///
index Primitive /// The index at which to get the value (indexed starting from 1). ///
return Primitive

Load() public static method

Load an array from a file.
public static Load ( Primitive array, Primitive fileName ) : Primitive
array Primitive The array to load the data into. /// The array must already exist.
fileName Primitive The file path to load the array from.
return Primitive

Save() public static method

Save an array to a file.
public static Save ( Primitive array, Primitive fileName ) : Primitive
array Primitive The array to save.
fileName Primitive The file path to save the file to.
return Primitive

Search() public static method

Obtain an array of the indices that have values that contain searchstring. The search is case in-sensitive. The input array is unchanged and the match array must be previously created with the same size as the array to check.
public static Search ( Primitive array, Primitive searchstring, Primitive match ) : Primitive
array Primitive The array to check for matches.
searchstring Primitive The string to search for.
match Primitive An array to hold the index of matched values.
return Primitive

SetValue() public static method

Set value in array.
public static SetValue ( Primitive array, Primitive index, Primitive value ) : Primitive
array Primitive /// The array name. ///
index Primitive /// The index at which to add the value (indexed starting from 1). ///
value Primitive /// The value. ///
return Primitive

Sort() public static method

Perform a sort on an LDArray. By default the sort is by string value, therefore 10 comes before 2. To sort by number value, all values must be a number (or empty). Empty values are placed at the end of the sort. The input array is replaced by the sorted array.
public static Sort ( Primitive array ) : Primitive
array Primitive The array to sort.
return Primitive

SortIndex() public static method

Obtain an array of the indices in sort order of an array. By default the sort is by string value, therefore 10 comes before 2. To sort by number value, all values must be a number (or empty). Empty values are placed at the end of the sort. The input array is unchanged and the index array must be previously created with the same size as the array to sort.
public static SortIndex ( Primitive array, Primitive index ) : Primitive
array Primitive The array to obtain an index order sort.
index Primitive An array to hold the index order of the sorted array.
return Primitive

getArray() public static method

public static getArray ( string name ) : Array
name string
return Array