BetterArray

Internal members (not exported)

Class_Initialize #

Signature:

Private Sub Class_Initialize()

("Constructor")


Capacity #

Signature:

Public Property Get Capacity() As Long

("Returns the capacity of the internal array.")


Capacity #

Signature:

Public Property Let Capacity(ByVal Value As Long)

("Sets the capacity of the internal array.")


Length #

Signature:

Public Property Get Length() As Long

("Returns the number of entries stored in the array.")


UpperBound #

Signature:

Public Property Get UpperBound() As Long

("Returns largest used index in the array.")


LowerBound #

Signature:

Public Property Get LowerBound() As Long

("Returns smallest used index in the array.")


LowerBound #

Signature:

Public Property Let LowerBound(ByVal Value As Long)

("Sets the starting index of the array. If an array is already stored then it will be re-indexed to match the new value")


Item #

Signature:

Public Property Get Item(ByVal Index As Long) As Variant

("Returns the element in the array stored at the specified index.")


Item #

Signature:

Public Property Let Item(ByVal Index As Long, ByVal Element As Variant)

("Assigns the passed element to the array at the specified index.")


Items #

Signature:

Public Property Get Items() As Variant

("Returns the stored array.")


Items #

Signature:

Public Property Let Items(ByVal Values As Variant)

("Stores the passed array.")


ArrayType #

Signature:

Public Property Get ArrayType() As ArrayTypes

("Retrieves the stored array type.")


ArrayType #

Signature:

Public Property Let ArrayType(ByVal NewType As ArrayTypes)

("Sets the stored array type.")


SortMethod #

Signature:

Public Property Get SortMethod() As SortMethods

("Retrieves the sorting algorithm used by the Sort() method.")


SortMethod #

Signature:

Public Property Let SortMethod(ByVal Method As SortMethods)

("Specifies the sorting algorithm used by the Sort() method.")


InternalItems #

Signature:

Private Property Get InternalItems() As Variant()

("Retrieves the stored items trimmed to the correct length. Does not change structure (i.e jagged to multi).")


InternalItems #

Signature:

Private Property Let InternalItems(ByRef Value() As Variant)

("Assigns the passed array to this.items")


Push #

Signature:

Public Function Push(ParamArray Args() As Variant) As Variant

("Adds the provided argments to the array at the next available index.")


Pop #

Signature:

Public Function Pop() As Variant

("Removes the last element from the array and returns that element.")


Shift #

Signature:

Public Function Shift() As Variant

("Removes the first element from the array and returns that element.")


Unshift #

Signature:

Public Function Unshift(ParamArray Args() As Variant) As Long

("Adds one or more elements to the beginning of an array. Returns the new length of the array.")


ToString #

Signature:

Public Function ToString( _
        Optional ByVal PrettyPrint As Boolean, _
        Optional ByVal Separator As String = CHR_COMMA, _
        Optional ByVal OpeningDelimiter As String = "{", _
        Optional ByVal ClosingDelimiter As String = "}", _
        Optional ByVal QuoteStrings As Boolean _
    ) As String

("Returns a string representing the array structure and its elements.")


Includes #

Signature:

Public Function Includes( _
        ByVal SearchElement As Variant, _
        Optional ByVal FromIndex As Long = MISSING_LONG, _
        Optional ByVal Recurse As Boolean _
    ) As Boolean

("Determines whether the array includes a certain value among its entries.")


IncludesType #

Signature:

Public Function IncludesType( _
        ByVal SearchTypeName As String, _
        Optional ByVal FromIndex As Long = MISSING_LONG, _
        Optional ByVal Recurse As Boolean _
    ) As Boolean

("Determines whether the type of any of the elements in the array matches the typename.")


Every #

Signature:

Public Function Every( _
        ByVal SearchElement As Variant, _
        Optional ByVal FromIndex As Long = MISSING_LONG _
    ) As Boolean

("Determines whether all elements in the array match a value.")


EveryType #

Signature:

Public Function EveryType( _
        ByVal SearchTypeName As String, _
        Optional ByVal FromIndex As Long = MISSING_LONG _
    ) As Boolean

("Determines whether the type of all elements match the provided typename.")


Keys #

Signature:

Public Function Keys() As Variant()

("Returns a new array that contains the keys for each index in the array.")


Max #

Signature:

Public Function Max(ParamArray Args() As Variant) As Variant

("Returns the largest value in a list of values. If arguments are provided it will return the largest argument. If no arguments are provided it will return the largest element in the stored array")


Min #

Signature:

Public Function Min(ParamArray Args() As Variant) As Variant

("Returns the smallest value in a list of values. If arguments are provided it will return the smallest argument. If no arguments are provided it will return the smallest element in the stored array")


Slice #

Signature:

Public Function Slice( _
        ByVal StartIndex As Long, _
        Optional ByVal EndIndex As Long = MISSING_LONG _
    ) As Variant()

("Returns a new array containing the portion of the stored array between the StartIndex and EndIndex")


FromExcelRange #

Signature:

Public Function FromExcelRange( _
        ByRef FromRange As Object, _
        Optional ByVal DetectLastRow As Boolean, _
        Optional ByVal DetectLastColumn As Boolean _
    ) As BetterArray

("Stores the values contained in an Excel range in the internal array")


ExtractSegment #

Signature:

Public Function ExtractSegment( _
        Optional ByVal RowIndex As Long = MISSING_LONG, _
        Optional ByVal ColumnIndex As Long = MISSING_LONG _
    ) As Variant()

("Extracts the segment of the array located at the specified indices.")


ToExcelRange #

Signature:

Public Function ToExcelRange( _
        ByRef Destination As Object, _
        Optional ByVal TransposeValues As Boolean _
    ) As Object

("Writes the values stored in the array to an excel worksheet starting at the specified range.")


IsSorted #

Signature:

Public Function IsSorted(Optional ByVal ColumnIndex As Long = MISSING_LONG) As Boolean

("Tests if the stored array is sorted in ascending order.")


IndexOf #

Signature:

Public Function IndexOf( _
        ByVal SearchElement As Variant, _
        Optional ByVal FromIndex As Long = MISSING_LONG, _
        Optional ByVal CompType As ComparisonType _
    ) As Long

("returns the first index at which a given element can be found in the array")


LastIndexOf #

Signature:

Public Function LastIndexOf( _
        ByVal SearchElement As Variant, _
        Optional ByVal FromIndex As Long = MISSING_LONG, _
        Optional ByVal CompType As ComparisonType _
    ) As Long

("returns the first index at which a given element can be found in the array")


Remove #

Signature:

Public Function Remove(ByVal Index As Long) As Long

("Removes the item at the specified index. Returns the new length of the array")


Splice #

Signature:

Public Function Splice( _
        ByVal StartIndex As Long, _
        ParamArray Args() As Variant _

("changes the contents of the array by removing or replacing existing elements and/or adding new elements in place.")


Fill #

Signature:

Public Function Fill( _
        ByVal Value As Variant, _
        Optional ByVal StartIndex As Long = MISSING_LONG, _
        Optional ByVal EndIndex As Long = MISSING_LONG _
    ) As BetterArray

("Recursvely fills (modifies) all the elements of an array from a start index (default zero) to an end index (default array length) with a passed value.")


ParseFromString #

Signature:

Public Function ParseFromString( _
        ByVal SourceString As String, _
        Optional ByVal ValueSeparator As String = CHR_COMMA, _
        Optional ByVal ArrayOpenDelimiter As String, _
        Optional ByVal ArrayClosingDelimiter As String _
    ) As BetterArray

("Parses a string representing an array and stores the outcome.")


Transpose #

Signature:

Public Function Transpose() As BetterArray

("Swaps rows for columns & vice versa.")


Clone #

Signature:

Public Function Clone() As BetterArray

("Returns a new BetterArray instance containing the same values as the current instance.")


ResetToDefault #

Signature:

Public Function ResetToDefault() As BetterArray

("Clears the current array and resets capacity to default value")


Clear #

Signature:

Public Function Clear() As BetterArray

("Clears all entries in the current array but retains existing capacity.")


Concat #

Signature:

Public Function Concat(ParamArray Args() As Variant) As BetterArray

("Joins one or more arrays onto the end of the current array.")


CopyFromCollection #

Signature:

Public Function CopyFromCollection(ByVal SourceCollection As Collection) As BetterArray

("Writes all of the elements in a Collection objet to the internal array.")


Sort #

Signature:

Public Function Sort(Optional ByVal SortColumn As Long = MISSING_LONG) As BetterArray

("Sorts the stored array in ascending order.")


CopyWithin #

Signature:

Public Function CopyWithin( _
        ByVal Target As Long, _
        Optional ByVal StartIndex As Long = MISSING_LONG, _
        Optional ByVal EndIndex As Long = MISSING_LONG _
    ) As BetterArray

("Copies a section of the stored array to another location in the same array.")


Filter #

Signature:

Public Function Filter( _
        ByVal Match As Variant, _
        Optional ByVal Include As Boolean, _
        Optional ByVal Recurse As Boolean, _
        Optional ByVal ColumnIndex As Long = MISSING_LONG _
        ) As BetterArray

("Filters the stored array to include only values that meet the specified criteria.")


FilterType #

Signature:

Public Function FilterType( _
        ByVal SearchTypeName As String, _
        Optional ByVal Include As Boolean, _
        Optional ByVal Recurse As Boolean, _
        Optional ByVal ColumnIndex As Long = MISSING_LONG _
        ) As BetterArray

("Filters the stored array to include only values of the specified type.")


Reverse #

Signature:

Public Function Reverse(Optional ByVal Recurse As Boolean) As BetterArray

("Reverses the order of elements in the array. The first array element becomes the last, and the last array element becomes the first.")


Flatten #

Signature:

Public Function Flatten() As BetterArray

("Flattens a Multi-Dimensional or Jagged array into One Dimension arrays.")


Shuffle #

Signature:

Public Function Shuffle(Optional ByVal Recurse As Boolean) As BetterArray

("shuffles the order of the stored array.")


Unique #

Signature:

Public Function Unique(Optional ByVal ColumnIndex As Long = MISSING_LONG) As BetterArray

("filters the array to contain only unique elements")


FromCSVFile #

Signature:

Public Function FromCSVFile( _
    ByVal Path As String, _
    Optional ByVal ColumnDelimiter As String = CHR_COMMA, _
    Optional ByVal RowDelimiter As String, _
    Optional ByVal Quote As String = CHR_QUOTE, _
    Optional ByVal IgnoreFirstRow As Boolean, _
    Optional ByVal DuckType As Boolean _
) As BetterArray

("Accepts a path argument pointing to a comma-separated values (CSV) file and stores the delimited values contained within to the internal array.")


FromCSVString #

Signature:

Public Function FromCSVString( _
    ByVal CSVString As String, _
    Optional ByVal ColumnDelimiter As String = CHR_COMMA, _
    Optional ByVal RowDelimiter As String, _
    Optional ByVal Quote As String = CHR_QUOTE, _
    Optional ByVal IgnoreFirstRow As Boolean, _
    Optional ByVal DuckType As Boolean _
) As BetterArray

("Accepts a string argument representing the contents of a comma-separated values (CSV) file and stores the delimited values contained within to the internal array.")


ToCSVString #

Signature:

Public Function ToCSVString( _
    Optional ByRef Headers As Variant, _
    Optional ByVal ColumnDelimiter As String = CHR_COMMA, _
    Optional ByVal RowDelimiter As String = vbCrLf, _
    Optional ByVal Quote As String = CHR_QUOTE, _
    Optional ByVal EncloseAllInQuotes As Boolean, _
    Optional ByVal DateFormat As String, _
    Optional ByVal NumberFormat As String _
) As String

("Returns a string representation of the stored array to use as output for a CSV file")


ToCSVFile #

Signature:

Public Function ToCSVFile( _
    ByVal Path As String, _
    Optional ByRef Headers As Variant, _
    Optional ByVal ColumnDelimiter As String = CHR_COMMA, _
    Optional ByVal RowDelimiter As String = vbCrLf, _
    Optional ByVal Quote As String = CHR_QUOTE, _
    Optional ByVal EncloseAllInQuotes As Boolean, _
    Optional ByVal DateFormat As String, _
    Optional ByVal NumberFormat As String _
) As String

("Writes stored array to CSV file")


DetectLineEndings #

Signature:

Private Function DetectLineEndings(ByVal Source As String) As String

("Tries to guess line endings used in a string")


ReadStringFromFile #

Signature:

Private Function ReadStringFromFile(ByVal Path As String) As String

("Reads a text file to a string from a specified path")


PrintStringToFile #

Signature:

Private Sub PrintStringToFile(ByVal Path As String, ByVal Content As String)

("Prints as string to a text file at the specified path")


WrapQuote #

Signature:

Private Function WrapQuote(Optional ByVal Source As String = vbNullString) As String

("Surrounds the provided string with quote characters")


BuildCSVString #

Signature:

Private Function BuildCSVString( _
    ByRef Records() As String, _

("Concatenates all records into a single string to be output as a csv")


EncodeCSVRecords #

Signature:

Private Function EncodeCSVRecords( _
    ByRef Records() As Variant, _

("Applies RFC 4180 business rules to all fields")


EncodeCSVField #

Signature:

Private Function EncodeCSVField( _
    ByVal Field As Variant, _
    ByVal ColumnDelimiter As String, _
    ByVal RowDelimiter As String, _
    ByVal EncloseAllInQuotes As Boolean, _
    ByVal DateFormat As String, _
    ByVal NumberFormat As String _
) As String

("Applies RFC 4180 business rules to the encoding of a CSV field")


EscapeCharInString #

Signature:

Private Function EscapeCharInString( _
    ByVal Destination As String, _
    ByVal Target As String, _
    ByVal Escape As String, _
    Optional ByVal BothSides As Boolean _
) As String

("Escapes a substring in a string using a provided Escape substring")


InsertIntoStringAtIndex #

Signature:

Private Function InsertIntoStringAtIndex( _
    ByVal Destination As String, _
    ByVal Source As String, _
    ByVal Index As Long _
) As String

("Inserts a substring into a destination string starting at the provided index")


InternalConcat #

Signature:

Private Function InternalConcat(ParamArray Args() As Variant) As Variant()

("Utility function which delegates to ConcatDelegate")


ConcatDelegate #

Signature:

Private Function ConcatDelegate(ByRef First() As Variant, ParamArray Args() As Variant) As Variant()

("Concatenates Passed Arrays. Do not use as utility function")


InsertArrayAtIndex #

Signature:

Private Sub InsertArrayAtIndex(ByRef Destination() As Variant, ByRef Source() As Variant, ByRef Index As Long)

("Places the Values in Source within Destination starting at Index")


GetTotalLengthOfNestedArrays #

Signature:

Private Function GetTotalLengthOfNestedArrays(ByRef Source() As Variant) As Long

("Returns the combined length of all nested arrays")


TrimColumnsMultidimensionArray #

Signature:

Private Function TrimColumnsMultidimensionArray(ByRef Original() As Variant, ByVal AvailableColumns As Long) As Variant()

("Truncates the number of rows in an array to the given amount")


TrimRowsMultidimensionArray #

Signature:

Private Function TrimRowsMultidimensionArray(ByRef Original() As Variant, ByVal AvailableRows As Long) As Variant()

("Truncates the number of rows in an array to the given amount")


inc #

Signature:

Private Function inc(ByRef Index As Long, Optional ByVal Value As Long = 1) As Long

("Increments an index")


dec #

Signature:

Private Function dec(ByRef Index As Long, Optional ByVal Value As Long = 1) As Long

("Decrements an index")


StringFactory #

Signature:

Private Function StringFactory(ByRef Expression As String) As TString

("Populates TString Types")


NextDelimBytePos #

Signature:

Private Function NextDelimBytePos( _
    ByRef Expression As TString, _
    ByRef Delimiter As TString, _
    Optional ByRef StartIndex As Long = 1 _
) As Long

("Returns the next byte position in the string of the specified delimiter")


GetCSVRows #

Signature:

Private Function GetCSVRows( _
    ByRef Expr As TString, _
    ByRef RowDelim As TString, _
    ByRef LiteralDelim As TString _
) As String()

("Splits the provided string into rows based on the provided row delimiter")


CountCSVColumns #

Signature:

Private Function CountCSVColumns(ByRef FirstRow As String, ByRef LiteralDelim As TString, ByVal ColumnDelimiter As String) As Long

("Counts the number of delimited columns in a provided string")


ParseCSV #

Signature:

Private Function ParseCSV( _
    ByRef Expression As String, _
    ByVal ColumnDelimiter As String, _
    ByVal RowDelimiter As String, _
    ByRef Quote As String, _
    ByVal IgnoreFirstRow As Boolean, _
    ByVal ReturnJagged As Boolean, _
    ByVal Base As Long, _
    ByVal DuckType As Boolean _
) As Variant()

("Parses CSV string into a 2d or jagged array")


RecursiveFill #

Signature:

Private Function RecursiveFill( _
        ByRef SourceArray() As Variant, _

("Recursvely fills the array (and nested arrays) with the passed value.")


RecursiveEvery #

Signature:

Private Function RecursiveEvery( _
        ByVal SearchElement As Variant, _
        ByRef SearchArray() As Variant, _

("Recursively checks if the passed array only includes the search element.")


RecursiveShuffle #

Signature:

Private Function RecursiveShuffle( _
        ByRef SourceArray() As Variant, _

("shuffles the order of the passed array.")


RecursiveReverse #

Signature:

Private Function RecursiveReverse( _
        ByRef SourceArray() As Variant, _

("reverses the order of the passed array.")


GetArrayLength #

Signature:

Private Function GetArrayLength(ByRef SourceArray() As Variant) As Long

("returns the length of the passed array.")


RecursiveFlatten #

Signature:

Private Sub RecursiveFlatten( _
        ByRef SourceArray() As Variant, _

("converts all the values in a jagged array to a 1d array.")


RecursiveMax #

Signature:

Private Function RecursiveMax(ByRef SourceArray() As Variant) As Variant

("Recursively finds the largest value in an array.")


RecursiveMin #

Signature:

Private Function RecursiveMin(ByRef SourceArray() As Variant) As Variant

("Recursively finds the smallest value in an array.")


RecursiveIncludes #

Signature:

Private Function RecursiveIncludes( _
        ByVal SearchElement As Variant, _
        ByRef SearchArray() As Variant, _

("Recursively checks if the passed array includes the search element.")


FilterOneDimension #

Signature:

Private Function FilterOneDimension( _
        ByRef SourceArray() As Variant, _

("Filters a one dimension array.")


FilterByColumn #

Signature:

Private Function FilterByColumn( _
        ByRef SourceArray() As Variant, _

("Filters a jaggged array by column.")


RecursiveFilter #

Signature:

Private Function RecursiveFilter( _
        ByRef SourceArray() As Variant, _

("Recursively filters a passed array.")


ElementsAreEqual #

Signature:

Private Function ElementsAreEqual( _
        ByVal Expected As Variant, _
        ByVal Actual As Variant _
    ) As Boolean

("Compares two values for equality. Doesn't support multidimensional arrays.")


ParseDelimitedArrayString #

Signature:

Private Function ParseDelimitedArrayString( _
        ByVal SourceString As String, _
        ByVal ValueSeparator As String, _
        ByVal Opener As String, _
        ByVal Closer As String, _
        Optional ByRef Cursor As Long = 2 _
    ) As Variant()

("Recursively parses nested arrays from a string.")


ParseArraySegmentFromString #

Signature:

Private Function ParseArraySegmentFromString( _
        ByVal SourceString As String, _
        ByRef Cursor As Long, _
        ByVal NextCloser As Long, _
        ByVal ValueSeparator As String _
    ) As Variant()

("Returns an array from a delimited string")


UnquoteString #

Signature:

Private Function UnquoteString(ByRef Element As String) As String

("Trims enclosing quote chars from string if present")


DuckTypeElement #

Signature:

Private Function DuckTypeElement(ByRef Element As String) As Variant

("Takes a string. Returns a Variant with the element converted to an appropriate type")


DuckTypeStringArray #

Signature:

Private Function DuckTypeStringArray(ByRef SourceArray() As String) As Variant()

("Takes a string array. Returns a Variant array with the elements converted to an appropriate type")


PopulateErrorDefinitions #

Signature:

Private Sub PopulateErrorDefinitions()

("Populates the ErrorDefinitions array.")


ErrorDefinitionFactory #

Signature:

Private Function ErrorDefinitionFactory( _
        ByVal Number As Long, _
        ByVal Source As String, _
        ByVal Description As String _
    ) As ErrorDefinition

("Returns an ErrorDefinition Type populated with the provided arguments.")


RaiseError #

Signature:

Private Sub RaiseError( _
        ByVal ErrorCode As ErrorCodes, _
        ByVal Caller As String, _
        Optional ByVal ArgName As String _
    )

("Raises an application error based on the passed ErrorCode and the definitions defined in ErrorDefinitions.")


EnsureScalar1DArray #

Signature:

Private Function EnsureScalar1DArray(ByRef SourceArray() As Variant) As Variant()

("Ensures each element of passed array can be represented as a scalar value.")


ConvertOneDimensionArrayToJagged #

Signature:

Private Function ConvertOneDimensionArrayToJagged(ByRef SourceArray() As Variant) As Variant()

("Converts a 1d array to a 1 column wide jagged array.")


Transpose1DArray #

Signature:

Private Function Transpose1DArray(ByRef SourceArray() As Variant) As Variant()

("Converts a 1d array to a 1 column wide 2d array.")


Transpose2DArray #

Signature:

Private Function Transpose2DArray(ByRef SourceArray() As Variant) As Variant()

("Transposes the values in a 2d array. Rows become columns, columns become rows.")


TransposeArrayOfArrays #

Signature:

Private Function TransposeArrayOfArrays(ByRef SourceArray() As Variant) As Variant()

("Transposes the values in a jagged array with a depth of 2. Rows become columns, columns become rows.")


GetEmptyArray #

Signature:

Private Function GetEmptyArray() As Variant()

("Returns an empty 1d array with 1 slot.")


ApplySortMethod #

Signature:

Private Sub ApplySortMethod( _
        ByRef SourceArray() As Variant, _

("Used to apply the correct specified sort algorithm.")


GetComparisonItem #

Signature:

Private Function GetComparisonItem( _
    ByRef Source() As Variant, _

("Returns an field of a one dimension or two dimension jagged array")


InsertionSort #

Signature:

Private Sub InsertionSort( _
    ByRef Source() As Variant, _

("Sorts the passed array in place using InsertionSort.")


MergeSort #

Signature:

Private Sub MergeSort( _
    ByRef Source() As Variant, _

("Sorts the passed array in place using MergeSort.")


TimSort #

Signature:

Private Sub TimSort( _
    ByRef Source() As Variant, _

("Iterative Timsort")


QuickSortRecursive #

Signature:

Private Sub QuickSortRecursive( _
        ByRef SourceArray() As Variant, _

("Sorts in place a passed array using a Recursive implementation of the QuickSort algorithm.")


QuickSortIterative #

Signature:

Private Sub QuickSortIterative( _
        ByRef SourceArray() As Variant, _

("Sorts in place a passed array using an Iterative implementation of the QuickSort algorithm")


QsPartition #

Signature:

Private Function QsPartition( _
        ByRef SourceArray() As Variant, _

("Child function of quickSort. Returns the next partition index.")


Swap #

Signature:

Private Sub Swap(ByRef SourceArray() As Variant, ByVal i As Long, ByVal j As Long)

("Swaps the location of two elements in an array.")


LetOrSetElement #

Signature:

Private Sub LetOrSetElement(ByRef Destination As Variant, ByRef Source As Variant)

("Sets or lets the value of a variable by reference depending on the type of the element to be assigned")


StringBuilder #

Signature:

Private Function StringBuilder( _
    Optional ByVal Fragment As String = vbNullString, _
    Optional ByVal Final As Boolean, _
    Optional ByVal NewString As Boolean _
) As String

("Efficiently concatenates string fragments to a byte array buffer")


RecursiveToString #

Signature:

Private Sub RecursiveToString( _
        ByRef SourceArray() As Variant, _

("Recursively parses an array to a string representation.")


GetScalarRepresentation #

Signature:

Private Function GetScalarRepresentation( _
        ByRef Element As Variant, _
        Optional ByVal QuoteStrings As Boolean _
    ) As Variant

("Returns scalar values as is or appropriate representation if not scalar.")


GetArrayType #

Signature:

Private Function GetArrayType(ByVal SourceArray As Variant) As ArrayTypes

("Returns the type of a passed array.")


IsArrayEmpty #

Signature:

Private Function IsArrayEmpty(ByVal SourceArray As Variant) As Boolean

("Tests if an array has a single empty slot.")


IsArrayAllocated #

Signature:

Private Function IsArrayAllocated(ByVal SourceArray As Variant) As Boolean

("Tests if an array has been allocated.")


IsJaggedArray #

Signature:

Private Function IsJaggedArray(ByVal SourceArray As Variant) As Boolean

("Tests if an array is jagged.")


IsMultidimensionalArray #

Signature:

Private Function IsMultidimensionalArray(ByVal SourceArray As Variant) As Boolean

("Tests if an array is multidimensioned.")


Rebase #

Signature:

Private Function Rebase(Optional ByRef SourceArray As Variant, Optional ByVal CurrentArrayType As ArrayTypes) As Variant()

("re-indexes array to conform to new bounds. Does not change length.")


RecursiveRebase #

Signature:

Private Function RecursiveRebase( _
        ByRef SourceArray() As Variant, _

("re-indexes nested arrays to conform to new bounds. Child function of Rebase)


EnsureCapacity #

Signature:

Private Sub EnsureCapacity(ByVal MinimumCapacity As Long)

("Increases capacity of internal array if required.")


ConvertArrayForStorage #

Signature:

Private Function ConvertArrayForStorage( _
    ByRef Values As Variant, _
    ByVal CurrentArrayType As ArrayTypes, _
    Optional ByVal ConvertMultiToJagged As Boolean, _
    Optional ByVal ConvertJaggedNestedArrays As Boolean _
) As Variant()

("Converts a typed array to a variant() array")


TypedJaggedToVariantJagged #

Signature:

Private Function TypedJaggedToVariantJagged( _
    ByRef SourceArray As Variant, _
    Optional ByVal ConvertJaggedNestedArrays As Boolean, _
    Optional ByVal ConvertMultiToJagged As Boolean _
) As Variant()

("Converts a typed jagged array to a variant() jagged array")


TypedMultiToVariantMulti #

Signature:

Private Function TypedMultiToVariantMulti( _
    ByRef SourceArray As Variant _
) As Variant()

("Converts a typed md array to a variant() md array")


MapMultidimensionArray #

Signature:

Private Function MapMultidimensionArray( _
        ByRef SourceArray As Variant, _
        Optional ByVal KnownDepth As Long _
    ) As Variant()

("Returns an array representing the structure of a Multidimension array")


RecursiveTypedMultiToVariantMulti #

Signature:

Private Function RecursiveTypedMultiToVariantMulti( _
        ByRef SourceArray As Variant, _
        Optional ByVal Depth As Long, _
        Optional ByVal CurrentDepth As Long, _
        Optional ByRef Crumbs As Variant, _
        Optional ByRef Result As Variant, _
        Optional ByVal EnsureScalar As Boolean _
    ) As Variant()

("Recursively Converts typred multidimension arrays to variant md arrays arrays. For md arrays with more than 2d.")


JaggedToMulti #

Signature:

Private Function JaggedToMulti( _
        ByRef SourceArray() As Variant, _

("Converts jagged arrays to multidimension arrays")


RecursiveMultiToJagged #

Signature:

Private Function RecursiveMultiToJagged( _
        ByRef SourceArray As Variant, _
        Optional ByVal Depth As Long, _
        Optional ByVal CurrentDepth As Long, _
        Optional ByRef Crumbs As Variant _
    ) As Variant()

("Recursively Converts multidimension arrays to jagged arrays. For md arrays with more than 2d.")


RecursiveJaggedToMulti #

Signature:

Private Function RecursiveJaggedToMulti( _
        ByRef SourceArray() As Variant, _

("Recursively Converts jagged arrays to multidimension arrays. For jagged arrays with more than 2d.")


GetJaggedArrayDepth #

Signature:

Private Function GetJaggedArrayDepth(ByRef SourceArray() As Variant) As Long

("Returns a number representing how many levels of nested arrays are contained in array.")


GetMaxBoundsAtDimension #

Signature:

Private Function GetMaxBoundsAtDimension( _
        ByRef SourceArray() As Variant, _

("Gets the maximium bound values for a specified dimension of a jagged array.")


MapJaggedArray #

Signature:

Private Function MapJaggedArray( _
        ByRef SourceArray() As Variant, _

("Returns an array representing the structure of a jagged array")


GetArrayBounds #

Signature:

Private Function GetArrayBounds(ByVal SourceArray As Variant) As Long()

("Returns a 0-based array with two slots. First slot is the lowerbound of the passed array. second slot (index 0) is the upper bound.")


GetMultidimensionalArrayDepth #

Signature:

Private Function GetMultidimensionalArrayDepth(ByVal SourceArray As Variant) As Long

("Returns a number representing the total number of dimensions of a multidimension array.")


GetElementByBreadcrumb #

Signature:

Private Function GetElementByBreadcrumb( _
        ByVal SourceArray As Variant, _
        ByRef Crumb() As Variant _

("Returns the element stored in an array based on a crumb argument. A crumb is an array representing the location of the multidimension array slot.")


LetElementByBreadcrumb #

Signature:

Private Function LetElementByBreadcrumb( _
        ByRef SourceArray() As Variant, _

("Assigns an element to a location in a multidimensonal array based on a crumb argument. A crumb is an array representing the location of the multidimension array slot.")


CreateMultidimensionalArray #

Signature:

Private Function CreateMultidimensionalArray(ByRef Crumb() As Variant) As Variant()

("Returns an empty multidimensional array with the dimensions specified in the crumb argument. A crumb is an array representing the structure of the multidimension array.")